cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file name ?

Former Member
0 Kudos

Hi,

I am following this blog to name the target file/directory dynamically at the runtime :

/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi

But I am getting this error in the CC monitoring :

Could not process due to error: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: Unknown message header category 'interface_name ' for variable 'var1'.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Threads indeed helped.Thanks...

prasanthi_chavala
Active Contributor
0 Kudos

Hi Priya,

You can do it in two ways:

1) If your filename is coming in your payload then u can directly use variable substitution in ur rcv communication channel to get the dynamic file name at the target side.

Refer this for variable substitution: http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

2) If not then you have to write UDF which will give the filename and finally u need to map to the required target element. And need to use variable substitution in rcv channel to get the file name dynamically.

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

Thanks,

Prasanthi.

Former Member
0 Kudos

Hi,

You write the code in User define function map that UDF to the target element.

Thnx

Chirag

aashish_sinha
Active Contributor
0 Kudos

Hi,

Try following this weblog for dynamic file name.

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

Dynamic filename come under the Dynamic configuration in moni, for your messages.

This is the code used inside.

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

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

String ourSourceFileName = conf.get(key);

return ourSourceFileName;

That is why Dynamic configuration is coming in output.. It is a class to generate dynamic configuration file at runtime provided by SAP XI.

Hope this will help you.

regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

Aashish,

Can you please suggest where/hoe to write this code ?

aashish_sinha
Active Contributor
0 Kudos

Hi,

You need to create a user defined function

which will return the filename and map it to one of our XML tags. and do the configuration as suggested in that blog.

Regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

Actually, i have implemented my mail to file scenario without using any design objects(IR objects) as the source and target data format is txt ony, hence I have not used any message mapping. How can i make my target filename dynamic in such a scenario. FYI, in the sorce mail attachement(txt format) the filename is appearing once, can i make use of that ?

Please help.

former_member194786
Active Contributor
0 Kudos

Hi Priya,

Just as Chirag has suggested, follow the blogs, specially the one by michael. I had used that only nd its quite useful.

Just writing the UDF will be much more simpler and easier. You just need to copy the UDF and change the attribute name with the one that you need to work upon, file/ directory name in ur case.

Thanks and Regards,

Sanjeev.

Former Member
0 Kudos

Hi Priya,

U have seen the variable substitution weblog.

Refer the weblog for dynamic file

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

/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping

U need to write the UDF in mapping for the same and also use the adapter specific message attribute

in the file communication channel.

Thnx

Chirag