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: 
sumanth171
Active Participant
6,342
CPI implementations happening very fast and during hyper care, many customers interested to see the message statistics in middleware systems. In PI/PO, we have a link to download the interfaces processed excel file with success and failed count for each interface.

In CPI standard Monitoring there are filters available but the table view for all the interfaces status count is missing. CPI team has to manually verify the message count and update in the report. To resolve this mundane time consuming task, a custom iFlow can be used to generate a report and forward to right stakeholders.


The iFlow can be cloned or downloaded from git repository Link . Below fields selected from the MessageProcessingLogs Resource from CPI Odata API.

Fields: MessageGuid,LogStart,LogEnd,IntegrationFlowName,Status,IntegrationArtifact

Below script is used to set start and end times.
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import groovy.time.TimeCategory

def Message processData(Message message) {
def properties = message.getProperties();
int s_Minutes = properties.get("Minutes").toInteger();
def currentDate = new Date()
LogEnd = (currentDate.format("yyyy-MM-dd'T'HH:mm:ss"))
use( TimeCategory ) {
logStart = currentDate - s_Minutes.minutes
}
LogStart = (logStart.format("yyyy-MM-dd'T'HH:mm:ss"))
message.setProperty("logStart", LogStart);
message.setProperty("logEnd", LogEnd);
return message;
}

A mapping created for the transformation of MPL response to custom structure needed for XML to CSV conversion. Below 2 scripts used at mapping level for aggregation of messages count for each interface.

Calculation of completed messages for each interface.
def void completedCount(String[] status, String[] iflow, Output output, MappingContext context){

def count = 0;

for(int i=0;i<=iflow.length-1;i++){
count = 0;
for(j=0;j<=status.length-1;j++){
if(status[j].contains(iflow[i]) && status[j].contains("COMPLETED"))
{
count++;
}
}
output.addValue(count);
}
}

Calculation of Failed messages for each interface.
def void FAILEDCount(String[] status, String[] iflow, Output output, MappingContext context){

def count = 0;

for(int i=0;i<=iflow.length-1;i++){
count = 0;
for(j=0;j<=status.length-1;j++){
if(status[j].contains(iflow[i]) && status[j].contains("FAILED"))
{
count++;
}
}
output.addValue(count);
}
}

Configure Odata, Mail channel externalized parameters and deploy the integration flow.

The output report will be generated as below.


With the help of this iFlow, the developers / support team time will be saved for 30 - 60 minutes by avoiding the report preparation. Feel free to enhance the iFlow based on the business requirements.

 

Happy Learning!
15 Comments
S0015423014
Explorer
0 Kudos
Great post Anil.
sumanth171
Active Participant
0 Kudos
Thanks Sanjay:)
fatihpense
Active Contributor
Hello Anil,

Thanks for sharing this "Message Overview" for CPI!

Regards,
Fatih
sumanth171
Active Participant
0 Kudos
Thanks Fatih. Happy you checked this post.
SyambabuAllu
Contributor
0 Kudos
Hi Anil,

Yes,it’s need this kind of tool in Support.

Thank you for sharing!

Thank you,

Syam
sumanth171
Active Participant
0 Kudos
Thanks Syambabu.
former_member226
Employee
Employee
0 Kudos
Superb Anil. This will definitely save a lot of time of consultants who want to report all messages being processed by CPI.
sumanth171
Active Participant
0 Kudos
Thanks Surabh.
parri777
Discoverer
0 Kudos
Excellent Post..
Hi All,

Even i have the similar requirement. Could some one can help me how to generate report for Messages from DATA STORE with Overdue and WAITING status
sumanth171
Active Participant
0 Kudos
Hello Jagadish,

Thanks for appreciating. I checked for data store feature in standard OData API but seems it doesn't exists at this moment. In future if SAP release an entity, we can work on it.

Regards,

Anil
pi_satishb
Explorer
0 Kudos
Hi Anil.

Thanks for your Post on message status report!

I have follwoed your steps and designed the IFLOW but getting the below error, Could you please help here?

com.sap.gateway.core.ip.component.odata.exception.OsciException: An exception of type 'WstxUnexpectedCharException' occurred., cause: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '=' (code 61); expected a semi-colon after the reference for entity 'client_id' at [row,col {unknown-source}]: [1,1013]

 

Regards,
Satish
0 Kudos
HI Satish,

 

Just change the url to runtime url in configuration of iflow, you will get runtime url in service key.

 

Regards

Mukheed
pi_satishb
Explorer
0 Kudos

Thanks for your reply.

pi_satishb
Explorer
0 Kudos
After changing URL, issue got resolved. Thanks for your support.!.
maryame
Discoverer
0 Kudos

Hi 

i have a similar interface but when using the automated monitoring report to get"COMPLETED" flows, I'm getting mismatched values when comparing some of the report values and the actual values, this problem only occurs when the status= COMPLETED, the others are on point, any idea what may be the cause of this mismatch?

maryame_0-1709737793991.png

 

Labels in this area