Posts

Showing posts from January, 2022

groovy code good code from web site sap

 error dispaly ------------------------------- https://blogs.sap.com/2021/09/16/sap-cloud-integration-cpi-hci-writing-groovy-scripts-_-with-basic-examples/ 1. To record logs so that you can capture the payload even if the IFlow is not on trace. It is not advisable to use this very often, until and unless it is a very critical scenario. import com . sap . gateway . ip . core . customdev . util . Message ; import java . util . HashMap ; def Message processData ( Message message ) { def body = message . getBody ( java . lang . String ) as String ; def messageLog = messageLogFactory . getMessageLog ( message ) ; if ( messageLog != null ) { messageLog . setStringProperty ( "log1" , "Printing Payload As Attachment" ) messageLog . addAttachmentAsString ( "log1" , body , "text/plain" ) ; } return message ; } To record logs or capture the incoming payload, only if there is an exception. impo...