cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic filename in receiver AS2 adapter in B2B Add-on

saurabhkumbhare
Active Participant
0 Kudos

Hello Experts,

Can you please let me know how we can put dynamic filename in the receiver AS2 adapter for B2B Addon on SAP 7.4.

Thanks

Saurabh

Accepted Solutions (1)

Accepted Solutions (1)

Ryan-Crosby
Active Contributor

Hi Saurabh,

You can use this option in the channel configuration:

If you set the value in your scenario for property AS2Filename in namespace http://sap.com/xi/XI/AS2/AS2 then you will get the dynamic filename on the receiver side. 




Regards,

Ryan Crosby

saurabhkumbhare
Active Participant
0 Kudos

Hi Ryan / Experts,

Let me explain you in more detail.

In the receiver AS2 Communication channel, if I keep the Filename field as blank as shown below, then in the Mendelson inbox folder, a file is generated with the name "ASJAVA_DX5" which is my business component name.

If I fill the filname field for example with "CONTRL", then in the Mendelson inbox folder, a file is generated with the name "CONTRL".

This is my requirement because, suppose i trigger this interface "first time", a file with static name (ASJAVA_DX5/CONTRL ) would be generated in the inbox folder. If I trigger this interface "second time", since the file already exists with same name, it is not overwritten and I cannot check the output of 2nd trigger . Contents are not overwritten.

To solve this problem + as a general requirement, I wish to have this name to be dynamic, atleast with date+timestamp.

Can you please help.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Saurabh,

You can insert a dynamic file name using the Dynamic Configuration during the mapping execution.  A simple local UDF at the message level of your mapping should suffice:


// Get date and time stamp

SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");

String timeStamp = sdf.format(new Date());

// Get Dynamic Configuration data

DynamicConfiguration conf = (DynamicConfiguration)

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

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/AS2/AS2", "AS2Filename");

// Insert file name into payload

String filename = "CONTRL" + timeStamp;

conf.put(key, filename);

This will take some pre-defined value of "CONTRL" and append the date/time stamp at the end and insert that into the dynamic configuration parameter I mentioned in my first post.  If you have selected that other checkbox in your receiver channel then you should see the output from the code above as the AS2 file name.

Regards,

Ryan Crosby

Answers (1)

Answers (1)

saurabhkumbhare
Active Participant
0 Kudos

Hi Ryan,

Thanks a lot. It worked for me.

Regards

Saurabh

Former Member
0 Kudos

Surabh,

   I'm trying to setup file name using dynamic configuration in PI for B2B AS2 adapter not able to get configuration in receiver CC module tab. Can you please advise processing sequence and module configuration setup parameters information for AS2Filename specified in function.

Thanks in advance.