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: 
Former Member
0 Kudos

Hi guys,

Recently, I have come across a scenario where we needed to send some data from request payload to response payload for an Async-Sync bridge scenario. The approach I followed is described below:

Async Sync scenario from ECC (IDoc) to Database (JDBC) [IDoc --> JDBC (Synchronous Insert) --> IDoc]

Request from ECC IDoc to JDBC

JDBC Response to IDoc ECC

We have used Async Sync bridge module at the JDBC receiver channel - [alternative to BPM].

Requirement:

Some field values from the requesting outbound IDoc from ECC needed to be sent as a part of the response Inbound IDoc to ECC.

As the JDBC channel just gives insert_count information as response for INSERT statement, we needed to add the required values from request IDoc to response IDoc.

Solution:

To achieve this, we have implemented the following solution:

  1. The standard Async - Sync bridge modules inserted [RequestResponseBean and ResponseOnewayBean] at the receiver JDBC channel at proper sequence.

         

    2. At the request message mapping, we have added the required values [to be sent back as response] as Dynamic configuration variables to the message header via setDCKey UDF.

         

     3. The dynamic config keys which were set at the mapping runtime [step-2], were copied into Adapter module header variables [any name of our choice]. This is done via DynamicConfigurationBean module. (DCB1) And is done before the processing of RequestResponseBean module starts processing.

                    Parameter name              Parameter Value

                    Key.<num>                        write <dynamic config namespace> <dynamic config variable name>

                    Value.<num>                    module.<variable name>

             

     4. After CallSapAdapter module of the JDBC adapter, the adapter module variables set at step 3 were read into the Dyncamic Configuration Variables of the response message header. This is done via DynamicConfiurationBean (DCB2) and this bean is used before the response oneway bean module gets processed. Parameter name              Parameter Value

                         Key.<num>                        read <dynamic config namespace> <dynamic config variable name>

                         Value.<num>                    module.<variable name>

    

  5. Now we read the dynamic configuration keys of the message header set at step 4 into the response message mapping via getDCKey UDF, and send the required values from source request IDoc to the target response IDoc of the scenario.

     

Code for the UDFs are given below:

public String setDCKey(String keyName, String keyValue, String dcNamespace, Container container) throws StreamTransformationException{

                AbstractTrace trace = container.getTrace();

                trace.addInfo("Entering UDF: setDCKey");

                try{

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

                DynamicConfigurationKey key = DynamicConfigurationKey.create(dcNamespace,keyName);

                conf.put(key,keyValue );

                }catch(Exception ex)

                {

                                trace.addWarning("Exiting UDF: setDCKey with error. Error: "+ex.toString());

                                throw new StreamTransformationException("Error in UDF setDCKey. Error: "+ex.toString());

                }

                return keyValue;

}

public String getDCKey(String keyName, String dcNamespace, Container container) throws StreamTransformationException{

                AbstractTrace trace = container.getTrace();

                trace.addInfo("Entering UDF: getDCKey");

                try{

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

                DynamicConfigurationKey key = DynamicConfigurationKey.create(dcNamespace ,keyName);

                return (conf.get(key));

                }catch(Exception ex)

                {

                                trace.addWarning("Exiting UDF: getDCKey with error. Error: "+ex.toString());

                                throw new StreamTransformationException("Error in UDF getDCKey. Error: "+ex.toString());

                }

}

And the RequestResponseBean and ResponseOnewayBean module parameters for async sync bridge:

4 Comments
Labels in this area