‎2007 May 21 4:04 AM
Hello Friends,
Please explain me the functionality of this program.
-
REPORT ZABC.
PARAMETER PCOMMAND(18) DEFAULT 'zw1001'.
DATA: BEGIN OF PROTOCOL OCCURS 0.
INCLUDE STRUCTURE BTCXPM.
DATA: END OF PROTOCOL.
DATA: STATUS_00 LIKE BTCXP3-EXITSTAT.
DATA: XCOMMAND LIKE SXPGCOTABE-NAME.
DATA: ADDI_PARA LIKE SXPGCOLIST-PARAMETERS.
MOVE PCOMMAND TO XCOMMAND.
CLEAR STATUS_00.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = XCOMMAND
IMPORTING
STATUS = STATUS_00
TABLES
EXEC_PROTOCOL = PROTOCOL
EXCEPTIONS
NO_PERMISSION = 1
COMMAND_NOT_FOUND = 2
PARAMETERS_TOO_LONG = 3
SECURITY_RISK = 4
WRONG_CHECK_CALL_INTERFACE = 5
PROGRAM_START_ERROR = 6
PROGRAM_TERMINATION_ERROR = 7
X_ERROR = 8
PARAMETER_EXPECTED = 9
TOO_MANY_PARAMETERS = 10
ILLEGAL_COMMAND = 11
WRONG_ASYNCHRONOUS_PARAMETERS = 12
CANT_ENQ_TBTCO_ENTRY = 13
JOBCOUNT_GENERATION_ERROR = 14
OTHERS = 15.
WRITE: / SY-SUBRC.
WRITE: / STATUS_00.
LOOP AT PROTOCOL.
WRITE: / PROTOCOL.
ENDLOOP.
Thanks,
Shreekant
‎2007 May 21 4:52 AM
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.