Skip to Content
0
Former Member
May 25, 2009 at 05:59 AM

Issues using FM - SXPG_COMMAND_EXECUTE

51 Views

Hello,

I have a requirement to create a unique folder in the SAP Application server based on the Production Order number and to dump certain files into this folder.

I have no issues creating the contents of the file, but am having issues creating the folder.

Below is how I am trying to acheive what I want.

z_dir = '/sapfiles/200/machinefiles/laser/&order/'.

REPLACE '&order' WITH z_char7 INTO z_dir.

where Z_char7 is the Production Order number.

In SM69, I have created an Operating System Command with

Command Name = ZTEST

Operating System Command = mkdir

When I test this using additional parameters as /sapfiles/200/machinefiles/laser/1111 [for example], the folder is created.

In my program, I use the FM SXPG_COMMAND_EXECUTE to execute my ZTEST operating system command name with the below parameters.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

COMMANDNAME = 'ZTEST'

ADDITIONAL_PARAMETERS = z_dir

  • OPERATINGSYSTEM = SY-OPSYS

  • TARGETSYSTEM = SY-HOST

  • DESTINATION =

  • STDOUT = 'X'

  • STDERR = 'X'

  • TERMINATIONWAIT = 'X'

  • TRACE =

  • DIALOG =

  • IMPORTING

  • STATUS =

  • EXITCODE =

  • TABLES

  • EXEC_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

.

The above FM in my program doesnt work.

Could you please let me know if I am missing anything or direct me to any other suitable method.

Thank you,

Satish