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

execute unix command in abap code

Former Member
0 Likes
2,793

Hi, I have a request to execute a script command in a remote unix server, should i use 'call function ...destination'?

Thanks.

Legend.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,637

Create a system command sm69 and then execute this command in your program using SXPG_COMMAND_EXECUTE function module. There is documentation associated with this function module.

5 REPLIES 5
Read only

Former Member
0 Likes
1,638

Create a system command sm69 and then execute this command in your program using SXPG_COMMAND_EXECUTE function module. There is documentation associated with this function module.

Read only

0 Likes
1,637

Thanks.

I'll give it a try.

Read only

0 Likes
1,637

I created the external command and ran that FM, but the sy-subrc = 6 after executing.

Can you advise what caused the failure?

I also found the statement:

call 'SYSTEM' id 'COMMAND' field cmd id 'TAB' field result-sys.

do they both work?

Thanks.

Legend.

Read only

0 Likes
1,637

Use like this :

data: begin of t_tabl occurs 0,

line(132),

end of t_tabl,

data: lc_command(100) type c.

  • Get all the file name falling under specified directory...

lc_command(3) = 'ls '.

lc_command+3(45) = p_dir. " Directory of file path

call 'SYSTEM' id 'COMMAND' field lc_command

id 'TAB' field t_tabl-sys.

  • Check any files exits in the directory.......................

if t_tabl[] is initial.

message e006 with 'No files exist in the specified directory ' p_dir.

endif.

Do not look for sy-subrc ,here sy-subrc will not work.

Thanks

Seshu

Read only

Former Member
0 Likes
1,637

You can use FM :

FTP_COMMAND

FTP_COMMAND_LIST

FTP_CONNECT

Check the below link :

Thanks

Seshu