Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
External Operating System Commands

In many instances a developer may need to execute an operating system command to achieve the specific requirements of the application. The transaction SM69 can be used to create / maintain external operating system commands. These commands are protected by SAP system authorizations and provide the safest way of executing OS commands from an SAP Web AS system.

The snapshot below shows the parameters required during the creation of an external OS command. This sample external command is used to move a file in the application server from one directory to another.



Using External Commands in an ABAP Program

Use the function module 'SXPG_COMMAND_EXECUTE' to execute an external command in an ABAP program. See sample code for details:





Additional Authorization Checks through Check Module

When you create an external command, you can specify an additional function module which will be called to check a user’s authorization to run a command. The function module should have the interface of SXPG_DUMMY_COMMAND_CHECK.



To write your own authorization-checking module, do the following:

1. Create a function module, say ZMOVE_COMMAND_CHECK, as a copy of SXPG_DUMMY_COMMAND_CHECK
2. Write your code for authorization check.
3. Specify the function module as Check module in SM69.
15 Comments