cancel
Showing results for 
Search instead for 
Did you mean: 

Storing custom information on Message Processing Logs SAP CPI

0 Kudos

I need to store some status information like "Document 100 posted successfully" or "Error: Customer 100 not found" in the message processing logs so I can extract afterwards all the statuses and forward them in one email. Is there a posibility to store something in an integration flow to get it visible to

/api/v1/MessageProcessingLogs

?

Accepted Solutions (1)

Accepted Solutions (1)

Sriprasadsbhat
Active Contributor

Hello Codrin,

Below will guide how you can do this.

1) Write a script to set the CustomHeaderProperties which can be accessible using above mentioned APIs subset.

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){

        //addCustomHeaderProperty
        messageLog.addCustomHeaderProperty("CustomSri", "SriprasadShivaramBhat")
       
     }
    return message;
}

2) Call the API with sublevel 1 and select all the fields you need.

Later in your channel remove the $select and keep only $filter ( if you have any filter ) like below then you will get the customheaderproperty set [ Currently there is some issue with combination of $select & $expand for these entities and development team working on it ]

Regards,

Sriprasad Shivaram Bhat

0 Kudos

Hello Sriprasad,


Thank you for the response. Works perfectly.


Regards,

Codrin

Answers (0)