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 external operating system command

Former Member
0 Likes
620

Hi Friends,

I have a requirement to run a script file with extention '.PL' on the application server using ABAP.

i have sample how to run it in XI.

XI3.0 provides a very simple way of handling this using the "Operating System Command" in the File Adapter.

I post my output file in the following folder,

/usr/sap/sapout/test/

The shell script is available in the following path,

/usr/sap/bin/convert.pl

The figure below explains as to how we call the shell script using "Operating System Command".

File Acess parameters

Target Directory = /usr/sap/sapout/test/

File Name Scheme = TestOutput.txt

Processing Parameters

File Construction Mode = Add Time Stamp

File Type = Binary

Operating System Command = /usr/sap/bin/convert.pl %F

I have to do the same thing in ABAP as it has been done for XI as mentioned in the above example.

My operating system is UNIX.

If any one can give me a sample it would be really helpful to me.

Thanks in advance,

Arundhathi.

2 REPLIES 2
Read only

Former Member
0 Likes
454

Hi,

The usual way of writing this in ABAP is to use;


constants: c_command(90) value '/usr/sap/bin/convert.pl'.
call 'SYSTEM' id 'COMMAND' field comm.

regards,

Nick

Read only

Former Member
0 Likes
454

Hi Arundhati,

You can run operating system commands from ABAP.

e.g. If you want to change UNIX right for any file, you can use following code.

lv_ucomm = 'chmod a+rwx 123.txt'.

CALL 'SYSTEM' ID 'COMMAND' FIELD lv_ucomm.

whatever command you provide in Field parameter ( lv_ucomm in the above case ), ABAP run that command at operating system level.

In your case, you can provide command in lv_ucomm to run script at operating system level.

Hope it will help you.

Regards,

Naren