代码:
DATA: OK_CODE TYPE SY-UCOMM, SAVE_OK LIKE OK_CODE.
*定制控制 编辑对象定义
DATA Container TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA EDITOR TYPE REF TO CL_GUI_TEXTEDIT.
DATA: INIT,
M1(256) TYPE C OCCURS 0,
LINE(256) TYPE C.
LINE = '请输入:'. "默认文字
APPEND LINE TO M1.
CALL SCREEN 1000.
REFRESH M1.
CALL METHOD EDITOR->GET_TEXT_AS_R3TABLE "获取数据”
IMPORTING
TABLE = M1.
LOOP AT M1 INTO LINE.
WRITE / LINE.
ENDLOOP.
MODULE STATUS_0100 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
IF INIT IS INITIAL.
INIT = 'X'.
CREATE OBJECT: CONTAINER EXPORTING CONTAINER_NAME = 'PP'. " pp 是自己画的屏幕名字
CREATE OBJECT EDITOR
EXPORTING
PARENT = CONTAINER
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_POSITION = 256
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE.```
ENDIF.
CALL METHOD EDITOR->SET_TEXT_AS_R3TABLE "写数据
EXPORTING
TABLE = M1.
ENDMODULE. " STATUS_0100 OUTPUT
- 去掉工具栏、状态栏
CALL METHOD EDITOR->SET_TOOLBAR_MODE "去掉工具栏
EXPORTING
TOOLBAR_MODE = 0.
CALL METHOD EDITOR->SET_STATUSBAR_MODE "去掉状态栏
EXPORTING
STATUSBAR_MODE = 0.
例图.png
- 不可编辑,灰掉
CALL METHOD EDITOR->SET_READONLY_MODE
EXPORTING
READONLY_MODE = '1'
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
INVALID_PARAMETER = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
例图.png
网友评论