2013 May 30 8:20 AM
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 “”
Results:
Can't exec external program (No such file or directory)
WaitForSingleObject failedwith %d (No such device or address)
Test 2: Rename with out “”
\\xyz.app.abc\interface_asc\Old_File1.txt old_new1.txt
Results:
Can't exec external program (No such file or directory)
WaitForSingleObject failedwith %d (No such device or address)
Test 3: For Deletion with “”
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 “”
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:\
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
2013 May 30 11:07 AM
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
2014 Apr 24 4:44 PM
Did you solve the isse?I have the same issue.
If so pass the solution