SAP CPI Keystore Expiry – Email Notification – Simplest of All
Hope you are all doing good.
As you all know, SAP CPI does not have an inbuilt mechanism for the expiry of certificates in the Keystore. The developer will understand when the messages are failed in the Monitoring.
But stalwarts in SAP have already found a way to enable such notification in SAP CPI. But my blog is different as it does not provide you with a new discovery but the simplest approach to do it. Here I have not used any Scripts/XSL Mappings/Local integration process or anything, I have just used UDF (difference in the date) in the graphical mapping which will get you the desired outcome.
I have leveraged the core functionality of SAP CPI that is No Code and created this Process Improvement.
Kindly follow the below procedure and get email alerts for your expiring Keystore artifacts:
- First and foremost, you will need a timer to start the flow, you can select duration based on your use case. The tenant OData API will pull all the keystore details from the tenant and return an XML output. The credentials I have used is the S-User id (here I have used my for the demo but you can use a service user as well).
- The Processing Tab should have the below-mentioned configs.
- Now the simplest step is to create a Graphical Mapping. The main aim of the graphical mapping is to create a field on the receiver side which is Notif_Flag (remaining days for the certificate to expire). The ValidNotAfter field provides the expiration date of the certificate, hence firstly filtering all the past dates. Then using the date difference UDF gets the difference between the expiration date and today’s date. A simpler thing here to do is use a CreateIf function and use the expiration date which will be in the next two months or three months. Hence the KeystoreEntry and Notif_Flag tags will only be created for values less than 90 days (i.e. certificates expiring in 90 days or less)
- Now the part of creating an alert format. As I am using the message mapping I was getting the output in XML and hence I converted it to CSV with tab-separated which will look good in the email body.
- Also, I use a Content Modifier to save the body and pass the same in the Send Tag.
- For reference, I have also kept the details for the Outbound Mail Adapter. You will find separate blogs for this configuration as well.
Thanks for your time.
Hope you had a good read.
Chinmay M Laud.