SAP Function Modules

Share |

SXPG_COMMAND_EXECUTE SAP Function module - Execute an External Command

Pattern for FM SXPG_COMMAND_EXECUTE - SXPG COMMAND EXECUTE
Associated Function Group: SXPT
Released Date: 29.05.2000
CALL FUNCTION 'SXPG_COMMAND_EXECUTE' "Execute an External Command
  EXPORTING
    commandname =               " sxpgcolist-name  Name of External Command
*   additional_parameters =     " sxpgcolist-parameters  Arguments for the External Command
*   operatingsystem = SY-OPSYS  " sxpgcolist-opsystem  Executing Host System
*   targetsystem = SY-HOST      " rfcdisplay-rfchost  Target System
*   stdout = 'X'                " extcmdexim-stdout  Log STDOUT Output Data
*   stderr = 'X'                " extcmdexim-stderr  Log STDERR Output Data
*   terminationwait = 'X'       " extcmdexim-termwait  Wait for Termination of Exteranl Command
*   trace =                     " extcmdexim-trace  Perform Trace (Only for Tests)
*   dialog =                    " btch0000-char1  Reference type CHAR1 for background processing
  IMPORTING
    status =                    " extcmdexex-status  Status
    exitcode =                  " extcmdexex-exitcode  Exitcode of External Program
  EXCEPTIONS
    NO_PERMISSION = 1           "               User Does Not Have Authorization
    COMMAND_NOT_FOUND = 2       "               External Command Not Defined
    PARAMETERS_TOO_LONG = 3     "               Parameters Too Long
    SECURITY_RISK = 4           "               Command Rejected for Security Reasons
    WRONG_CHECK_CALL_INTERFACE = 5  "           Incorrect Call of a Function Module
    PROGRAM_START_ERROR = 6     "               Error while Starting the External Command
    PROGRAM_TERMINATION_ERROR = 7  "            Return Code with Errors
    X_ERROR = 8                 "               Reserved
    PARAMETER_EXPECTED = 9      "               No Additional Arguments Specified
    TOO_MANY_PARAMETERS = 10    "               Too Many Parameters Specified
    ILLEGAL_COMMAND = 11        "               External Command Not Defined Properly
    WRONG_ASYNCHRONOUS_PARAMETERS = 12  "       Reserved
    CANT_ENQ_TBTCO_ENTRY = 13   "               Reserved
    JOBCOUNT_GENERATION_ERROR = 14  "           Reserved
    .  "  SXPG_COMMAND_EXECUTE

SAP Documentation for FM SXPG_COMMAND_EXECUTE

This text was copied from IO BCLOG01_005, folder HELP.BCDWBLIB

FUNCTIONALITY

Using this function module, you can check the authorization of a user to execute a particular external command and run the command:
  • With the arguments specified in ADDITIONAL_PARAMETERS

  • On the target host system defined by OPERATINGSYSTEM and TARGETSYSTEM

  • If an SAP profile parameter is inserted in the portion of the command stored in the database, then the value of this parameter is substituted into the command. If an SAP application server is active on the target system (TARGETSYSTEM), then the profile parameter values are read from the profile that is active on that system. No parameter substitution is made in ADDITIONAL_PARAMETERS.
    After substitution, the command is checked for the presence of "dangerous" characters such as the semicolon ( ; ) on UNIX systems.
    If an additional "security function module" is specified in the command definition, this function module is also called in the course of processingebenfalls. This function module can prevent execution of the command.
    If the authorization checks complete successfully, the command is run on the target host system.
    Documentation extract taken from SAP system, Copyright (c) SAP AG






    Share |