cancel
Showing results for 
Search instead for 
Did you mean: 

Variable filename and folder in receiver cc

Former Member
0 Kudos

Dear experts,

On PI, I need to create a (text-) file with a variable name and folder. The scenario is as follows:

idoc-> PI -> txt file

In my incoming Idoc I get the following data:

- directory where the txt file should be saved;

- name that the txt file should get.

How can I realise this in PI? Using variable substitution? As I never done this before, I have a hard time getting this to work...

Please help.

Thanks in advance

William

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use Dynamic Configuration:

Input will be 2 variables var1, var2.

String Name1 = var1;

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

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

conf.put(key1, Name1);

String Name2 = var2;

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

conf.put(key2, Name2);

return "";

Maping:

Var1---

-


UDF----TargetMessageNode.

Var2---

Under ID: Enable ASMA in file receiver adapter and chk FileName and Directory.

and put * under File name and / underTarget Directory(File receiver).

NOTE: U can alter this UDF according to ur req.

Thanks

Amit

Former Member
0 Kudos

Amit, you're the King! It works very well.

Thanks a lot,

William

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi JWD,

Check the below Blogs, this gives a good idea of using variable substitution along with Dymanic configuration.

/people/madanmohan.agrawal/blog/2009/05/20/combining-three-different-aspects-of-pi-asma-af-module-and-variable-substitution-in-one-shot

/people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

Thanks,