Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
stefan_grube
Active Contributor
18,315

Recently I worked on a scenario with two Idocs that are used as asynchronous request and response messages for ERP and a synchronous webservice.

For this scenario, I used SOAP adapter with async-sync brigde with help of RequestResponseBean and ResponseOnewayBean.

I wanted to populate fields in the response Idoc from the request Idoc. Here I had the challenge that the required values were only available in the Idocs, but not part of the request and response message of the web service, so I could not use the option with GetPayloadValueBean and PutPayloadValueBean, as it is described in this blog of beena.thekdi:

Insert value from Request message to Response message using GetPayloadValueBean and PutPayloadValueB...

I wanted to use the dynamical header fields of the PI message to store the vales. Unfortunately, the SOAP adapter removes dynamic header field from request message, so the response message would not be able to access them. So I needed to find a way to keep the values.

I found the solution with the DynamicConfigurationBean that allows copying values form dynamical header fields to the module context and back. All adapter modules within the same module chain of the communication channel can access the parameter values in the module context.

I have already described this feature in this blog:

stefan.grube/blog/2009/06/19/unknown-use-case-of-dynamicconfigurationbean-store-file-name-to-jms-header-without-mapping

Now the module chain of my SOAP adapter receiver channel looks like this:

ModuleTypeModule Key
AF_Modules/DynamicConfigurationBeanLocal Enterprise BeanDC1
AF_Modules/RequestResponseBeanLocal Enterprise BeanRRB
sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBeanLocal Enterprise BeanSOAP
AF_Modules/DynamicConfigurationBeanLocal Enterprise BeanDC2
AF_Modules/ResponseOnewayBeanLocal Enterprise BeanROB

I will not go into the configuration for RequestResponseBean and ResponseOnewayBean, as this is described in other blogs.

The module parameters for the DynamicConfigurationBean are following. In my scenario, I used the dynamic value "Value" with namespace "strDocNum".

Those values might not be the best choices, however it works anyway.

Module KeyParameter NameParameter Value
DC1key.1write strDocNum Value
DC1value.1module.strDocNum
DC2key.1read strDocNum Value
DC2value.1module.strDocNum

For the graphical mapping tool, it is necessary to create user-defined functions to store the values in the dynamical header fields and read them from there. Here are the functions that are used in my scenario:

PutDocNum is used in the request mapping

PutDocNum

public String PutDocNum(String docnum, String username, Container container) throws StreamTransformationException{

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

DynamicConfigurationKey keySource1 = DynamicConfigurationKey.create("strDocNum","Value");

if (conf != null) {

  conf.put(keySource1, docnum);

}

return username;

GetDocNum is used in the response mapping

Note: as the value DocNum was not part of the target message, the UDF was tied to another target field called username.

GetDocNum

public String GetDocNum(Container container) throws StreamTransformationException{

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

if (conf != null) {

    DynamicConfigurationKey keySource1 = DynamicConfigurationKey.create("strDocNum","Value");

    return conf.get(keySource1);

} else

    return "";

Here is the link to the online help, the parameter value module.nn is still not mentioned:

Adding DynamicConfigurationBean in the Module Processor

30 Comments
Labels in this area