Integration Tip # 12 | Custom header in Groovy in SAP CPI

Learn from the Certified Mentors

#CPI #groovy #script t #customheader #sap #asapcpitraining

How to create a custom header in Groovy Script. How to use it for message based search in SAP CPI ? Check out in this video. Groovyscript code used is as below:
———————————-
Code
———————————
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message)
{

//Body
def body = message.getBody(java.lang.String)

def messagelog = messageLogFactory.getMessageLog(message)
messagelog.addAttachmentAsString(“IncomingMessage”,body,”text/plain”)

messagelog.addCustomHeaderProperty(“productId”,”12345″)

return message;
}
———————————

Like, Subscribe and Share if you learned from this video. Share your feedback and Comment for any other input you need.

LinkedIn – http://www.linkedin.com/in/sap-cpi-training
It is time to Upskill in SAP CPI – https://asapcpitraining.com/top-10-reasons-to-learn-sap-cpi

Courses –
https://asapcpitraining.com/sap-cpi-course
https://asapcpitraining.com/groovy-in-sap-cpi

FAQ – https://asapcpitraining.com/faq/

Like and Share

Leave a Reply

Your email address will not be published. Required fields are marked *

× How can I help you?