cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with file name creation through Dynamic File Configuration

Former Member
0 Kudos

Hi all,

I am creating a multiple IDOC to multiple file scenario.

No.of IDOCs will be dynamic and each IDOC will generate a single File, just to explain my scenario I would like to assume I am getting 2 IDocs from ECC at a time (through IDOC packaging).

Each IDOC will have a different RUNIDs based on which I need to create output filename. Assume the RUNIDs as 83 and 84 for the two IDOCS.

Desired Output Filename are : Two files : 83.txt and 84.txt.

Input: IDOC 1 :>> RUNID:83>> ; Output: 83.txt

Input: IDOC 2 :>> RUNID:84>> ; Output: 84.txt

I am using Dynamic File Configuration for creating the filename by below UDF: but my output is 84.txt and 84.txt.

In Message Mapping when I am checking the "display queue" on RUNID field it is showing 83 and 84 but final output after UDF is not the same.

When I am checking the soap header for each output file both are having filename as 84.txt.

Please suggest what changes need to be done here to get the desired output filename.

-


UDF:

-


public void OutputFileName(String[] filename, ResultList result, Container container) throws StreamTransformationException{

DynamicConfiguration conf1 = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

for(int i=0;i<filename.length;i++)

{

conf1.put(key, filename<i>);

}

for(int i=0;i<filename.length;i++)

{

result.addValue(filename<i>);

}

}

-


Note: Execution Type is : All values of the Queue

Signature of the input and output message is : 0.. unbound

Context of the RUNID is Root node of IDOC.

Please suggest.

Accepted Solutions (0)

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

You can try using variable substitution instead since your scenario is multi mapping using dynamic configuration. I think it will only retain one value and apply it to the rest. You can refer to this thread for more information:

especially the dynamic file name part 1 and part 2.

PS: It also requires that the filename is part of the payload.

Hope this helps,

Mark

Edited by: Mark Dihiansan on Nov 2, 2011 6:33 AM