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

Error “Can't exec external program (No such file or directory)” while executing ‘SXPG_COMMAND_EXECUTE’ for Renaming the file on the Windows base application server

Former Member
0 Likes
1,209

Dear Exparts,

We would like to rename a file on the windows application server, For testing purpose we have created a program ZOS_TEST, inside the program ZOS_TEST we simply call the FM ‘SXPG_COMMAND_EXECUTE’ to rename a file on the application server.

But every time we are getting the error “Can't exec external program (No such file or directory)” and “WaitForSingleObject failedwith %d (No such device or address)”

We have run the program through the ID “SAPBATCH” but still we are getting the same error.

We have also tried to execute the del command but here also we are getting the same error message.

When we call the FM ‘SXPG_COMMAND_EXECUTE’ we pass the input parameters as below:

Here “\\xyz.app.abc refers to the application server name

Test 1: Rename with  “”

  1. Commandname----à ‘Z_BCM_RENAME’(Entry exist on the table SXPGCOSTAB)SM69 the command is "rename"
  2. ADDITIONAL_PARAMETERS--à "\\xyz.app.abc\interface_asc\Old_File1.txt" "old_new1.txt"
  3. OPERATINGSYSTEM ---à'WINDOWS NT'
  4. TARGETSYSTEM------à'XYZCHSAPEU10'
  5. stdout -------------à ‘X’
  6. stderr------------à ‘X’
  7. terminationwait ---à ‘X’

Results:

Can't exec external program (No such file or directory)

WaitForSingleObject failedwith %d (No such device or address)

Test 2: Rename with out “”

  1. Commandname----à ‘Z_BCM_RENAME’(Entry exist on the table SXPGCOSTAB)the command is "rename"
  2. ADDITIONAL_PARAMETERS--à

\\xyz.app.abc\interface_asc\Old_File1.txt old_new1.txt

  1. OPERATINGSYSTEM ---à'WINDOWS NT'
  2. TARGETSYSTEM------à'XYZCHSAPEU10'
  3. stdout -------------à ‘X’
  4. stderr------------à ‘X’
  5. terminationwait ---à ‘X’

Results:

Can't exec external program (No such file or directory)

WaitForSingleObject failedwith %d (No such device or address)

Test 3: For Deletion with “”

  1. Commandname----à ‘Z_BCM_RENAME_DEL’(Entry exist on the table SXPGCOSTAB)the command is "del"
  2. ADDITIONAL_PARAMETERS--à "\\xyz.app.abc\interface_asc\Old_File1.txt"
  3. OPERATINGSYSTEM ---à'WINDOWS NT'
  4. TARGETSYSTEM------à'XYZCHSAPEU10'
  5. stdout -------------à ‘X’
  6. stderr------------à ‘X’
  7. terminationwait ---à ‘X’

Results:

Can't exec external program (No such file or directory)

WaitForSingleObject failedwith %d (No such device or address)

Test 4: For Deletion with out “”

  1. Commandname----à ‘Z_BCM_RENAME_DEL’(Entry exist on the table SXPGCOSTAB)command is "del"
  2. ADDITIONAL_PARAMETERS--à \\xyz.app.abc\interface_asc\Old_File1.txt
  3. OPERATINGSYSTEM ---à'WINDOWS NT'
  4. TARGETSYSTEM------à'XYZCHSAPEU10'
  5. stdout -------------à ‘X’
  6. stderr------------à ‘X’
  7. terminationwait ---à ‘X’

Results:

Can't exec external program (No such file or directory)

WaitForSingleObject failedwith %d (No such device or address)

Test 5: For Deletion on E:\

  1. Commandname----à ‘Z_BCM_RENAME_DEL’(Entry exist on the table SXPGCOSTAB)command is "del"
  2. ADDITIONAL_PARAMETERS--à E:\interface_WCD\Old_File1.txt
  3. OPERATINGSYSTEM ---à'WINDOWS NT'
  4. TARGETSYSTEM------à'XYZCHSAPEU10'
  5. stdout -------------à ‘X’
  6. stderr------------à ‘X’
  7. terminationwait ---à ‘X’

Results:

Can't exec external program (No such file or directory)

WaitForSingleObject failedwith %d (No such device or address)

Please help us to resolve the issue

2 REPLIES 2
Read only

Former Member
0 Likes
628

Hello Samanta,

if your objective is only the rename of a file on the application server, you have a workaround solution avoiding you to get lost into the parameters of the FM.

If you want to rename file "old.txt" into "new.txt", just write a report that opens both files, reads old.txt content in BIN mode (so you don't loose whatever content format) and write every read line into new.txt.

Then you close both files and delete the old.txt.

Source should look like this:

OPEN DATASET "old.txt" FOR INPUT IN BINARY MODE.

OPEN DATASET "new.txt" FOR OUTPUT IN BINARY MODE.

DO.

READ DATASET "old.txt" INTO workarea.       "(choose a wa of type X)

IF sy-subrc = 0.

  TRANSFER wa TO "new.txt".

ELSE.

  EXIT.

ENDIF.

ENDDO.

CLOSE DATASET "old.txt". CLOSE DATASET "new.txt".

DELETE DATASER "old.txt".

Hope you have enough space on server in order to keep both files for a short period of time.

regards,

Marcello

Read only

0 Likes
628

Did you solve the isse?I have the same issue.

If so pass the solution