Skip to Content
0
Former Member
Jul 02, 2009 at 08:53 AM

Dynamic Config for Target directory

1014 Views

Hello Experts,

My interface is from MQ (JMS) to FILE.

I have one sender and one receiver.

I have the Lockbox data placed into the single Queue for 2 countries (AU u2013 Australia and NZ u2013 Newzeland)

Point 1: My PI Interface Picks the lockbox data up from the Queue, then the respective file (dynamically by using dynamic configuration) is being created based on the condition in mapping.

Here my mapping logic:

SourceStrucutre ReceiveStrucutre

Filed1 Filed1

Filed2 Filed2

INPUT -


 FIXED VALUES u2026u2026u2026..> UDF1 u2026u2026u2026> ReceiveStrucutre ( root node)

Expected input values for INPUT: ABC and XYZ (ABC for AU and XYZ for NZ)

Expected values in FIXED VALUES: ( if ABC - create file name FILE1.TXT; if XYZ - create file name FILE2.TXT)

The below UDF is mapped to root node of Receiver Structure.

UDF1 code: ( with single Argument with name : arg)

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

conf.put(key, arg);

return "";

the above mentioned logic works fine and am able to generate the file names (FILE1.TXT & FILE2.TXT ) in the target directory ( /tmp/common ) which mentioned in the receiver file adapter.

Point 2:

My Requirement is to generate the target directory dynamically based the file name generated..

Expected Target directory:

/tmp/AU/FILE1.TXT for the file FILE1.TXT

/tmp/NZ/FILE2.TXT for the file FILE2.TXT

I know we can do this by writing another UDF2 (DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory"); for the directory and by making ASMA ticked for Directory in communication channel..

My question is how to map the two UDFs to the same root node of receiver..

Valuable inputs are much appreciated!!

Thanks,

Kumar