cancel
Showing results for 
Search instead for 
Did you mean: 

File to file scenario - output name files based on input

Former Member
0 Kudos

Hi experts,

i have the following scenario : file to file with no mapping

the only requirement is that if the file name from the source is lets say XXX then the output name should be abc and if the source file is YYY then it should be def

can i do that in 1 scenario?

Thanks a lot

any help would be greatly appreciated

Jamal

Accepted Solutions (1)

Accepted Solutions (1)

former_member200962
Active Contributor
0 Kudos
the only requirement is that if the file name from the source is lets say XXX then the output name should be abc and if the 
source file is YYY then it should be def

AnySourceNode --> DynamicUDF --> AnyTargetNode

DynamiUDF will be:

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

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

String SourceFileName = conf.get(key);

if (SourceFileName.equals("XXX"))
{ String TargetFileName = abc;
conf.put(key, TargetFileName);
}
if (SourceFileName.equals("YYY))
{String TargetFileName = def;
conf.put(key, TargetFileName);
}
return "";

The above code may require some (syntax) corrections!

Regards,

Abhishek.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Jamal,

> the only requirement is that if the file name from the source is lets say XXX then the output name should be abc and if the source file is YYY then it should be def

I know 2 options

1. One more option is you can write the OS command to change the target name (without mapping).

2. In the mapping by using the dynamic configuraiton you can configure this type (with mapping).

Regards

Ramesh

Former Member
0 Kudos

> the only requirement is that if the file name from the source is lets say XXX then the output name should be abc and if the source file is YYY then it should be def

This can be done in two ways at least.

1. Since you always know that what files can come into your source directory therefore you can create that many sender & receiver CCs. But this will not be a good solution if you have 'n' number of different files.

2. So, second option is to use message mapping and change the name as per your conditions by using Dynamic Configuration UDF.

> can i do that in 1 scenario?

Yes

Regards,

Sarvesh

Former Member
0 Kudos

Hi,

I dont think you can do it with out using mapping for the same...

As the filename needs to be changed from the source file name you need some UDF with Dynamic Configuraiton...parameters..

You can use the same file name for receiver if needed but i dont think you can change the same with out mapping...

HTH

Rajesh

former_member194786
Active Contributor
0 Kudos

Yes of course this can be done. Use Adapter Specific Message Attribute to access the file name and then check these conditions in a UDF. For help on ASMA use the following link:

http://help.sap.com/saphelp_nwpi711/helpdata/en/48/ce299c3a8e5430e10000000a42189b/frameset.htm

Another useful link is this:

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

Regards,

Sanjeev.

Edited by: Sanjeev Shekhar Singh on Dec 21, 2009 4:12 PM