關於ECP直接修改ABAP代碼

1.針對REPORTspa

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].code

標準代碼實例:blog

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. 

可執行代碼:qt

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.    string

  GENERATE SUBROUTINE POOL itab NAME prog MESSAGE mess SHORTDUMP-ID sid. "經過現有代碼,生成可執行程序it

 

EDITOR-CALL FOR REPORT prog [DISPLAY-MODE].

class

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[]內表清空更改。test

相關文章
相關標籤/搜索