OO 长文本输入框
report ZLUPING01 no standard page heading line-size 255. DATA: LINE_LENGTH TYPE I VALUE 254, EDITOR_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER, TEXT_EDITOR TYPE REF TO CL_GUI_TEXTEDIT, TEXT TYPE STRING. START-OF-SELECTION. CALL SCREEN '100'. *&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_0100 OUTPUT. SET PF-STATUS 'S100'. * SET TITLEBAR 'xxx'. ENDMODULE. " STATUS_0100 OUTPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_0100 INPUT. DATA:OK_CODE TYPE SY-ucomm. OK_CODE = SY-ucomm. CASE OK_CODE. WHEN 'BACK'. LEAVE TO SCREEN 0. WHEN 'SAVE'. PERFORM SAVE_DATA. WHEN OTHERS. ENDCASE. ENDMODULE. " USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* *& Module DO_DATA OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE do_data OUTPUT. CREATE OBJECT EDITOR_CONTAINER EXPORTING CONTAINER_NAME = 'TEXTEDIT' EXCEPTIONS CNTL_ERROR = 1 CNTL_SYSTEM_ERROR = 2 CREATE_ERROR = 3 LIFETIME_ERROR = 4 LIFETIME_DYNPRO_DYNPRO_LINK = 5. CREATE OBJECT TEXT_EDITOR EXPORTING PARENT = EDITOR_CONTAINER WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION WORDWRAP_POSITION = LINE_LENGTH WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE. * 3)HIDE TOOLBAR AND STATUSBAR CALL METHOD TEXT_EDITOR->SET_TOOLBAR_MODE EXPORTING TOOLBAR_MODE = CL_GUI_TEXTEDIT=>FALSE. CALL METHOD TEXT_EDITOR->SET_STATUSBAR_MODE EXPORTING STATUSBAR_MODE = CL_GUI_TEXTEDIT=>FALSE. ENDMODULE. " DO_DATA OUTPUT *&---------------------------------------------------------------------* *& Form SAVE_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM save_data . CALL METHOD TEXT_EDITOR->GET_TEXTSTREAM EXPORTING ONLY_WHEN_MODIFIED = CL_GUI_TEXTEDIT=>TRUE IMPORTING TEXT = TEXT * IS_MODIFIED = EXCEPTIONS ERROR_CNTL_CALL_METHOD = 1 NOT_SUPPORTED_BY_GUI = 2 OTHERS = 3. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. IF text is INITIAL. CALL METHOD CL_GUI_CFW=>FLUSH EXCEPTIONS CNTL_SYSTEM_ERROR = 1 CNTL_ERROR = 2 OTHERS = 3. ENDIF. MESSAGE TEXT TYPE 'I'. *call METHOD EDITOR_CONTAINER->free. ENDFORM. " SAVE_DATA