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

How to execute external command from SAP

Former Member
0 Likes
4,836

Hi gurus,

i need to execute an external command from a Sap (rel ECC.5.0) to a server UNIX (no SAP); precisely i have to write a file into a directory in unix server.

I see transaction SM49 and Sm69 but i don't know how can i use these features.

Please coul'd you help me or give me a documentation.

Thank's in advance

Maurizio Ortolani

email. maurizio.ortolani@trilog.it

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
5 REPLIES 5
Read only

Former Member
0 Likes
2,384

Hi Maurizio,

i do it in this way:

CONSTANTS: CMD_LS(50) VALUE 'ls -al /transfer/sap'.

*

DATA: BEGIN OF ITAB_LS OCCURS 0,

LINE(200),

END OF ITAB_LS.

*

CALL 'SYSTEM'

ID 'COMMAND' FIELD CMD_LS

ID 'TAB' FIELD ITAB_LS-SYS.

*

How do you write the file, via an UNIX-COMMAND than try the above call

with your command.

Another way is to write the file via OPEN DATASET ..., TRANSFER ... TO ..., CLOSE DATASET.

If you mean this i can give you an example.

Hope it helps.

Regards, Dieter

Read only

andreas_mann3
Active Contributor
Read only

Former Member
0 Likes
2,384

apart from open dataset.. transfer... close dataset.

u can also use C3GY or C3GZ tcodes.

also the function module SXPG_COMMAND_EXECUTE

Read only

Former Member
0 Likes
2,384

Hi everyone,

thank's a lot for your helpful answers.

I try to do this and when i finished i give you a feedback.

Best regards

Maurizio Ortolani

Read only

0 Likes
2,384

but u have to maintain those commands in SM69

u can execute using SM49