在 SAP 中移动文件的方法
以下方法为使用SM69 中的外部命令的方法,来进行移动文件。
*---------------------------------------------------------------------*
* FORM move_file *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> P_FILENAME *
*---------------------------------------------------------------------*
form move_file using p_filename.
data: cmnd like sxpgcolist-name,
parm like sxpgcolist-parameters .
data: begin of out_data occurs 50.
include structure btcxpm.
data: end of out_data .
data: rtn_ch.
data: classtype(3) type c,
i_err(128) type c,
in_file(255) type c,
out_file(255) type c.
*< 1 >* Call LHA Command
* create system command
cmnd = 'ZMOVE'. "<-- system command name. Refer "SM69"
********************************************************
* Configuration *
* operating system command : "cmd" *
* parameters for operating system command : "/c move" *
********************************************************
* MOVE need parameter "<source file> _ <target file>"
*loop at file_name.
concatenate fpath p_filename into out_file.
* concatenate topath into IN_FILE.
in_file = topath.
concatenate out_file in_file into parm separated by space.
*call system command
clear rtn_ch.
call function 'SXPG_CALL_SYSTEM'
exporting
commandname = cmnd
additional_parameters = parm
* IMPORTING
* STATUS = RTN_CH
tables
exec_protocol = out_data
exceptions
no_permission = 01
command_not_found = 02
parameters_too_long = 03
security_risk = 04
wrong_check_call_interface = 05
program_start_error = 06
program_termination_error = 07
x_error = 08
parameter_expected = 09
too_many_parameters = 10
illegal_command = 11.
*
* write: / 'File moved:', out_file.
*
*endloop.
endform. " move_file