Skip to Content
Former Member
Sep 10, 2014 at 07:02 AM

Reg. sapcontrol's OSExecute function


Hi All,

We're planning to use "OSExecute" function and try to run some commands on SAP system.

The "OSExecute" function seems to execute the command successfully, but output of the command which was executed is not displayed correctly.

Here is the OSExecute command and output:


[root@AAA ~]# pwd


[root@AAA ~]# /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function OSExecute "pwd" 0 30

09.09.2014 23:49:07



exitcode, pid, lines

2, 52098

[root@AAA ~]#


Looking at the above command output:

1) I was thinking the "lines" column should display the output of the pwd command, which is "/root". But, "/root" is not dispalyed in command output. Not sure why?

2) I couldn't find in the SAP document(/internet) what the "exitcode" 2 indicates.

3) I believe this is not related to user privileges.

The issue seems to be only with "OSExecute" function of sapcontrol.

As an additional information, we're able to execute other functions of "sapcontrol". Please find the below command output:


# /usr/sap/hostctrl/exe/sapcontrol -nr 00 -function GetProcessList

09.09.2014 23:30:57



name, description, dispstatus, textstatus, starttime, elapsedtime, pid

msg_server, MessageServer, GREEN, Running, 2014 09 08 23:41:27, 23:49:30, 28473

igswd_mt, IGS Watchdog, GREEN, Running, 2014 09 08 23:41:27, 23:49:30, 28475

disp+work, Dispatcher, GREEN, Running, Message Server connection ok, Dialog Queue time: 0.00 sec, 2014 09 08 23:41:27, 23:49:30, 28474

[root@AAA ~]#


If you've any idea on "OSExecute" function , please let me know. Greatly appreciated.