cancel
Showing results for 
Search instead for 
Did you mean: 

Automated notification when integration messages failed

09-25-2019 4:01 PM
Timo-Nguyen Explorer
465 views 2 comments
0 Likes
SAP Managed Tags
Subscribe

Hello all,

I try to create an integration scenario, where the user gets an email of all messages from the CPI with the status = 'failed'.

I'm using an odata adapter to get the entries of MessageProcessingLogs, but I have some issue with the query options.

Is there a way to enter the datetime of LogStart and LogEnd dynamically?

This sap help entry helped a lot, but they used fixed datetimes.

Regards,

Timo



0 Likes

Accepted Solutions (0)

Answers (2)

Answers (2)

Sriprasadsbhat
Active Contributor

Hello Timo,

You can set ExternalParameters called extMode ,extLogStart and extLogEnd.And below pseudocode might help you.

1) Declare a property LastSuccessFullRunDate which is then stored into Variable ( lets call it as var_LSDate

2) Create a query step which sets the filter part of query dynamically based on the above mentioned external parameters.

//For Auto Mode start date and date are considered from value stored in variable.
If ( extMode == Auto )
 {
 Read var_LSDate;
 set varLogStart=var_LSDate
 set varCurrentDate=<currentdatetimestamp>
// you need to format the below value like the syntax expected by query.Like &$filter=Status eq 'FAILED'
 set Filter = LogStart greaterthan varLogStart && LogEnd < varCurrentDate && status ="FAILED"
store the value of Filter in property ${property.QueryFilter}
}

//For ManualMode start date and date are considered from values entered in external parameter
if ( extMode == Manual )
 {
Read external parameters extLogStart and extLogEnd
set varLogStart=extLogStart 
set varLogEndDate=extLogEnd
// you need to format the below value like the syntax expected by query.Like &$filter=Status eq 'FAILED'
set Filter = LogStart greaterthan varLogStart && LogEnd < varCurrentDate && status="FAILED"
store the value of Filter in property ${property.QueryFilter}
}

3) Form the query and replace the $filter statement with ${property.QueryFilter}something like below .

$select=MessageGuid,ApplicationMessageId,LogEnd,LogStart,IntegrationFlowName,Status${property.QueryFilter}

Regards,

Sriprasad Shivaram Bhat

MortenWittrock
SAP Mentor
SAP Mentor

Hi Timo

Are you calling the API from an integration flow? In that case, you can create properties containing the LogStart and LogEnd values you want, and then insert them directly into the query parameters with ${property.LogStart} and ${property.LogEnd}.

Regards,

Morten