这个程序 使用起来一定要格外小心,他可以把SAP的标准程序都改掉而且不需要ACCESS KEY.
我特别喜欢这个万用程序。在PRODUCTION 环境中是禁制修改或是开发新程序的。这只程序只要偷偷上到 PRODUCTION.... 内行的就知道是多麽POWERFUL了 。等於帮你开了一个康庄大道....
report z_prog_modify no standard page heading
message-id ypp.
data code(72) occurs 10.
selection-screen begin of line.
selection-screen comment 1(36) t001.
parameters: p_file1 like ibipparms-path.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment 1(36) t003.
parameters: program like tstc-pgmna.
selection-screen end of line.
selection-screen skip.
selection-screen begin of line.
parameters: p_chk1 as checkbox.
selection-screen comment 4(60) t002.
selection-screen end of line.
selection-screen skip.
selection-screen comment /1(72) a001.
selection-screen comment /1(72) a002.
selection-screen comment /1(72) a003.
selection-screen comment /1(72) a004.
tables: trdir.
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 (program) via selection-screen and return.
endif.
评论