TEXT Object 등록 : SM30 - V_TTXOBI
텍스트오브젝트 LOG_REASON
내역 BOM 로그 종료사유
백업모드 V
편집기 어플리케이션 TN
라인너비 72
스타일
서식
텍스트포맷
TEXT ID 등록 : SM30 - V_TTXIDI
텍스트오브젝트 LOG_REASON
텍스트 ID ZLOG
내역 I/F 로그
INCLUDE ID
텍스트포맷
구조
- 전역선언
*----------------------------------------------------------------------* * Constants *----------------------------------------------------------------------* CONSTANTS : gc_text_tdid TYPE tdid VALUE 'ZLOG', gc_text_object TYPE thead-tdobject VALUE 'LOG_REASON'. *----------------------------------------------------------------------* * Global Variable *----------------------------------------------------------------------* DATA : gv_ok_save TYPE sy-ucomm, gv_ok_code TYPE sy-ucomm. DATA : gv_tdname TYPE thead-tdname. DATA : gt_fcode TYPE TABLE OF sy-ucomm WITH HEADER LINE.
- 함수
FUNCTION zmgb_save_text. *"---------------------------------------------------------------------- *"*"Local interface: *" IMPORTING *" REFERENCE(IV_LOGSEQ) TYPE ZMGE_LOGSEQ *" REFERENCE(IV_READONLY) TYPE CHAR01 DEFAULT ' ' *" REFERENCE(IV_DELETE) TYPE CHAR01 DEFAULT ' ' *"---------------------------------------------------------------------- CLEAR : gv_readonly, gv_tdname. gv_readonly = iv_readonly. gv_tdname = iv_logseq. IF iv_delete IS INITIAL. CLEAR : gt_tline[]. SELECT SINGLE * FROM zmggtreason WHERE zlogseq EQ iv_logseq. IF sy-subrc IS INITIAL. SELECT SINGLE name_text INTO gv_cruser_nm FROM v_usr_name WHERE bname EQ zmggtreason-cruser. IF sy-subrc IS NOT INITIAL. gv_cruser_nm = zmggtreason-cruser. ENDIF. SELECT SINGLE name_text INTO gv_chuser_nm FROM v_usr_name WHERE bname EQ zmggtreason-chuser. IF sy-subrc IS NOT INITIAL. gv_chuser_nm = zmggtreason-chuser. ENDIF. ENDIF. CALL FUNCTION 'READ_TEXT' "#EC CI_SUBRC EXPORTING id = gc_text_tdid language = sy-langu name = gv_tdname object = gc_text_object TABLES lines = gt_tline EXCEPTIONS id = 1 language = 2 name = 3 not_found = 4 object = 5 reference_check = 6 wrong_access_to_archive = 7 OTHERS = 8. CALL SCREEN 0100 STARTING AT 5 5 ENDING AT 45 20. ELSE. CALL FUNCTION 'DELETE_TEXT' "#EC CI_SUBRC EXPORTING id = gc_text_tdid language = sy-langu name = gv_tdname object = gc_text_object savemode_direct = 'X' EXCEPTIONS not_found = 1 OTHERS = 2. CALL FUNCTION 'COMMIT_TEXT' "#EC CI_SUBRC EXPORTING id = gc_text_tdid language = sy-langu name = gv_tdname object = gc_text_object. ENDIF. ENDFUNCTION.- 스크린 로직
PROCESS BEFORE OUTPUT. MODULE status_0100. PROCESS AFTER INPUT. MODULE exit_0100 AT EXIT-COMMAND. MODULE user_command_0100.- PBO
*&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_0100 OUTPUT. CLEAR : gt_fcode[]. IF gv_readonly IS NOT INITIAL. APPEND 'SAVE' TO gt_fcode. ENDIF. SET PF-STATUS 'T100' EXCLUDING gt_fcode[]. SET TITLEBAR 'T100'. PERFORM init_editor. ENDMODULE.- PAI
*&---------------------------------------------------------------------* *& Module EXIT_0100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE exit_0100 INPUT. CLEAR : gv_ok_save. gv_ok_save = gv_ok_code. CLEAR : gv_ok_code. CASE gv_ok_save. WHEN 'BACK' OR 'CANC' OR 'EXIT' OR 'CLOSE'. PERFORM free_text_obj. LEAVE TO SCREEN 0. ENDCASE. ENDMODULE. *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_0100 INPUT. CLEAR : gv_ok_save. gv_ok_save = gv_ok_code. CLEAR : gv_ok_code. CASE gv_ok_save. WHEN 'SAVE'. PERFORM save_longtext. PERFORM free_text_obj. LEAVE TO SCREEN 0. ENDCASE. ENDMODULE.- Sub Routine
*&---------------------------------------------------------------------* *& Form INIT_EDITOR *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM init_editor . IF go_custom_cont IS INITIAL. CREATE OBJECT go_custom_cont EXPORTING container_name = 'CONT_EDITOR'. ENDIF. IF go_texteditor IS INITIAL. CREATE OBJECT go_texteditor EXPORTING parent = go_custom_cont. ENDIF. CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT' EXPORTING language = sy-langu TABLES itf_text = gt_tline text_stream = gt_texts. IF gv_readonly IS NOT INITIAL. CALL METHOD go_texteditor->set_readonly_mode EXPORTING readonly_mode = go_texteditor->true . ENDIF. CALL METHOD go_texteditor->set_text_as_stream EXPORTING text = gt_texts[]. CALL METHOD go_texteditor->set_wordwrap_behavior EXPORTING wordwrap_position = '72' EXCEPTIONS error_cntl_call_method = 1 OTHERS = 2. ENDFORM. *&---------------------------------------------------------------------* *& Form SAVE_LONGTEXT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM save_longtext . DATA : ls_thead TYPE thead. CLEAR : gt_tline[]. CALL METHOD go_texteditor->get_text_as_stream IMPORTING text = gt_texts[]. CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT' TABLES text_stream = gt_texts[] itf_text = gt_tline[]. ls_thead-tdobject = gc_text_object. ls_thead-tdname = gv_tdname. ls_thead-tdid = gc_text_tdid. ls_thead-tdfdate = sy-datum. ls_thead-tdftime = sy-uzeit. ls_thead-tdluser = sy-uname. ls_thead-tdspras = sy-langu. CALL FUNCTION 'SAVE_TEXT' EXPORTING header = ls_thead savemode_direct = 'X' TABLES lines = gt_tline EXCEPTIONS id = 1 language = 2 name = 3 object = 4 OTHERS = 5. ENDFORM. *&---------------------------------------------------------------------* *& Form FREE_TEXT_OBJ *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM free_text_obj . CALL METHOD go_texteditor->free. FREE go_texteditor. go_custom_cont->free( ). FREE go_custom_cont. ENDFORM.
'SAP > ABAP' 카테고리의 다른 글
CTS Table length check Function. (0) | 2015.11.25 |
---|---|
sending SAP Office Mail ( SO01 ) (0) | 2015.09.01 |
Check if Function call is RFC or Not. (0) | 2015.07.09 |
Set initial Screen Variant for Report (0) | 2014.12.03 |
how to call BAPI_ALM_ORDER_MAINTAIN (0) | 2014.11.27 |