可以修改任意程序(包括SAP标准程序)的程序

来源:互联网 发布:泰国人彘 知乎 编辑:程序博客网 时间:2024/05/16 12:37
这个程序 使用起来一定要格外小心,他可以把SAP的标准程序都改掉而且不需要ACCESS KEY.
我特别喜欢这个万用程序。在PRODUCTION 环境中是禁制修改或是开发新程序的。这只程序只要偷偷上到 PRODUCTION...内行的就知道是多麽POWERFUL 。等於帮你开了一个康庄大道....

report z_prog_modify no standard page heading
                  
message-id ypp.

data code(72occurs 10.

selection-screen begin of line.
selection-screen comment 1(36t001.
parametersp_file1 like ibipparms-path.
selection-screen end of line.


selection-screen begin of line.
selection-screen comment 1(36t003.
parametersprogram like tstc-pgmna.
selection-screen end of line.

selection-screen skip.
selection-screen begin of line.
parametersp_chk1 as checkbox.
selection-screen comment 4(60t002.
selection-screen end of line.

selection-screen skip.
selection-screen comment /1(72a001.
selection-screen comment /1(72a002.
selection-screen comment /1(72a003.
selection-screen comment /1(72a004.


tablestrdir.
data itrdir like trdir.
data rc like sy-subrc.

initialization.
  t001 
'Select the upload program text file'.
  t002 
'Do you want to exectue the program directly?'.
  t003 
'Program name to be replaced/created'.
  a001 
'Be Careful'.
  a002 
'The program could be modify directly without warning'.
  a003 
'You can create the program even in the production environment'.
  a004 
'Take care the SAP program can also be modified'.

*----------------------------------------------------------------------
at selection-screen on value-request for p_file1.
*----------------------------------------------------------------------
  
call function 'F4_FILENAME'
    
importing
      file_name 
p_file1.

start
-of-selection.
  
select single from trdir where name program.
  
move-corresponding trdir to itrdir.
  rc 
sy-subrc.

  
read report program into code.

  
refresh code.
  
clear code.

  
call function 'WS_UPLOAD'
    
exporting
      filename                
p_file1
      filetype                
'ASC'
    
tables
      data_tab                
code
    
exceptions
      file_open_error         
1
      file_read_error         
2
      no_batch                
3
      gui_refuse_filetransfer 
4
      invalid_type            
5
      
others                  6.

  
if sy-subrc <> 0.
    
message e000 with 'Error uploading file'.
  
endif.

  
check program(1) = 'Y' or program(1) = 'Z'."安全限制:否则容易修改标准程序,那将会是一件很危险的事情!
  
insert report program from code.

  
if sy-subrc <> 0.
    
message e000 with 'Insert program error!'.
  
endif.

  
if not p_chk1 is initial.
    
submit (programvia selection-screen and return.
  
endif.
0 0