cancel
Showing results for 
Search instead for 
Did you mean: 

File to File

Former Member
0 Kudos

Hi,

Currently I am working on a File to File scenario, where I just need to pick a file from source directory and drop into Target directory. There is no mapping requiered here. Everything is working fine with one source and one target directories;

But I have two target directories; Based on the file name, I need to drop a file into respective folders.

Lets say, I have two files like Receiver1_fileInfo.txt and Receiver2_FileInfo.txt, Here I need to drop "Receiver1_fileInfo.txt" file into Receiver1 directory and "Receiver2_fileInfo.txt" file into Receiver2 directory.

Receiver1 and Receiver2 are key values here; Is that possible without any custom adapter module development?

-Esha

Accepted Solutions (0)

Answers (9)

Answers (9)

udo_martens
Active Contributor
0 Kudos

Hi Esha,

from my point of view it is the most easy and clearest way just to create two scenarios with differnet channels (and interfaces) but same Business Systems.

Regards,

Udo

Former Member
0 Kudos

check this also for refernce

Former Member
0 Kudos

Hi Esha,

Fisrt things first. why do you need PI for the particular development? It is absolutely unfair usage of a middleware for just transferring a file from one location to another (no change in structure, format, file content or protocol (soap to file etc))

Please use any Unix scripts for these sort of activities. the effort will be minimal. Use PI only if the data or structure needs to be changed or if the format needs change (File to SOAP etc).

Using PI Just for doing simple FTP or file transfers would be absolutely inappropriate usage of PI as a middleware.

Regards,

Souvik

Former Member
0 Kudos

Hi,

Try using the DynamicConfig bean in either the sender or receiver communication channel to populate the directory parameter for File adapter Adapter specific attributes.

You can use the Dynamicconfig bean in a two step process, first write the sender filename to any of the available XI message header parameters. Then again use the bean to write this into the directory parameter.

Use ASMA in the receiver file adapter.

This way, use can avoid using a message mapping.

Regards,

Shiladitya

Former Member
0 Kudos

Hi,

In addition to the above suggestions u can also go for "OS commands after message processing"

Drop files in one of the PI directories(using NFS transport protocol) and then execute a os commands...which will chk that if the file is havig name "Receiver1.txt" then drop it to Receiver1 directory or if file is having name "Receiver2.txt" then drop it to the other directory(Receiver2).

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

Thanks

Amit

Former Member
0 Kudos

Hi Esha,

Follow the proceedure said by Mark, this will attain to fulfil the requirement.

Ref: /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

Thanks,

Former Member
0 Kudos

Hi Esha,

In this case make the following changes in your Receiver Communication Channel

Goto Advanced tab,under Adapter-Specific Message Attributes Click on Use Adapter-Specific Message Attributes check box and also check File Name and Directory checkboxes

Now test the interface ,this would surely help you

Thanks

Karthik

Former Member
0 Kudos

Hi Esha,

If you don't want to use Custom module and want to use only one Business system to place two files in two different directories depending on the file name , then you need to use one sample one to one mapping with a simple UDF.

Inside UDF determine the target directory based on file name and set the target directory in Dynamic configuration.

In adapter you have to check ASMA for Directory.

Thanks,

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Lets say, I have two files like Receiver1_fileInfo.txt and Receiver2_FileInfo.txt, Here I need to drop "Receiver1_fileInfo.txt" file into Receiver1 directory and "Receiver2_fileInfo.txt" file into Receiver2 directory.

You can use context objects for this. Select filename as your context object in receiver determination and use xPath for evaluating the receivers (approximately equals condition). Make sure you have ticked ASMA in file sender and have created two receiver communication channels for the 2 different directories.

Hope this helps,

Mark

Edited by: Mark Dihiansan on Mar 23, 2011 6:52 AM