‎2007 May 14 11:40 AM
How can I perform a unix shell script on SAP system ?
Ragards
sas
Message was edited by:
erdem sas
‎2007 May 14 11:47 AM
You can use FM SXPG_COMMAND_EXECUTE or SXPG_COMMAND_EXECUTE_LONG.
Peter
‎2007 May 14 11:47 AM
You can use FM SXPG_COMMAND_EXECUTE or SXPG_COMMAND_EXECUTE_LONG.
Peter
‎2007 May 14 11:49 AM
what I is a really a script with not only one command. E.g a file
with many commands "test.sh"
Regards
sas
‎2007 May 14 11:55 AM
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
‎2007 May 14 12:00 PM
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
‎2007 May 14 12:17 PM
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
‎2007 May 14 7:12 PM
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