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,484

Hi, fellow.

I met a problem.

I want to use a RFC function named "SXPG_COMMAND_EXECUTE".

I just don't understand WHY a totally same function "SXPG_COMMAND_EXECUTE" appears in codes of function "SXPG_COMMAND_EXECUTE".

============

IF NOT APPSERV_DESTINATION IS INITIAL.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

DESTINATION APPSERV_DESTINATION

...........

============

Does "SXPG_COMMAND_EXECUTE" need to call itself ???

Is't commanded by implement of a RFC function ???

Any help is appreciated.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
722

Hi,

I found some documentation in the same FM.

  • First, for platforms without remote shell try to get to the

  • target host by an internal rfc. If an application server

  • runs on the target host so does a gateway which then starts

  • SAPXPG by some kind of FORK mechanism rather than by remote

  • shell. (This is only tried if there is no explicit

  • rfc destination given by the optional parameter destination.)

Regards,

SCK

4 REPLIES 4
Read only

Former Member
0 Likes
722

This seems to be recursion where function being defined may be used within its own definition.

A simple example for it to explain is :

function factorial(n)

{

if (n <= 1)

return 1;

else

return n * factorial(n-1);

}

The function calls itself recursively on a smaller version of the input (n - 1) and multiplies the result of the recursive call by n, until reaching the base case, analogously to the mathematical definition of factorial.

procedure ProcessTree(node)

{

ProcessNode(node); // perform specific operation with the given node first

foreach child_node of node do ProcessTree(child_node);

}

RFC is basically a remotely called Function module which may or may not use recursion.

Hope this helps!

Cheers!

Read only

Former Member
0 Likes
723

Hi,

I found some documentation in the same FM.

  • First, for platforms without remote shell try to get to the

  • target host by an internal rfc. If an application server

  • runs on the target host so does a gateway which then starts

  • SAPXPG by some kind of FORK mechanism rather than by remote

  • shell. (This is only tried if there is no explicit

  • rfc destination given by the optional parameter destination.)

Regards,

SCK

Read only

Former Member
0 Likes
722

Sannamane,

I must say the comments you found seems to describe another issue.

In that function, two conditions are considered.

Only when rfc destination is empty, what you mentioned occured.

and Jain,

I read your reply carefully.

Though I'm not sure you're right, I believe that should be a kind of thought towards right direction.

Read only

Former Member
0 Likes
722

v_dir_input = 'cmd /c c:\winzip\wzzip.exe -stestpass g:\IV.zip g:\test.pdf'.

DATA: t_result    TYPE STANDARD TABLE OF btcxpm.


DATA: v_dir_input 

TYPE sxpgcolist-parameters.  " Input Directory

CALL 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.