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

I perform a unix shell script

Former Member
0 Likes
814

How can I perform a unix shell script on SAP system ?

Ragards

sas

Message was edited by:

erdem sas

1 ACCEPTED SOLUTION
Read only

Peter_Inotai
Active Contributor
0 Likes
773

You can use FM SXPG_COMMAND_EXECUTE or SXPG_COMMAND_EXECUTE_LONG.

Peter

6 REPLIES 6
Read only

Peter_Inotai
Active Contributor
0 Likes
774

You can use FM SXPG_COMMAND_EXECUTE or SXPG_COMMAND_EXECUTE_LONG.

Peter

Read only

0 Likes
773

what I is a really a script with not only one command. E.g a file

with many commands "test.sh"

Regards

sas

Read only

0 Likes
773

You can create commands in SM69 and testing them in SM49. If you assign a command to your script you can execute it via the mentioned FM.

Peter

Read only

0 Likes
773

Hi,

you can try something like this.

data:cmd(254) type c.

data: RESULT(255) OCCURS 100 WITH HEADER LINE. "No max length

cmd = './testscript.sh'.

    • Execute command

REFRESH RESULT.

CALL 'SYSTEM' ID 'COMMAND' FIELD CMD

ID 'TAB' FIELD RESULT-SYS.

Kostas

Read only

0 Likes
773

Peter is spot on, but just to clarify using SM69 (and expand a little), it's not really a command, just a reference.

For example to execute your script, just create through SM69 with a command of ZTEST and then the Operating system command is the location of your script on the app server. Then call 'ZTEST' from FM SXPG_COMMAND_EXECUTE.

Also, make sure the body of your script starts with something # !/bin/ksh

null

Read only

0 Likes
773

Hello.

I have stored my script on /usr/sap/ADE

named "aus.sh". Further on I have created

an external command via SM69 "ZTEST"

By the input field "Operating system command" I gave the

location of my script: /usr/sap/ADE/aus.sh

on the app server. Then I have called 'ZTEST' through

FM SXPG_COMMAND_EXECUTE.

I get the error message COMMAND_NOT_FOUND.

Can anybody say me what is wrong here ?

Regards

sas