Specifying working directory while executing FM SXPG_COMMAND_EXECUTE in SAP system

SAP HANASAPSAP Basis

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.

raja
Published on 06-Dec-2017 15:46:18
Advertisements