Skip to Content

There is very frequent requirement for the scenario like

1. Asynchronous interface like Idoc/ File will call the synchronous interface like RFC/web service

2. Merge some of the values from Idoc/ FIle request message with response message and send this message to create another file

It was impossible to achieve above scenario without BPM earlier. Then comes Async-sync bridge using RequestResponse and ResponseOneway beans to achieve async-sync scenario.

However still it was not possible to merge the values from request message with response message without BPM as there is no provision in PI to store the values of any field within PI.

That’s not the case now:

One can use GetPayloadValueBean and PutPayloadValueBean to achieve this.

I will not focus on async-sync bridge using RequestResponse and ResponseOneway beans as this is already well described on scn.

To continue with above scenario, we will take an example where

1. Asynchronous Request message sends SAP username and Reference username

2. Fetch SAP Id using SAP username using synchronous RFC call

3. Merge SAP Id and Reference Username and send it in response file

We can achieve this as follows:

1. Create File to RFC synchronous scenario with

     Request message having 2 fields SAP username, Reference Username

     Response message having 2 fields SAP Id and Reference Username

2. Configure async-sync bridge in sender file adapter using RequestResponse and ResponseOneway beans

3. In RFC adapter, configure GetPayloadValueBean, RemovePayloadValueBean and PutPayloadValueBean as follows:

Module.png

We need value of Reference username to be merged with SAP Id. However we don’t pass this field to RFC. Then how can we store it?

For this purpose, I added one field in RFC structure in PI.

a. export xsd of RFC request structure

b. Edit xsd and add field WEBREFERENCEUSER

c. Import xsd in external definition and use it as the target message in request message mapping

The Operation mapping will have same RFC interface imported from SAP. We will use external definition only in message mapping.

Now, we use GetPayloadValueBean and store the value of WEBREFERENCEUSER in module context. It is like a variable which will hold the value of field (same as container variable in BPM). In above example, it is defined as test.

Define parameter as get:/ns1:BAPI_USER_GET_DETAIL/WEBREFERENCEUSER and value of parameter as test.

The parameter xmlns is used to define the namespace ns1. The multiple namespaces can be defined separated by space.

We can define multiple parameters to store multiple values.

So we have successfully stored the value for request message.

However we don’t want to pass WEBREFERENCEUSER to RFC call as there is no such field in RFC structure. So we remove the element before calling RFC using RemovePayloadValueBean.

parameter name : remove:/ns1:BAPI_USER_GET_DETAIL/WEBREFERENCEUSER

Same module key will be used as that of GetPayloadValueBean.

Then we call the RFC so we need to put GetPayloadValueBean and RemovePayloadValueBean before adapter’s module call.

Next, we need to retrieve the value stored earlier. So now we add PutPayloadValueBean after adapter’s module:

parameter name – put:/ns1:BAPI_USER_GET_DETAIL.Response/ADDRESS/ADDR_NO

parameter value – test —-> same module context where the value of request message was stored earlier

Here as well Same module key will be used as that of GetPayloadValueBean.

We can add a new field to Response structure or use existing one.

Then response mapping will map the value as required.

Below are the message log details:

/wp-content/uploads/2013/03/auditlog_196929.png

The response mapping:

RespMapping.png

This is the response:

<?xml version=”1.0″ encoding=”UTF-8″?>

<ns1:mt_test_in xmlns:ns1=”http://abc.com/test”>

<id>0000067833</id>

<name>TestReferenceUser</name>

</ns1:mt_test_in>

Reference links:

http://help.sap.com/saphelp_nw73ehp1/helpdata/en/09/14324ca86f4fa8b0ccbd4e5aaa7139/content.htm

http://help.sap.com/saphelp_nw73ehp1/helpdata/en/d7/d0ee447cfe43d6b44fbe7845781a14/content.htm?frameset=/en/09/14324ca86f4fa8b0ccbd4e5aaa7139/frameset.htm

http://help.sap.com/saphelp_nw73ehp1/helpdata/en/03/f9286f7b284928b1c41025d4ba1cf4/content.htm?frameset=/en/09/14324ca86f4fa8b0ccbd4e5aaa7139/frameset.htm

To report this post you need to login first.

23 Comments

You must be Logged on to comment or reply to a post.

    1. Beena Thekdi Post author

      Thanks to both of you.

      As pointed by Prateek, there are many usecases. One can be this:

      The RemovePayloadValueBean can be used to remove some nodes from ouput.

      This can be used for mapping requirements like same source needs to be passed to target after removing some fields. So now this can be achieved using adapter module.

      (0) 
    1. Jayasuryaavthi Tadikonda

      Hi Praveen,

      I have used the below blog and creted a scenario(Soap to File) in 7.31 dual stack. I have configured the module in sender soap channel. Scenario is sucessfully executing but I’m not able to find the exact functionality of the module “PutPayload value bean”.

      My intention is to use this module is that it has to enrich the basic xml structure. But still I’m able to see the original payload in the Soap channel.

      Please guide me if there is any configuration chnages.

      Soap.png

      http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/12/21/putpayloadvaluebean–not-only-for-synchronous-communications

      Thanks in advance.

      Regards,

      Jaya

      (0) 
      1. Praveen Gujjeti

        Hi Jaya,

        As per your snap shot I can see that you have used GetPayloadValueBean in module configuration, but you should be using PutPayloadValueBean.

        Probably I have to correct this typo mistake in my blog. I am updating this now

        Regards,

        Praveen Gujjeti

        (0) 
          1. Praveen Gujjeti

            I remember that there is some exception for SOAP sender adapter (search forum), where in if we configure some standards/custom modules it will have no effect. May be you can configure the module in receiver file channel to see it’s effect.

            check this link for SOAP Adapter: Module Processor (SAP Library – SAP NetWeaver Exchange Infrastructure)

            â—Ź      In the sender adapter, you cannot add your own modules.

            Regards,

            Praveen Gujjeti

            (0) 
            1. Venkat Nimmagadda

              Hi Praveen Gujjeti ,

              As per our project requirement we are working on Synchronous interface (RFC<–>SOAP) .Target system might return fault exception as well .In either case we need to capture one of the source field value .When I use two put values(one for normal response other for fault response) I’m getting below error.

              Transmitting the message using connection RFC_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.NullPointerException: while trying to invoke the method org.w3c.dom.Node.appendChild(org.w3c.dom.Node) of a null object loaded from local variable ‘template_parent’

              Configuration screenshot

              doubt.JPG


              Regards

              Venkat

              (0) 
              1. Praveen Gujjeti

                Hi Venkat,

                I think the issue you are facing is pretty straight forward. Since you get only either a proper response or a fault response always, hence one of the put statement will obviously fail since it can’t point to XPATH which doesn’t exist in response.

                Regards,

                Praveen Gujjeti

                (0) 
  1. Jyotika Manghani

    Hi Beena,

    Thanks for the very informative blog. I was trying to implement something very similar to the above, but I am getting the following error in my channel:

    Message processing failed. Cause: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of GetPayloadValueBean.

    Any idea how this error can be resolved?

    Thanks,

    Jyotika.

    (0) 
    1. Stenish Peter S

      Hi Jyotika,

           Try specifying the module name as “localejbs/AF_Modules/GetPayloadValueBean”. Not simply “GetPayloadValueBean”. I got the same error.

      (0) 
  2. Mark Bernabe

    Hi Beena,

    Do these modules work for response with multiple occurences (i.e. BAPI_USER_GET_DETAIL.response/ADDRESS that is 0..unbounded) ? I have a similar scenario but my response can be more than 1. When I used the modules, the PutPayloadValueBean only worked on the 1st occurence.

    Any idea about this?

    Thank you.

    (0) 
  3. Pankaj Banoriya

    Hi,

    Can this GetPayloadValueBean and PutPayloadValueBean be used in below case.

    1. Web service at client side is in synchronous mode.
    2. There in no unique identifier between request and response

    Has any one faced any performance issue in GetPayloadValueBean and PutPayloadValueBean

    TIA,

    (0) 

Leave a Reply