cancel
Showing results for 
Search instead for 
Did you mean: 

OS Command in File Sender

Former Member
0 Kudos

Hi,

I would like an file to be renamed by comms channel before it picks it up for processing. After processing it should be archiving.

What os command should i be giving in the processing tab .

The original file name would be DLCHD and I would be renaming it as APCHD.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

It depends on your OS, Windows and Unix are different.

If you want to achieve, choose achieve mode.

Check the file sender adapter help page:

http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm

SAP XI Command Line Features

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

Regards

Liang

Edited by: Liang Ji on Oct 12, 2010 6:46 PM

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Krish,

If you want to archive, choose archeve mode while configuring the sender communication channel. You will also have to provide the archive folder details where you want to archive the processessed file.

As the OS command that you use in 'Execute OS command before/after message processing' tab of channel will be called only after the file is picked up. Thus, You cannot rename a file before the channel picks it.

You can do the following:

Call the following command from 'Execute OS command before message processing':

mv /home/usr/DLCHD /home/usr/APCHD (On Linux/UNIX PI Server)

The general format is : mv <relative path of source file> <relative path of target file>

ren E:\usr\src\DLCHD E:\usr\target\APCHD (On Windows PI Server)

The general format is: ren <relative path of source file> <relative path of target file>

Here, i have assumed the following:

Name of source file is DLCHD

Name of Target file is APCHD

The source file to be picked up is from the File system of the PI Server.

In the sender communication channel, specify the file name as DLCHD for polling.

I hope this helps.

Regards, Gaurav.

Former Member
0 Kudos

You cannot rename a file before the channel picks it. Because, the os command that you use in 'Execute OS command before/after message processing' tab of channel will be called only after the file is picked up.

You have to proceed as follows for your requirement-

Write a shell script that rename the file as APCHD and send a copy of it to archive folder.

Call this shell scrip in 'Execute OS command before message processing'.

In the sender communication channel, give the file name as DLCHD for polling.

The channel first picks the file DLCHD and then calls the script. The script changes this file name to APCHD and send a copy to archive folder.

The commands depends on OS you are using.Search on google or sdn for help.You can find many code snippets.