on 2020 Apr 17 11:03 AM
Hi Experts,
I am working in scenario where SAP CPI is inserting the data to SFSF. If something fai,l in response CPI will send the error response back to Sender with below format. But I am not able to get the MessageId, Exchnage id , IFLOW name in main integration flow.
But in Exception sub process it is working fine.
def ExchangeID = ${exchangeId};
def MessageID = ${id};
def Timestamp = ${date:now:dd-MM-yyyy HH:mm z};
def IFlowName = ${camelId};
I am using the above expression in code to get the values.
Could you please help us how do I get the values?
regards,
Souvik
Hello Souvik,
You can put a content modifier and set property of type Expression and use all above as value.
For message id use value ${header.SAP_MessageProcessingLogID}
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.
Another option, if you want to access the Simple Expression results in Groovy script without adding a Content Modifier upfront, would be to interpret the Simple Expressions in Groovy like:
import com.sap.gateway.ip.core.customdev.util.Message
import org.apache.camel.builder.SimpleBuilder
def Message processData(Message message) {
def simple = SimpleBuilder.simple('${exchangeId}')
def ExchangeID = simple.evaluate(message.exchange, String)
//Do whatever you want to do with the exchange id
return message
}
Follow this guide from engswee.yeoh if you want to learn more about it: https://blogs.sap.com/2018/04/05/using-camels-simple-in-cpi-groovy-scripts/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Souvik
You are combining Groovy (the def stuff) and the Simple Expression Language (the ${...} stuff) in a way that doesn't work.
The easiest way to reuse your Simple expressions, is to add a Content Modifier and create four properties (type "Expression") to store the values of your expressions. Then access those properties in a Groovy script using message.getProperty('property-name-here').
Regards,
Morten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
11 | |
10 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.