Insert value from Request message to Response message using GetPayloadValueBean and PutPayloadValueBean
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:
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:
The response mapping:
This is the response:
<?xml version=”1.0″ encoding=”UTF-8″?>