‎2007 Aug 14 5:54 AM
Hi Friends,
Can any one tell the difference between the below two Function Modules:
1) SXPG_CALL_SYSTEM .
2)SXPG_COMMAND_EXECUTE.
Quick answer will be rewarded.
Advance thanks.
poorna.
‎2007 Aug 14 5:59 AM
Hi
1)SXPG_CALL_SYSTEM: Execute External Command (Express Method)
Using this function module, you can:
Check a user's authorization to execute a command
Execute the command
To determine the system on which the command should be executed, the function module uses by default the current host system and the current operating system type of the user.
As the function module is RFC-capable, you can use the RFC interface (Remote Function Call Interface) to run the function module in a different SAP application server. The external command is then accordingly executed in the host system of the other SAP server.
SXPG_CALL_SYSTEM uses the following rules to determine which variant of a command is used for the execution:
If a command with the same operating system type as the one in the sytem field SY-OPSYS exists, this definition is used for the execution of the command.
If the first check fails, the syntax group for SY-OPSYS is determined. A syntax group is an SAP construct that groups operating systems that use the same syntax for commands and filenames. If a command whose operating system type matches the determined syntax group, this definition of the command is used.
If no matching definition is found for the syntax group, the function module searches for a definition with the operating system type ANYOS (executable in all supported operating systems). This definition is then used, if found.
Otherwise, the exception COMMAND_NOT_FOUND is triggered.
2)SXPG_COMMAND_EXECUTE
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.
Regards
Preeti
<b>
*reward if useful</b>
‎2007 Aug 14 6:00 AM
Hi
FM 'SXPG_COMMAND_EXECUTE'. You pass it the external
command created within transaction SM69 and it will execute it.
SXPG_CALL_SYSTEM: Run an External Command
reward points to all helpful answers
kiran.M
‎2007 Aug 14 6:00 AM
Hi,
<b>SXPG_CALL_SYSTEM</b>checks if the command supplied is a command of the any Operating SYstem then only it is executed else it raises exception.
Where as <b>SXPG_COMMAND_EXECUTE</b> this does not perform that check.
Both internally use this FM "SXPG_COMMAND_EXECUTE_LONG" to execute the command but SXPG_CALL_SYSTEM checks for OS commands before calling this FM. Check the code.
Regards,
Sesh
‎2007 Aug 14 6:01 AM
Both are same except in SXPG_COMMAND_EXECUTE, you can specify the target system, operating system, RFC destination.
‎2007 Aug 14 6:04 AM
hi
<b>SXPG_CALL_SYSTEM</b> you can check the user's authorization for the specified command and run the command. The command runs on the host system on which the function module is executed. The function module is RFC capable. It can therefore be run on the host system at which a user happens to be active or on another designated host system at which an R/3 server is active.
<b>SXPG_COMMAND_EXECUTE</b> Check a user's authorization to use a command, as in SXPG_COMMAND_CHECK. If the authorization check is successful, then execute the command on the target host system
<b>reward points for useful ans</b>
Regards
Vivek