cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file configuration

Former Member
0 Kudos

Hi,

I'm working on file to file scenario...where I need to take some part of Input file name (first 3 chars) and make it as a output file name. I had used the below code to get the same. But still I'm getting the whole file name. can anybody help me for the same.

Please correct me if I am wrong?

Example :

Input fileName: ABC20110328.txt

Desired Output fileName: ABC.txt

Used Code:

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

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

String a = conf.get (key);

String var1 = (a.substring(0,3));

return var1;

Note: I have checked the ASMA in sender and receiver comm channels and In receiver comm channel, I have used the %var1%

-Esha

Accepted Solutions (1)

Accepted Solutions (1)

RKothari
Contributor
0 Kudos

Hello,

Please check the below wiki:

https://wiki.sdn.sap.com/wiki/display/XI/Combining%20three%20different%20aspects%20of%20PI%20in%20on...

I guess you need to use the below code:

conf.put(FileName, var1);

return "";

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Esha,

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

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

String a = conf.get (key);

String var1 = (a.substring(0,3));

conf.put(key, var1);

return var1;

I guess this might work ...

Regards,

Rohit

Former Member
0 Kudos

Hi Esha,

Ref: /people/madanmohan.agrawal/blog/2009/05/20/combining-three-different-aspects-of-pi-asma-af-module-and-variable-substitution-in-one-shot - Combining three different aspects of PI (ASMA, AF Module and variable substitution) in one shot

Thanks,