cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Configuration - To set the target file name with variable substitution

former_member350687
Participant
0 Kudos

Hi Experts,

Could you please help me in achieving in below requirement.

Scenario: XML to Proxy

1. Need to get the Source file name and populate it to Target File Name.

2. If using the Dynamic Configuration ---  we cant test the mapping at mapping level,

     So, we need to use input parameter, as we need to test the mapping.

Thanks,

MR

Accepted Solutions (1)

Accepted Solutions (1)

vinaymittal
Contributor
0 Kudos

its a bit unclear as you said that you have a scenario xml to proxy then why and where would you write the filename what is the use of target file name if the target is proxy and not file

former_member350687
Participant
0 Kudos

Hi All,

Small correction to above

Scenario: File to File

I need Dynamic file Configuration with variable substation to read the file name.

Please provide the code.

Thanks

MR

vinaymittal
Contributor
0 Kudos

use this code

public String getFileName(Container container){

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);

return SourceFileName;

}

Map this UDF to root element  or any dummy field in target XML.

In Receiver CC you need to set these

1. Receiver Comm Channel has ASMA , file name and "fail if ASMA missing" ticked.

2. in receiver communication channel -> File access parameters-> File name scheme -

> put any value say "*". This step is not compulsory.

use variable substituion

3. In target directory of receiver CC put the name of the directory where you need the file to be formed.

former_member350687
Participant
0 Kudos

Hi Vinay,

Thank you so much for your time,

above code worked.

vinaymittal
Contributor
0 Kudos

Hi Mahi,

Welcome, You can close the thread then by marking the correct answer.

Regards

Vinay

Answers (1)

Answers (1)

former_member186851
Active Contributor
0 Kudos

Hello Mahi,

Variable substitution is for writing the filename with content of the XML path.

your scenario is proxy, so you cant use VS.

And to get the filename you need to use UDF(Dyanmic configuration),To test in mapping just remove the UDF and test it. That is the only go.