码迷,mamicode.com
首页 > 其他好文 > 详细

关于ECP直接修改ABAP代码

时间:2015-08-01 11:32:43      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

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

 

关于ECP直接修改ABAP代码

标签:

原文地址:http://www.cnblogs.com/colorstory/p/4693818.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!