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

UNIX command in ABAP code

Former Member
0 Likes
4,117

Hi All,

I need to use unix command (MOVE) in ABAP code for transfering a file from one directory to another directory.

Can any one help with how to used unix commands in ABAP?

Thanks in advance.

Regards,

Hemendra

6 REPLIES 6
Read only

Former Member
0 Likes
2,394

The recommended approach always used to be to use transaction SM69 to define a "soft" command name to the operating system command so that it could be configured to work across Windows, Unix etc. For example:


Command name       OS         Type             OS command                                 Parameters for operating system command  

Z_FILE_MOVE        SunOS      Customer    mv                                                 ? ?    

You can then call function module SXPG_COMMAND_EXECUTE (quite well documented) to actually perform the command passing in the appropriate number of parameters.

Jonathan

Read only

Former Member
0 Likes
2,394

Check this link for your query.

[http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/8c5ceb90-0201-0010-66b1-aae00269b533]

cheers

Aveek

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,394

HI you can make use of fm ARCHIVFILE_SERVER_TO_SERVER for moving files.

For executing a unix command configure it in SM69 and execute it from program using fm

SXPG_COMMAND_EXECUTE

Read only

Former Member
0 Likes
2,394

Thanks all,

I got my answer.

Read only

0 Likes
2,394

Please post your solution, so that i will be helpful for others who search the forum.

Read only

Former Member
0 Likes
2,394

Hi Kesav,

Solution is same as you said:

Create unix command parameter in SM69 and use in FM SXPG_COMMAND_EXECUTE.