cancel
Showing results for 
Search instead for 
Did you mean: 

Command line feature in SAP PI

Former Member
0 Kudos

Hi Experts,

What should be typed on "Command Line" of Run operating system command Before/After Message processing to execute/call a shell script located on the physical path of PI application server. Actually when I execute manually a test script by using command "./<filename>.sh" which works on Putty but what command should be typed on channel config to call the same shell script located on PI server box. For example say test2.sh is the shell script file located on path /PI_Path/system/. Now pls help on the command to be typed on comm channel.


Thanks,

Nithin.

Accepted Solutions (0)

Answers (2)

Answers (2)

vadimklimov
Active Contributor
0 Kudos

Hi Nithin,

In a similar way as you call script in Putty, you specify it in communication channel's run operating system command before/after message processing (including parameters that you pass to that script, in case of any). Just if you use any user specific aliases for directories, it is recommended to replace them with a path that is recognized by the user, in which context the OS command is executed by PI (<sid>adm), and that the mentioned user has execute permission for the called script.

Regards,

Vadim

Former Member
0 Kudos

Hi Vadim,

Thanks for ur reply, say I am writing here a simple script as stated above to create a new folder on the same directory where the script file is placed. And in above example I am using the same command as suggested by Eng which did not work, or pls guide me.

Thanks,

Nithin.

nitindeshpande
Active Contributor
0 Kudos

Hello Nithin,

I believe your PI system is running on Unix OS. If Unix, then the command line argument is different. Please look at the last part of the wiki for the command?

SAP XI File Adapter OS Command Line Feature - Process Integration - SCN Wiki

Regards,

Nitin

Former Member
0 Kudos

Hi Nitin,

Thank you for the reply. I specifically need the command that should be filled/typed on the "command line" tab under 'Run OS command before/after Message Processing' section of the comm. channel. In the above example already tried syntax like "/PI_Path/system/test2.sh" , "/PI_Path/system/test2.sh %f" , "/PI_Path/system/test2.sh %F" but nothing worked, but manually when I execute the script using user <sid>adm it works. Hence, please guide.

Thanks,

Nithin.

former_member204100
Active Participant
0 Kudos

Hi Nithin,

maybe try to enter the following entry in the communication channel under 'Run OS command before/after Message Processing' :

sh script-name-here.sh


And ensure that the script-name-here contains the correct absolute path to the file.

You might also try to run it first on OS level to see if it is working.

Best Regards,

Viktor

nitindeshpande
Active Contributor
0 Kudos

Hello Nithin,

The command must be like below -

sh<space>Script-file-name

The syntax you tried is for entering the file name and folder using Variable substitution.

Regards,

Nitin

engswee
Active Contributor
0 Kudos

Hi Nithin

It would be:-

/PI_Path/system/test2.sh

Refer the following Wiki for more detais:-

SAP XI File Adapter OS Command Line Feature - Process Integration - SCN Wiki

Regards

Eng Swee

Former Member
0 Kudos

Hi Eng,

For practice say here I am writing here a very simple script say create a new folder later to that I will write script required for client. The script file say test2.sh here contains the below code:


"#!/bin/sh

mkdir TESTFOLDER"  which creates the new folder on same path where script is placed and I am using the same syntax as suggested by you but it does not create any new folder.

Thanks,

Nithin.

vadimklimov
Active Contributor
0 Kudos

Nithin, can you log into shell of the PI system (e.g. using Putty) using OS user <sid>adm and attempt to execute the developed script? In Linux environment, scripts executed by communication channel, are executed in context of that OS user. This test is just to eliminate any user account related issues.

Regards,

Vadim

Former Member
0 Kudos

Hi Vadim,

Yes I logged in to PI Linux server with user <sid>adm on terminal PUTTY and executed a very simple script to create a folder names "TESTFOLDER" and it worked properly. Please find the below snippet:

Hence, can you please guide me to achieve the same using PI.

Thanks,

Nithin.