‎2011 Sep 19 1:46 PM
Hi,
I have a problem by using FM "SXPG_COMMAND_EXECUTE", SM49 while i try to move the whole content of a SAP folder into another.
Foders are on the same file system:
source: /tmp/
dest: /usr/sap/tmp
I made a command in SM69 named ZMOVE:
I put OS: Linux (is case sensitive)
command: "mv"
parameters: /tmp/* /usr/sap/tmp
hence the final sentence should be "mv /tmp/* /usr/sap/tmp". I did it directly by using program "rsbdcos0" and works fine.
Now if I try to execute the command ZMOVE from SM49 or using the function module it gives the same error
*mv: cannot stat /tmp/ ': No such file or directory**
I made several tries by changing the parameter section (also using a script on the same directory).
The permissions are ok, so the only problem seems to be the wildcard (*) character.
Any suggestions?
Thanks in advance
Fabrizio
‎2011 Sep 20 2:03 PM
Problem solved.
Forget function modules, SM69 etc. there's an ABAP command in order to perform a SO command.
Here an example:
data: lf_file like rlgrap-filename,
lf_idx(3) type n,
cmd(254),
result(255) occurs 100 with header line.
cmd = 'mv /dir_source/* /dir_dest'.
call 'SYSTEM' id 'COMMAND' field cmd
id 'TAB' field result-sys.
‎2011 Sep 20 2:22 PM
Thanks for sharing, I was running into the same problem some time ago (with SunOS, not Linux though). The only downside is that this requires a small custom ABAP program, as opposed to a simple job step directly for the external command.
It is still a mystery to me why the external command works for moving single files, but not for multiple files via wildcards.
Thomas