cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple source directories to multiple target directories

Former Member
0 Kudos

Hi All,

I have a file to file scenario like this.....

source:

\folder1\source1.xml

\folder2\source2.xml

\folder3\source3.xml

target:

\test1\source1.xml

\test2\source2.xml

\test3\source3.xml

The files from diffarent folders should be copied corresponding target directories with same file name.

for example,

source1.xml from the source directory folder1 should be copied to target directory test1 with the file name source1.xml.

here the target path depends on source directory.

so we need to know the source path to decide the target path.

please help me to solve this..

Accepted Solutions (0)

Answers (2)

Answers (2)

justin_santhanam
Active Contributor
0 Kudos

Mahesh,

Let me confirm one thing - You are going to use only one Sender and one Receiver communication channel for this purpose correct?

Thanks!

Former Member
0 Kudos

Yes. i am using only one CC for sender & one for reciever

justin_santhanam
Active Contributor
0 Kudos

Mahesh,

Sorry forgot to ask you - Are you using mapping for this scenario or Just moving the files?

Thanks!

Former Member
0 Kudos

I am not using any mapping. Just moving the files.

justin_santhanam
Active Contributor
0 Kudos

Mahesh,

I'm sorry - If you were using mapping program it would be more an easy task to achieve it. But now I guess you have to go for different scenarios( link referred by Satish) - at least to my knowledge.

If you want to avoid mapping ,then you have to write a module on Receiver File adapter to change the directory name based on source directory name .

Thanks!

Former Member
0 Kudos

help me in writing the UDF to get the source directory in receiver communication channel.

Former Member
0 Kudos

Hi,

If you have lots of similar scenarios in your project you can opt for a Managed file transfer , i think using tools like RMFT you can manage the direct file transfer scenarios well and also reduce the pain of XI server.

refer the link below.

http://www.repliweb.com/solutions/web-user-file-transfer.php

As its obvious from the comments ...I assume that you have 1 source FTP with different folders to pick files from and files are getting transfered to single FTP but different folders.

if you deceid to write a module then .. refer this link which gives a good insight to module development .

/people/rinku.gangwani/blog/2008/07/16/customized-adapter-module

Again if you want to write a UDF you may need to have a mapping program..

Do you have same structure for all source files.?

Regards,

srinivas

Edited by: Srinivas on Mar 23, 2010 12:28 AM

justin_santhanam
Active Contributor
0 Kudos

Mahesh,

You need to select the check boxes - ASMA , FILE & DIRECTORY in both Sender and Receiver channel.

In the mapping program , use the below UDF and map it to the root node of the target element.


DynamicConfiguration conf = (DynamicConfiguration) container
    .getTransformationParameters()
    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create(
    "http://sap.com/xi/XI/System/File",
    "Directory");

String src_dirname = conf.get(key);

if(src_dirname.equals("FOLDER1"))
{
conf.put(key,"TEST1");
}

else if(src_dirname.equals("FOLDER2"))
{
conf.put(key,"TEST2");
}

else
{
conf.put(key,"TEST3");
}

return "";

Hope it helps!

~raj.

Former Member
0 Kudos

Hi Mahesh,

The best thing would be create one communication channel and give all the source directories. Check the blog given in this link:

In mapping write a udf to get the source directory name and then based upon the source directory name assign the target directory name to Directory. Use this udf for this:

https://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot (step1)

Then use this target directory in your receiver communication channel.

Regards,

---Satish