cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file name while using java mapping

0 Kudos


Hi All,

i need help.

I am using java mapping to convert xml file in zip file.

Now i need to set output file name as SiteId_TimeStamp.zip.

Site id is comping in xml file.

How can i do this?

I tried many thing but didnt get the solution..

As their is no message mapping so I am unable to use ASMA.

Please help.

Accepted Solutions (0)

Answers (3)

Answers (3)

xavisanse
Active Participant
0 Kudos
iaki_vila
Active Contributor
0 Kudos

Hi Pooja,

You can use variable substitution;

Dynamic file name and directory in Receiver File Adapter - summary of possibilities - Process Integr...

If you want to use a java mapping, you can use then ASMA!. Check this wiki: Dynamic file name for pass-through scenario - Process Integration - SCN Wiki

You can develop an adapter module too and don't make any mapping development. You can follow the example developed by Amit Srivastava in this document , obviously your problem is different but you can use it like a starting point.

Regards.

Message was edited by: Iñaki Vila

0 Kudos

Hi Vila,

This is not working as i am using java mapping so there is no payload.

Former Member
0 Kudos

hi Pooja

Did you try the code mentioned by Hareesh?

It should work.

Regards

Osman

0 Kudos

Hi Osman,

After including the code also i am getting this error in receiver channel

Message processing failed. 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 was not supplied in the XI Message header.

What should i do?

former_member184720
Active Contributor
0 Kudos

>>>I am using java mapping to convert xml file in zip file

Why don't you use payloadzip bean?

>>>How can i do this?

Please check the below wiki..

Sample Code - Dynamic Configuration in Java and ABAP Mapping - Process Integration - SCN Wiki

0 Kudos

Hi Hareesh,

I have split this xml file into 7 different txt files and then need to zip all 7 in one that is why i am using java mapping.

Pls suggest dynamic file name in case of java mapping.

former_member184720
Active Contributor
0 Kudos

Did you check the wiki? You just need to add the code into you java mapping..

  Map mapParameters = (Map) transformationInput.getInputHeader().getAll();

   // a) Set Output File name

   mapParameters.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic",

                                                         StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");

   DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

   //Depending on your requirement edit this logic. Here, NewDynamicName + CurrentDate will be output file name.

   DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");

   conf.put(key, ("NewDynamicName_" + dateFormat.format(new Date())) + ".pdf");

0 Kudos

Hi Hareesh,

I am getting this error in receiver channl:

Message processing failed. 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 was not supplied in the XI Message header

former_member184720
Active Contributor
0 Kudos

Did you the message header and see if the dynamic attribute FIileName is being populated after the mapping??

Make sure you defined it as FileName(same case) in your java mapping..