SM49 & SM69 Wildcard external commands error
How to create external commands using SM49&SM69 in SAP Application which is built on UNIX/LINUX OS. If we are going to create any os level command from SM49 it won’t allow
us to use the wildcard entries like ” * “, “?”. A functional module “SXPG_COMMAND_LIST_GET” is used in every ABAP program to execute the OS level commands. Which can impact in moving or copying or deleting a set of files in a folder from the OS level.
Reproducing the issue:
- Go to SM49 and select the Command to move or copy or delete all files from a folder.
- Execute the command.
- By using a wildcard entry “*” an error occurred in moving files.
To overcome this issue and to create the OS level commands from SM49&SM69, We have to use a shell script where wildcard entries are allowed to execute.
- Create a folder location on the OS level to place Shell Script files.
- Now Create a .sh file and write the required command(mv) inside that file.
- Upload this file to the OS-level folder location by using the CG3Z t-code in the SAP application server or we can use Filezilla or WinSCP and provide the executable permissions to the file ZMOVEE.
- Check the uploaded file from AL11.
- Now go to SM49 and update the command with the new Shell script file location with SH command. So, that whenever the ABAP program gets triggered the functional module “SXPG_COMMAND_LIST_GET” will execute the SM49 ZMOVEE command.
- Once the command gets Executed all the files inside HR_PAYROLL_IN will be moved to HR_PAYROLL_OUT with return code “0”
Following the above process, we can create multiple types of shell-script files at the OS level and we can execute them from the SAP application level using T-codes SM49&SM69. I hope my blog is helpful for you and I also welcome any comments, opinions, and feedback on my blog.