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
265

Hi All,

I tried the following code for Windows NT to move a file from one directory to another but its not working.Can you please suggest what is going wrong

am using operating system command 'MOVE' while creating external command

ws_file_path = 'D:\usr\sap\UKR\DVEBMGS00\work\ENQLOG00.DAT'.

p_tg_dir = 'D:\usr\sap\UKR\DVEBMGS00\data'.

  • Forming the command

concatenate ws_file_path p_tg_dir into ws_comm_winnt

separated by space.

  • Call function to execute 'ZMV' command defined in SM69 CALL FUNCTION

call function 'SXPG_COMMAND_EXECUTE'

exporting

commandname = 'ZMV'

additional_parameters = ws_comm_winnt

operatingsystem = sy-opsys

stdout = 'X'

stderr = 'X'

terminationwait = 'X'

importing

status = ws_zstat

exitcode = ws_zexit

tables

exec_protocol = t_move

The funny thing is, if i debug the program, the files are moving correctly... Without debug if i execute the program it's not working....

3 REPLIES 3

FredericGirod
Active Contributor
0 Kudos
68

Do you have check SM21 ?

Frédéric

Former Member
0 Kudos
68

Hi Sunil,

We are facing exactly the same problem at the moment. However, in our case the move works partially, that is, if a list of files needs to be moved from one (shared Windows) directory to another, some of the files are moved, and some remain where they are. Upon debugging however, all files are moved correctly.

Have you found any solution to the problem?

Thanks,

Joë

0 Kudos
68

Have you checked return table EXEC_PROTOCOL? It usually provides good e.g. unix/nt line-command feedback.