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
541

I DONT KNOW WHY THIS IS SHOWING WITHOUT INTROS I WILL CLOSE THIS THREAD AND WROTE IT AGAIN. SORRY.

Hi all,

I've a problem executing a commad from the SM69 and from the SXPG_COMMAND_EXECUTE.

I want to do a DIR on a external system and I've created the ZTEST_DIR command with the code

RUNRMTCMD CMD('dir T:
Docs
Cdphtesp ') RMTLOCNAME(XXXX *IP) RMTUSER(XXXX) RMTPWD('XXXXXX')

and it works fine, it returns all the files and directories contained.

The problem is I need to do a dinamic dir and as the directory may change I want to put it on a parameter. Then I've modified the command to RUNRMTCMD CMD('dir ') RMTLOCNAME(XXXX *IP) RMTUSER(XXXX) RMTPWD('XXXXXX') and the directory on the additional parameters (the flag to allow it is checked) but then it returns the error String '\DOCS\CDPH' contains a character that is not valid.

I tryed to do it on a minitest program with the next code and the result on the table li_execution is exactly the same.

Can anybody help me?

Many thanks in advance.

DATA: d_commandname LIKE sxpgcolist-name,

d_exit_code LIKE extcmdexex-exitcode,

d_status LIKE extcmdexex-status,

d_aditional_parameters like SXPGCOLIST-PARAMETERS.

DATA: li_execution LIKE btcxpm OCCURS 0 WITH HEADER LINE.

d_commandname = 'ZTEST_DIR'.

d_aditional_parameters = 'dir T:
Docs
Cdphtesp'.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

commandname = d_commandname

ADDITIONAL_PARAMETERS = d_aditional_parameters

  • OPERATINGSYSTEM = SY-OPSYS

  • TARGETSYSTEM = SY-HOST

  • DESTINATION =

  • STDOUT = 'X'

  • STDERR = 'X'

terminationwait = 'X'

  • TRACE =

  • DIALOG =

IMPORTING

status = d_status

exitcode = d_exit_code

TABLES

exec_protocol = li_execution

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.

*

BREAK-POINT.

Edited by: Legoles_ dlb on Jun 10, 2009 1:29 PM

Edited by: Legoles_ dlb on Jun 10, 2009 1:30 PM

Edited by: Legoles_ dlb on Jun 10, 2009 1:40 PM

3 REPLIES 3

Former Member
0 Kudos
285

THIS IS UREADABLE

Former Member
0 Kudos
285

Hi,

When you are passing parameters to the FM the values within parameter are in upper case or get uppercase.

You need to pass variable values in lower case as you might be using the other system "Unix" which is case sensitive.

Hope it helps.

Regards,

Ibrar Munsif

0 Kudos
285

Hi, thanks for reading, I don't know why the format.

I put all the letter in lowercase but it raise the same error.

Regards,