cancel
Showing results for 
Search instead for 
Did you mean: 

Dyanmic configuration class

Former Member
0 Kudos

Dear friends,

Kindly explain me what the following code is doing in mapping:

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

a=a+".txt";

conf.put(key,a);

return a;

Accepted Solutions (1)

Accepted Solutions (1)

former_member200962
Active Contributor
0 Kudos

This code is reading the FileName of the input file and then appending ".txt" to it....so ifname of the input file is Renu then the output of this UDF will be Renu.txt

Regards,

Abhishek.

Former Member
0 Kudos

Hi Abishek,

My mapping for the particulat fieldis likethis :

Constant

(PO)

Current date -


> concatenate -


> this udf -


> filename

As you said this udf ouput as PO.txt. Kindly tell me why we need dynamic configuration.what exactly this function is doing in this mapping.

Kindly explain me.

former_member200962
Active Contributor
0 Kudos

1) Suppose in case I get a requirement to change the name of my output file based on some value in the input payload or input filename

OR

2) I need to read the name of the input file and then pass it to some field on target for business need

In both the above cases I will use Dynamic Configuration concept.

This will be enabled when we select Adapter Specific Message Attribute checkbox in the communication channel

Both Help and SDN have good documents and blogs on this topic....just make a search with Dynami Configuration and you will get the details.

Can you ask the person, who created the mapping, as to why is he/ she concatenating Constant(PO) and Date and then passing it to the UDF?

f we go by the logic then the output of the UDF will never be PO.txt (if you say some constant PO is passed to the UDF)

The output will be decided at runtime!

Regards,

Abhishek.

Former Member
0 Kudos

HI Abhishek,

In runtime when i check the paylaod after mapping in Techical routing step it is coming as PO20091105.txt in the Target filed - Filename.

In runtime it is not taking any file this udf simply adding only .txt.

My question is can we remove this udf if the above one is my requirement? If so how will i add .txt for it.

Former Member
0 Kudos

Hi Abhishek,

Kindly tell me how my mapping should be designed for this field.

former_member200962
Active Contributor
0 Kudos

I dont think that the UDF is doing any job (ASMA is not enabled in CC)

My question is can we remove this udf if the above one is my requirement? If so how will i add .txt for it.

Use the below mapping logic:

Constant(PO)
                              ----> Concat1(TextFunction)----->
CurrentDate(DateFunction)
                                                               ----------> Concat2(TextFunction) ----> target Field
Constant(.txt) ---------------------->

Update:

Please note that depending on the format of date you may need to use DateTransform function just after the CurrentDate function in the above mentioned logic (all the functions mentioned are standard functions available in message mapping)

Regards,

Abhishek.

Edited by: abhishek salvi on Nov 6, 2009 9:58 AM

Former Member
0 Kudos

Hi Abhishek,

Thank you for your quick response. Your logic will work. I have one quick question what is this following code will exactly do:

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

Kindly tell me abhishek

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

It will help pull the name of the input file and put in a dynamic variable --> key (any name can be given here instead of key)

DynamicConfigurationKey is actually a class name and is accessed using dynamic (runtime) constant --> DYNAMIC_CONFIGURATION

FileName is a variable name present in the Message Header

Former Member
0 Kudos

Hi abhishek,

One question

How add message id to your below logic: We need to add msg id with filename.

Constant(PO)

-


> Concat1(TextFunction)----->

CurrentDate(DateFunction)

-


> Concat2(TextFunction) -


> target Field

Constant(.txt) -


>

Answers (0)