on 06-22-2016 7:29 AM
Hi HCI Experts,
I'm trying to build a scenario in HCI that would insert a value from a request message to a response message. In PI, this can be achieved using GetPayloadValueBean and PutPayloadValueBean. I'm looking into Content Modifier, Externalized Parameters or Variable which are all standard message transformers/objects in HCI. However, I'm getting no luck so far when trying to deploy the iFlow.
So far I've tried using the Write Variables. Here's my iFlow:
It's not working. It's either the Variable is not working / getting saved or I messed up with the Content Modifier. How do you fill up the message in the Body tab of the Content Modifier? The example in the guide is too simple. What if we need to assign the Variable's value in an existing field of a message payload such as my case?
What I did so far is copy pasted the whole message payload (this is the actual response message of the 1st Request-Reply from COD) and assigned the placeholder of the variable in one of the fields.
Has anyone ever done this scenario with success?
Again, appreciate any inputs.
Thanks in advance.
Mark
Hello Mark,
Instead of Write variable you can use Content Modifier and save the value in Property like below.
In the second Content modifier call the value by adding ${property.Prop_SenderTechnicalID}.
Reason for using Property is ,property will be retained after External Call[ RequestReply ], where as value stored in Header will get erased.
Regards,
Sriprasad Shivaram Bhat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sriprasad,
Mark,
Regards
Bhavesh
Hi Sriprasad,
Thanks for the feedback! I've tried your recommendation unfortunately, it's still not working. There's no error in the message monitoring nor in the logs. The iFlow is deployed successfullly and message is COMPLETED. However, I didn't get the expected result of the web service call to ERP_WS. Something must have gone wrong. I'm still unsure about the Body in the Content Modifier. Did I do it correctly?
Hello Mark,
This is what I meant. Unfortunately no idea why it doesnt seem to work on your end.
Getting the trace is definitely what will help get more context to why this is failing!
One question - How are you quantifying that this payload is not getting replaced if you do not have trace enabled?
Regards
Bhavesh
Hi Bhavesh,
Right. Will update you know once I get this trace sorted out.
That's my assumption because the end result of the service call to ECC is a table update. When I use a constant value in the mapping, the table gets updated successfully. But when I replace it with the variable/content modifier, there's no update, even if the iFlow/message monitoring says it's successful and no error.
Thank you.
Hello Mark,
Mapping step wont replace the headers and Properties directly in runtime.I mean ${header.H1} willnot be replaced with value of H1 directly,you need to write CustomFunction( UDF in SAP PI terminology) like below and call those in Message Mapping.
If you are using WriteVariable select the type as Property and set the value for that,later call it in mapping using below script.
If you are using Content Modifier,set the Property and later call it using below script.
To Retrieve the Header Value in Message Mapping:
import com.sap.it.api.mapping.*
def String getHeader1(String header,MappingContext context)
{
String HeaderValue = context.getHeader(H_headerName);
HeaderValue= HeaderValue.toString();
return HeaderValue;
}
To Retrieve the Property Value in Message Mapping:
import com.sap.it.api.mapping.*
def String getProperty(String propertyName,MappingContext context)
{
String PropertyValue= context.getProperty(Prop_propertyName);
PropertyValue= PropertyValue.toString();
return PropertyValue;
}
Regards,
Sriprasad Shivaram Bhat
Hello Mark,
Find the below links.
Go to SAP HCI-PI Help Page and navigate like below
Managing Integration Content-->Developing Integration Content Using the Integration Designer-->Developing Integration Flows and Projects-->Using Custom Functions in Message Mapping
Regards,
Sriprasad S Bhat
Hello Mark,
Please pass the Property Name or Write Variable Name as input to the Custom Function in Message Mapping like below.
Message Mapping:
Where Value of H_ErrorText in constant referring to property declared in Content Modifier like below.
Content Modifier:
During Run-time value stored in above property will be passed to target field in message mapping.
In general it is something like Message (Target Field ) = ${property.H_ErrorText}.
Regards,
Sriprasad Shivaram Bhat
Hello Sriprasad,
We have a requirement to save the entire request payload for reporting purpose. We have tried using both the variable and the process property, it works in some cases and doesnt work in others. In cases where it doesnt work, junk characters are updated in the property value. For each of the cases we are saving the output of message mapping directly into the variable/property.
Any ideas why this could be happening, i cannot put in the payload in here, as its confidential HR data.
Regards,
Diptee
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.