Skip to Content
Author's profile photo Former Member

Executing Unix shell script using Operating System Command in XI

One of the requirement in my scenario (IDoc – File) was that after i create the output file, i should be able to run a Unix shell script that will process the file and convert it to an alternate format.  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.sh  The figure below explains as to how we call the shell script using “Operating System Command”. image Some points to note,  1) When the operating system command is called, the file name currently being processed can be specified with the following placeholders: %f (file name) %F (absolute file name including path)  2) The OS Command for the file adapter only runs on the system in which the Adapter Framework is running.  3) The above feature works from SP9 onwards.  I hope the weblog is off some use to you folks, just as it was useful for me. 

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Can you please tell something Regarding windows environment.
      Author's profile photo Former Member
      Former Member
      Did you check the blog by michal

      The specified item was not found.

      See if it helps.

      Author's profile photo Former Member
      Former Member
      Hey,
      Nice blog. I was looking for something like this for some time now. With this idea we can have somethign as RAT(remote access tool). I have written a related blog on this:
      Having a Shell in SAP Systems
      Do let me know your thoughts on this.
      Puru
      Author's profile photo Peter Inotai
      Peter Inotai
      Hi Puru,

      Transaction code SM49/SM69 might help you, where you can execute OS level commands.
      Program RSBDCOS0 has a similar functionality.

      Best regards,
      Peter

      Author's profile photo Bernhard Josef Neuhauser
      Bernhard Josef Neuhauser
      Hi, could you please mention that at sender side, the os-command will only be run when the file is available.

      This causes massive trouble at our side, as we wanted to mount a volume, take the file and after that umount the volume. This doesnt work!

      Author's profile photo Bernhard Josef Neuhauser
      Bernhard Josef Neuhauser
      Hi, could you please mention that at sender side, the os-command will only run when the file is available.

      This caused massive trouble at our side, as we wanted to mount a volume, take the file and after that umount the volume. This doesnt work!

      Author's profile photo Former Member
      Former Member
      Hi Sameer,

      We are on XI 7.0 SP 12 under AIX. Meanwhile there is a parameter for os command before message processing and after message processing.

      We want to copy a file for separate processing by an other fileadapter, with the following command /usr/bin/cp %F  /tmp/XI/ECHtoSAP/ELEC/MECOM/testcpbefor_mec

      My experience is, that this command only works in the parameter before message processing in combination with the message protocol nfs.

      Could you please answer the following questions:
      1. Why does'nt the command work in after message processing with nfs?
      2. Which file is expected to be copied after message processing? The original file or the xml produced by the fileadapter?
      3. Do these commands work with Ftp?
      Thanks for a soon answer?
      Regards Marlies