Application Development and Automation 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: 
Read only

SXPG_COMMAND_EXECUTE

Former Member
0 Likes
1,174

Dear Experts,

      I am using

'SXPG_COMMAND_EXECUTE' ,but it can not work SY-SUBRC return 2,  t_result no records, would you please give advice?

 

ALL FUNCTION 'SXPG_COMMAND_EXECUTE'

    EXPORTING

      commandname                   = c_extcom

      additional_parameters         = v_dir_input

      operatingsystem               = c_oper

    TABLES

      exec_protocol                 = t_result

    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.

*    IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

*  ENDIF.

4 REPLIES 4
Read only

Patrick_vN
Active Contributor
0 Likes
712

I'd start by checking table SXPGCOTABE if the value of C_EXTCOM exists there..

Read only

Former Member
0 Likes
712

Hi,


The system command variable c_extcom  gets the value from  SM69 tcode.

so, you are getting sy-subrc = 2.


create a command using SM69.

Go through the FM documentation you will get a clear idea.

Regards,

Anusha

Read only

Former Member
0 Likes
712

This message was moderated.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
712

Read first SXPG_COMMAND_EXECUTE: Check Authorization for and Execute an External Command (or FM documentation) to understand exception codes:


COMMAND_NOT_FOUND

Command name, as identified by  COMMANDNAME and  OPERATINGSYSTEM, has not been defined in the maintenance function (transaction SM69).

Regards,

Raymond