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

Using of SXPG_COMMAND_EXECUTE Function Module.

Former Member
0 Likes
463

I am using the below Function Module

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

commandname = p_cmnd

operatingsystem = syst-opsys

targetsystem = w_target

stdout = 'X'

stderr = 'X'

terminationwait = 'X'

IMPORTING

status = w_status

exitcode = w_exitcode

TABLES

exec_protocol = t_protocol

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.

WRITE 😕 'SY-SUBRC = [', sy-subrc ,']'.

WRITE 😕 'STATUS = [', w_status ,']'.

WRITE 😕 'EXITCODE = [', w_exitcode ,']'.

WRITE 😕 'EXEC_PROTOCOL ='.

But By using the above function module I am getting the SY-SUBRC as equal to '1' and in the import parameters w_status getting as BLANK and T_PROTOCOL as Blank so it is raising the "Problem in executing UNIX command." in my program. Can anybody suggest how can i rectify this problem.

Thanks in Advance.

1 REPLY 1
Read only

ThomasZloch
Active Contributor
0 Likes
363

> no_permission = 1

Seems like an authorization problem. Call SU53 immediatly after the failed function call and check with your security or system administrator (authorization object S_LOG_COM).

Thomas