cancel
Showing results for 
Search instead for 
Did you mean: 

OS commands on FTP adapter

Former Member
0 Kudos

Hello All,

Is it possible to execute OS level commands on FTP adapter to execute Unix script?

If No,please let me know the reason

Thanks

Regards,

Moorthy

Accepted Solutions (1)

Accepted Solutions (1)

former_member472138
Active Contributor
0 Kudos

Yes. Have look at this Michal's blog

Pothana.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I guess u r looking for this:

http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature

Thanks

Amit

Former Member
0 Kudos

Yes, is possible.

In FCC there are 2possible options, before processing and after processing.

Write your shell execution command (like sh /xxx/pippo.sh). You can pass also some parameters to the script.

In case of parameters, Script, can be like this (in unix):

#!/usr/bin/ksh

if [ "$#" = "0" ]; then

echo "You don't have any arguments! "; exit

fi

echo $#

Former Member
0 Kudos

Hello All,

But In my case the OS command is working well when the message protocol is NFS.

When it comes to FTP its not working.

So my question is OS command works on FTP or not?

Reference:

Regards,

Moorthy

sunilchandra007
Active Contributor
0 Kudos
 So my question is OS command works on FTP or not?

No. It works only with NFS.

Regards,

Sunil Chandra

aashish_sinha
Active Contributor
0 Kudos

Hi Dasika,

As i told you before also,It works on FTP. Make sure that your Shell script is available in FTP machine.

@sunil - Please provide details how it is not possible.

Regards

Aashish Sinha

Former Member
0 Kudos

Hello Aashish & Sunil,

In processing tab we can write either OS command or Shell script.

Is FTP adapter capable of handling both OS command and Shell script or only Shell script?

Thanks,

Regards,

Moorthy

sunilchandra007
Active Contributor
0 Kudos

>

> Hi Dasika,

>

> As i told you before also,It works on FTP. Make sure that your Shell script is available in FTP machine.

>

> @sunil - Please provide details how it is not possible.

>

> Regards

> Aashish Sinha

Please refer to sap note 841704.

Note that for the File Adapter transport protocol "FTP", the operating system command is NOT executed on the FTP server, but on the server hosting the Adapter Engine.

Regards,

Sunil Chandra

Former Member
0 Kudos

Hello Sunil Chandra,

Thanks for the note. I have gone through that and according to the note OS commands does not work on FTP adapter.

In that case, Can I go for Unix shell script on FTP adapter as suggested in the blog:http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature

Thanks,

Regards,

Moorthy

sunilchandra007
Active Contributor
0 Kudos

>

> Hello Sunil Chandra,

>

> Thanks for the note. I have gone through that and according to the note OS commands does not work on FTP adapter.

> In that case, Can I go for Unix shell script on FTP adapter as suggested in the blog:http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature

>

> Thanks,

>

> Regards,

> Moorthy

Just to correct you, the note simply says the OS command is NOT executed on the FTP server. Many a times we use term FTP adapter for File adapter. Actually there is nothing exactly like FTP adapter, its file adapter with FTP protocol

Using OS command with NFS protocol, you can run script located at XI filesystem to handle files available at XI filesystem directly. Although you have option to use OS command for FTP protocol to run a script located at XI filesystem but it doesn't give you direct control over files available at FTP server. You first need to use ftp command in your script to create explicit connection to FTP server and then you write your logic to process the file.

So in both the cases, the script(.bat for windows or .sh for unix) should be available at XI filesystem then only it can be called by the OS command.

Regards,

Sunil Chandra

Former Member
0 Kudos

Hello Sunil Chandra,

Thanks a lot for long explanation:)

Still I am finding that OS commands works on FTP adapter in PI 7.1

As per SAP documentation - You can define operating system commands that are to be executed by the file/FTP adapter before and after message processing.The adapter writes the output (STDOUT and STDERR) for the operating system command in the system trace.Message processing is independent of any errors that occur during the execution of a configured operating system command.

Please refer this link: http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/556cb799c93677e10000000a114a6b/frameset.htm

Can you please clear me on this..

Thanks,

Regards,

Moorthy

sunilchandra007
Active Contributor
0 Kudos

[help.sap|http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/556cb799c93677e10000000a114a6b/frameset.htm] says:

You can define operating system commands that are to be executed by the file/FTP adapter before and after message processing

[sapnote 841704 |https://service.sap.com/sap/support/notes/841704]says:

For the File Adapter transport protocol "FTP", the OS command is NOT executed on the FTP server, but on the server hosting the Adapter Engine.

I guess you are clear with the difference between File/FTP adapter and FTP server. Both the above statments about File/FTP adapter are true.

The first one is generic about File/FTP adapter that include both NFS and FTP protocol.

The second one is more specific to FTP protocol and talks about limitation of using OS command/script with FTP server. So the workaround is to create explicit connection with script when you work with FTP server as I explained earlier.

I hope it is clear now.

Regards,

Sunil Chandra

aashish_sinha
Active Contributor
0 Kudos

Hi Dasika & Sunil,

I hope you guys understand unix system, so i hope you are aware of what is the difference between Command and a Shell script.

Dasika, As sunil provided the note for the same that command doen't work in File/FTP Adapter, i din't checked this but i will come back on this. As per my understanding and working on numerous scenarios of this kind, i can say that FTP Adapter is capable of running Operating system shell scripts on condition that shell script is there in the FTP location. I am using this since SAP BC, SAP XI 3.0 till 7.1. So i am quite sure about it.

Write one shell script and give that shell script there in Run OS Command After/Before Processing. It will work. For NFS, you can give commands directly as well as Shell script.

Regards

Aashish Sinha

Former Member
0 Kudos

Hi,

I think Ashish is correct.

We can execute the OS commands in FTP adapter provided the OS scripts are available in FTP server using a workaround. The same is explained in the link below with screenshots:

http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature

I hope this will clear the confusion around this topic.

aashish_sinha
Active Contributor
0 Kudos

HI,

Yes it is possible to execute OS Command of File/FTP adapter.. same manner you use for normal File adapter.

Regards

Aashish Sinha