SAP abap 提供兩個方法兩實作和剪貼闆的互動.下面分别介紹:
1、複制内容到剪貼闆
方法:cl_gui_frontend_services=>clipboard_export
示例:
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = itab[]
CHANGING
rc = rc
* EXCEPTIONS
* CNTL_ERROR = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
* others = 4
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2、從剪貼闆中複制内容到内表中
方法:cl_gui_frontend_services=>clipboard_import
示例:
CALL METHOD cl_gui_frontend_services=>clipboard_import
IMPORTING
DATA = itab[]
LENGTH = rc
* EXCEPTIONS
* CNTL_ERROR = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
* others = 4
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.