Skip to Content
0
May 11, 2013 at 01:42 PM

Generating Different FileNames at Target Side using ASMA(UDF)

45 Views

Hi PI Experts,

Requirement : IDOC to 3 Files

The Scenario IDOC is generating 3 files at Target Side.

I had Designed using MultiMapping(IDOC Message) to 3 Messages at Target Side.(IDOC(source) and 3 Messages types at Target Side in Mapping)

In Mapping, I am using RFC look up to Generate an Sequence Number FM and this Seq Number is passed as Input to UDF to generate Target File Name with above Seq No.

EX : Header0001.txt.

Problem : For All 3 Target File are generated with Same FileNames as mentioned below.

HeaderInstructions.txt Instead of Header001.txt

HeaderInstructions.txt instead of Item0001.txt

HeaderInstructions.txt

UDF : The First Message UDF

try {

String filename ="";

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

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

filename = "Header"+Code+".txt"; // Code value from RFC Look up

conf1.put(key1,filename);

return filename;

}

catch(Exception e)

{

String exception = e.toString();

return exception;

}

For the second Message the above same UDF but I am changing the FileName as

filename = "Item"+Code+".txt";

similarly for 3rd File too.

Reason for getting the Same file name for 3 files as per my analysis,

Target Messages are mapped with UDFs and first and second UDF are over written and Output as HeaderInstruction.txt is output for all Files.

Note : For Three Different Operations Mapping - I am able to generate as per my Requirement, but fails with One OP.

Please suggest me on this.

Rgds,

Kumar