Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Specifying working directory while executing FM SXPG_COMMAND_EXECUTE in SAP system

Is there a way to specify current working directory while executing command by FM SXPG_COMMAND_EXECUTE. I checked T-code: SM69 and SE37 but couldn’t able to find any parameter specific for this. 

It seems that all these commands are started in “DIR_HOME” and can be checked using T-Code: AL11.

Any suggestions?


1 Answer
SAP Expert

I thought it can be done using a script in SM69 T-code defined as a call to sh with parameters of -c 'cd <dir> && /path/to/command.

However it doesn’t accept wildcards and && is converted to & and script is not working. As per SAP Note 401095 - Wildcards in external commands

Symptom:

Customers would like to use wildcards when defining external commands

Other Terms:

SM49, SM69, wildcard

Reason and Prerequisites:

Wildcards are not supported in external commands, amongst other things for security reasons.

For example:

An ls with a wildcard was defined as a command: "ls $1".

During execution, the parameter "; rm -R /*" is entered. At operating system level, the command string "ls; rm -R /*" would be transferred for execution.

Solution:

Call using an external shellscript where the wildcards are predefined.

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.