cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic File Name usign adapter specific message attribute

NishantChavan
Participant
0 Kudos

Experts,

I have following scenario.

outbound idoc from SAP EWM  and creating flat file for third party. The file name should be "<WareHouseNumber_Timestamp>_WO.<EXT> the ext is also based on the process code which is coming from EWM idoc.

I have done following things so far.

Connections are established. created mapping and in that created attribute in target structure for FileName and assinged filename to it.

Here is the config on communication channel

When i ran the scenario I got below error, please help. I have gone through all the possible blogs on this topic so kindly do not paste me the links.

MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header

Thanks,

Nishant

Accepted Solutions (1)

Accepted Solutions (1)

Harish
Active Contributor
0 Kudos

Hi Nishant,

from the error it seems your attribute FileName is not set from the message mapping. Please check the XI Message header if you have the FileName attribute.

Regards,

Harish

NishantChavan
Participant
0 Kudos

Hi Harish,

I have FileName attribute in the message mapping, attaching the screen shot

Harish
Active Contributor
0 Kudos

Hi Nishant,

In the screenshot you i can see that you are populating the file name into variable, but where are you setting the dynamic configuration?

Can you please also past the screenshot of XI message header from monitoring?

Regards,

Harish

Former Member
0 Kudos

Hi,

Use the below UDF in the message mapping and map the output of udf to the target root node.

// Use this Dynamic Configuration, FileName parameter is dynamically set to receiver file adapter

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

       // Call the FileName parameter of Receiver File Adapter

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

 

          String MyFileName ="Test"; // set your file name here

          // Set the FileName dynamically to Receiver File adapter

conf.put(key, MyFileName);

return MyFileName;

Regards,

Veerendra.

NishantChavan
Participant
0 Kudos

Hi Virendra,

I am not a java expert, just wanted to understand why i need to use UDF if i am able to create the filename with simple mapping.

Thanks,

Nishant

NishantChavan
Participant
0 Kudos

This is resolved, Thanks to Virendra and Harish. The function was already available in the common libraray. I had to use that and it worked.

Former Member
0 Kudos

Hi Nishant,

For generating the file with dynamic file name you have two options.

1. UDF in message mapping

2. variable substitution.

If you don't want to write the udf, use the variable substitution method (send the file name in any of the field in that target structure and access the filed in the receiver communication channel).

The UDF which i have given is very small and you don't need java expertise on it.

Regards,

Veerendra

Answers (0)