Start of Content Area

 SXPG_COMMAND_LIST_GET:  Read a List of External Commands   Locate the document in its SAP Library structure

Use this function module to read a list of the external commands that have been defined in your SAP system into an internal table.  You can then loop over the table to select a command, or offer the list to your user for selection.  You can then pass the selection on to SXPG_COMMAND_EXECUTE for an authorization check and execution of the command. 

Syntax:

CALL FUNCTION ‘SXPG_COMMAND_LIST_GET’
    
IMPORTING                                                    
        COMMANDNAME      =
<SAP command name>  “ Default '*'  
        OPERATINGSYSTEM  =
<OS type in command definition>
                                               “ Default '*'
                           
        TARGETSYSTEM     =
<Host name for running command>        
                                               “ Default '*'
 
     TABLES                                                      
        COMMAND_LIST     =
<Command list>      “ Structure 
                                               “ SXPGCOLIST
    
EXCEPTIONS
        OTHERS = 1.

Parameters

IMPORTING Parameters

Parameter name

Use

COMMANDNAME

The name of the definition of the external command, as specified in the maintenance function (transaction SM69).

Generic searching:  You can use the * wild-card character to represent any number of occurrences of any character.  You can use * anywhere in the value. 

OPERATINGSYSTEM

The type of operating system upon which a command is to be carried out. 

Use to restrict the commands that are selected to the operating system of interest.  “ANYOS” selects SAP standard commands that can run be run as they are defined on any operating system.

Generic searching:  You can use the * wild-card character to represent any number of occurrences of any character.  You can use * anywhere in the value.

TARGETSYSTEM

Host name of the system upon which the selected command is to be carried out. 

Optional:  Use this parameter to have the system check the user’s authorization to run commands in the target system.  If the user is authorized, then COMMAND_LIST-PERMISSION is set to ‘X’.  Otherwise, the field is set to space ‘ ‘. 

TABLES Parameters

Parameter name

Use

COMMAND_LIST

Contains a list of the selected commands in the format shown in transaction SM49 or SM69.  The user can select a command from the list to run, if you pass the user’s selection on to SXPG_COMMAND_EXECUTE.

The table is empty if no command is found that meets the selection criteria.  No exception is raised in this case.

Notes on fields:

·         COMMAND_LIST-PERMISSION shows whether the calling user is authorized to run a command on the system that you name in TARGETSYSTEM (optional).  ‘X’ means that the user is authorized, ‘ ‘ means that the user does not have authorization to run commands on TARGETSYSTEM.

·         COMMAND_LIST-TRACEON and COMMAND_LIST-CHECKALL are set to ‘X’ if the user has the authorization to maintain external commands. 

·         COMMAND_LIST-SAPCOMMAND is set to ‘X’ if the command in that row is an SAP standard command.  These commands may not be modified in customer systems.

 

 

End of Content Area