【ABAP】关于ECP直接修改ABAP代码
1.针对REPORT
REPORT zfc_mm_change. TABLES: rs38m. PARAMETERS: p_progm LIKE rs38m-programm OBLIGATORY MEMORY ID rid, p_uname LIKE sy-uname DEFAULT sy-uname . DATA i_code TYPE TABLE OF string. READ REPORT p_progm INTO i_code."读取程序行到i_code中 IF p_progm(1) = 'Z' OR p_progm(2) = 'LZ' OR p_progm(4) = 'DEMO'. EDITOR-CALL FOR i_code."执行可编辑逻辑 ENDIF. IF sy-ucomm = 'WB_SAVE'. sy-uname = p_uname. INSERT REPORT p_progm FROM i_code. "更改写入逻辑 ENDIF.
READ REPORT prog INTO itab [MAXIMUM WIDTH INTO wid].
标准代码实例:
DATA prog TYPE c LENGTH 30. DATA itab TYPE TABLE OF string. prog = '...'. READ REPORT prog INTO itab. IF sy-subrc = 0. APPEND 'FORM subr.' TO itab. ... APPEND 'PERFORM ...' TO itab. APPEND 'ENDFORM.' TO itab. GENERATE SUBROUTINE POOL itab NAME prog. PERFORM ('SUBR') IN PROGRAM (prog). ENDIF.
可执行代码:
REPORT zfr_test. DATA prog TYPE c LENGTH 30. DATA itab TYPE TABLE OF string. DATA: mess TYPE string, sid TYPE string. prog = 'ZFR_TEST11'. READ REPORT prog INTO itab. IF sy-subrc = 0. APPEND 'FORM TEST.' TO itab. APPEND 'WRITE: 1.' TO itab. APPEND 'ENDFORM.' TO itab. GENERATE SUBROUTINE POOL itab NAME prog MESSAGE mess SHORTDUMP-ID sid. PERFORM ('TEST') IN PROGRAM (prog) IF FOUND. ENDIF.
REPORT ZFR_TEST11.
结果为: 1.
GENERATE SUBROUTINE POOL itab NAME prog MESSAGE mess SHORTDUMP-ID sid. "通过现有代码,生成可执行程序
EDITOR-CALL FOR REPORT prog [DISPLAY-MODE].
REPORT zfr_test. DATA prog TYPE c LENGTH 30. DATA itab TYPE TABLE OF string. prog = 'ZFR_TEST11'. READ REPORT prog INTO itab. "读取代码 EDITOR-CALL FOR itab ."DISPLAY-MODE. 设置代码可编辑 IF sy-ucomm = 'WB_SAVE'. INSERT REPORT prog FROM itab. "代码写入 ENDIF.
2.使用SE37->TRINT_OBJECTS_CHECK_AND_INSERT: 487行断点,ct_ko200[]内表清空更改。
posted on 2015-08-01 11:03 color_story 阅读(690) 评论(0) 编辑 收藏 举报