Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Data Interfaces and Communication Interfaces →  ABAP and Operating System Statements →  Operating System Statements of the Host Computer 

SXPG Framework for Operating System Statements

The only recommended method for executing operating system statements from ABAP on the operating system of the host computer of the current AS Instance or another server is to use the SXPG framework. This framework is based on a list of permitted operating system statements that can be called using function modules in the function group SXPG.

The list of permitted operating system statements is defined by the system administrator in transaction SM69. Here, the platform-dependent physical operating system statements are assigned to a logical command name used to address them in ABAP. When one of these logical command names is passed to one of the function modules listed below, the operating system statement appropriate for the platform in question is executed. Logical command names assigned to an operating system command used by all platforms can be flagged with the operating system ANYOS. Static parameters can be assigned to any operating system statement and further parameters can be specified for when the statement is called. When an operating system statement is called using a logical command name, implicit authorization checks are performed, accompanied by extra self-defined checks. SAP provides a range of predefined logical command names with the type SAP. Logical command names created by customers have the type KUNDE.

If they have the right authorizations, developers can view the list of operating system statements in transaction SM49 and execute them from here. The following function modules can be called from ABAP programs:

  • SXPG_CALL_SYSTEM for execution on the host computer of the current AS Instance
  • SXPG_COMMAND_EXECUTE for execution on other servers; the result can caught, but this is not mandatory
  • SXPG_COMMAND_EXECUTE_LONG, like SXPG_COMMAND_EXECUTE but with a longer list of parameters

These function modules can also be called remotely.

Other versions: 7.31 | 7.40 | 7.54


For more information, see the Documentation Programming with External Commands in SAP Help Portal.


Calls the operating system statement ping for the central database server of the system on the host computer of the current AS Instance using the logical command name PING defined by SAP. The result of the call is passed to the internal table result. The function module SXPG_CALL_SYSTEM can raise more specific exceptions than those handled explicitly here.

DATA dbserver TYPE c LENGTH 255. 
                  ID 'VALUE' FIELD  dbserver. 

DATA parameters TYPE sxpgcolist-parameters. 
parameters = |-c1 { dbserver }|. 

    commandname           = 'PING' 
    additional_parameters = parameters 
    exec_protocol         = result 
    no_permission         = 1 
    command_not_found     = 2 
    security_risk         = 3 
    OTHERS                = 4. 

IF sy-subrc = 0. 
  cl_demo_output=>display( result ). 
  cl_demo_output=>display( |Error, return code { sy-subrc }| ).