Search code examples
command-lineabapsap-basis

Current working directory for SXPG_COMMAND_EXECUTE?


Is there a way to specify the current working directory for the system command executed by the function module SXPG_COMMAND_EXECUTE?

I do not see any parameter which would allow me to do that either by defining the command in transaction SM69 or on the list of IMPORTING parameters in SE37.

It looks like by default such commands are started in DIR_HOME which can be viewed by the transaction AL11. Do I have any control over that?


Solution

  • There isn't a way of doing it via `SM69' unfortunately. I think the only solution is to create a script and call that.

    I was going to suggest wrapping the statements in a SM69 command defined as a call to sh with parameters of -c 'cd <dir> && /path/to/command' but unfortunately that doesn't work. According to note 401095 wildcards are not permitted. When I tested, && was translated into a single &, causing the command to fail.