1. 首页
  2. IT资讯

很恐怖ABAP修改程序(千万不要乱用!!!!!!!!!)

*& Report  **************
*&
*&———————————————————————*
*&
*&
*&———————————————————————*

REPORT  **************.

types: abapline(255) type c.
data: it_repsrc type standard table of abapline.
DATA: ZBACK type standard table of abapline.
DATA: wa_repsrc TYPE  abapline.
data : fcode like sy-ucomm.
DATA:changed like s38e-buf_varied.

DATA:IT_MESSAGE TYPE TABLE OF ZTEXT_EDITOR_MESSAGE WITH HEADER LINE.
DATA: BEGIN OF INCTABL OCCURS 10,
   LINE(100),
END OF INCTABL.

PARAMETERS:Zname LIKE RS38M-PROGRAMM.

start-of-selection.
set pf-status ‘PFSTA00’.
write: /1 ‘你编辑好的程序:’ color 2.
read report Zname into it_repsrc.
read report Zname into ZBACK.

  LOOP AT it_repsrc INTO wa_repsrc.
    WRITE :/ wa_repsrc.
  ENDLOOP.

at user-command.

if sy-ucomm = ‘ZWRITE’.     “写入
  CLEAR :INCTABL[].
  LOOP AT it_repsrc INTO wa_repsrc.
    INCTABL-LINE = wa_repsrc.
    APPEND INCTABL.
  ENDLOOP.
  INSERT REPORT ZNAME FROM INCTABL.
  if sy-subrc = 0.
    MESSAGE ‘写入成功,将测试运行新的程序.如果有错误,请点”还原”恢复.’  TYPE ‘I’.
  ENDIF.
  SUBMIT Zname  AND RETURN.
  read report Zname into it_repsrc.
  LOOP AT it_repsrc INTO wa_repsrc.
    WRITE :/ wa_repsrc.
  ENDLOOP.
elseif sy-ucomm = ‘EXEC’.   “还原
  it_repsrc[] = ZBACK[].
  INSERT REPORT Zname FROM ZBACK.
  LOOP AT ZBACK INTO wa_repsrc.
    WRITE :/ wa_repsrc.
  ENDLOOP.
  SUBMIT Zname  AND RETURN.
  MESSAGE ‘还原成功’ TYPE ‘I’.
ELSEIF SY-ucomm = ‘EDIT’.   “编辑
  perform. editor_CHX.
  LOOP AT it_repsrc INTO wa_repsrc.
    WRITE :/ wa_repsrc.
  ENDLOOP.
elseif sy-ucomm = ‘ZBACK’ OR sy-ucomm = ‘BACK’.    “退出
     CLEAR: inctabl[],it_repsrc[],ZBACK[],Zname.
     FREE :inctabl[],it_repsrc[],ZBACK[],Zname.
     leave to screen 0.
ELSE.
endif.

*&———————————————————————*
*&      Form  editor_CHX
*&———————————————————————*
*       text
*———————————————————————-*
*  –&gt  p1        text
*  <--  p2        text
*———————————————————————-*
FORM. editor_CHX .
  call function ‘EDITOR_APPLICATION’
       exporting
            application = ‘BF’
            display     = ‘ ‘
            name        = ‘[编辑你的程序:]’
       importing
            fcode       = fcode
            changed     = changed
       tables
            content     = it_repsrc.
ENDFORM.                    ” editor_CHX

*********************后话
用上面这个程序,可以修改SAP的任何程序.不需要申请KEY,也不会产生序列号.建议有丰富ABAP编写经验的人才可以使用,如果你一定要使用,请记住”写入程序”后的提示.在测试正确前,不要退出本程序,这样,你还有机会还原!!!!!!!!!(想想吧,如果使用不慎,即使几百万的SAP系统不会全毁了,某个模块也会可能毁坏.所以,一定慎重使用).

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/223653/viewspace-1789362/,如需转载,请注明出处,否则将追究法律责任。

主题测试文章,只做测试使用。发布者:℅傍ㄖ免沦陷dε鬼,转转请注明出处:http://www.cxybcw.com/192203.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code