Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SXPG_COMMAND_EXECUTE

Former Member
0 Kudos

Hello.

I'm activating this FM with a decryption exe file and I keep on getting subrc = 0 but the process is not being activated.

The export parameters are:

status = E

exitcode = 2

What is that mean ??

3 REPLIES 3

Former Member
0 Kudos

Hi ,

SXPG_COMMAND_EXECUTE: Check Authorization for and Execute an External Command

Use this function module to check a useru2019s authorization to run a particular external command and then carry out the command.

Like SXPG_COMMAND_CHECK, this function module checks that the user is authorized to execute the command:

with the arguments specified in ADDITIONAL_PARAMETERS

on the target host system, as identified by OPERATINGSYSTEM and TARGETSYSTEM.

If any R/3 profile parameter has been inserted in the portion of the command stored in the database, then the value of this parameter is substituted into the command. If an R/3 application server is active on the target system (TARGETSYSTEM), then the profile parameter values are read from the profile in effect 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 "safety" function module has been specified in the definition of the command, then this is called as well in the course of processing. This function module can prevent execution of the command.

If the authorization checks complete successfully, then the command is run on the target host system.

In the above STATUS:

Returns the final status of the execution of the external command:

· Value u2018Ou2019: The external command was started and ran to end successfully.

· Value u2018Eu2019: An error occurred; the external command was not run successfully.

CALL FUNCTION u2018SXPG_COMMAND_EXECUTEu2019

IMPORTING

COMMANDNAME = " In structure BTCXPM. Can

" contain STDOUT, STDERR

EXCEPTIONS

NO_PERMISSION " Command rejected by user exit auth.

" check

COMMAND_NOT_FOUND " Command not defined in R/3 database

PARAMETERS_TOO_LONG " Complete parameter string exceeds

" 128 characters

SECURITY_RISK " Security check failed

WRONG_CHECK_CALL_INTERFACE " Problem with function

" module for additional

" security check

PROGRAM_START_ERROR " Error while starting program

PROGRAM_TERMINATION_ERROR "Error while requesting final

" status of program

X_ERROR " Reserved

PARAMETER_EXPECTED " Required parameter not specified

TOO_MANY_PARAMETERS " User arguments not allowed by

" supplied in call

ILLEGAL_COMMAND " Command not legitimately defined

WRONG_ASYNCHRONOUS_PARAMETERS " Reserved for future

" use

CAT_ENQ_TBTCO_ENTRY " Reserved for future use

JOBCOUNT_GENERATION_ERROR " Reserved for future use

OTHERS.

Refer this link.

http://help.sap.com/saphelp_40b/helpdata/en/fa/0971fb543b11d1898e0000e8322d00/content.htm

Regards,

Jagadish.

Former Member
0 Kudos

The check FM works fine and returns OK.

Is this an authorization problem for sure ? Is this basis issue ? Maybe missing parameter ?

In sm69 it works fine with the same parameters.

It's urgent, please help ..

Thanks in advance,

Rebeka

Former Member
0 Kudos

Status

Returns the final status of the execution of the external command:

If the include RSXPGDEF is called in your program, there are the following possible values:

Value 'O': The external command was started and successfully run.

Value 'F': Error; the external command was not executed.

Value 'E': Error, the external command was terminated with an error.

Value 'S': The external command was terminated due to an operating system message.

Value 'C': The external command was terminated in an unknown way.

If you do not use RSXPGDEF, only the following values can be delivered back:

Value 'O': The external command was started and successfully run.

Value 'E': Error, the external command was not executed

From my experience with this FM:

A command executed with using this FM is successful when

STATUS = 'O' ( letter O as 'O'range)

EXITCODE = 0 ( zero)

other exitcodes which may returned have different and can vary from 0 to 255. But success is achieved means command executed successfully if EXITCODE is 0 (zero).

Thanks