Monday 23 October 2017

Save the payload in the SAP HCI/HCP WEBUI using Groovy script

For the future reference, we have a script to save the payload in the iflow and that can be viewed in the Tenant WEBUI/Eclipse of SAP HCI/HCP.

In WEB UI monitoring - Logs - MPL Attachment - Click on "C4CRequestPayload" to view the payload for this example.

Groovy Script:

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("Logging#1", "Printing Payload As Attachment")
        messageLog.addAttachmentAsString("C4CRequestPayload:", body, "text/plain");
     }
    return message;
}





No comments:

Post a Comment