Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member608567
Participant
Hi All,

 

I have searched a lot about how to print the comments using Groovy script (for reference whether the flow is executing or not without storing the payload) in CPI. But I couldn't find any blogs, so I'm posting this.

 

Here using Groovy script, I am printing the comments/texts (whatever we want) in the attachment of SAP CPI environment. Just to check whether the flow has been completed or not.

<comments is the variable declared to get the value to be displayed>

Use the below script in Groovy Script

import com.sap.gateway.ip.core.customdev.util.Message;
def Message processData(Message message)
{
def comments="Hello Groovy script";
def messageLog = messageLogFactory.getMessageLog(message);
messageLog.addAttachmentAsString("ResponsePayload:", comments, "text/plain");
return message;
}



Once deployed, in Monitoring -- go to Attachment, then you will see the logs and the commesnts will be displayed like below in the log.



 

Thanks,

Naveen
1 Comment
Labels in this area