Skip to Content
Technical Articles
Author's profile photo Sathyabhama BT

SAP CPI : Retrieve persisted messages through iFlow by consuming API(Neo)

Persist in CPI helps you to store Message permanently. Information such as message GUID, time stamp, and payload are stored at runtime for the messages at the persistence process steps.

There is no UI from SAP to monitor persisted message . You may go through this link where you can monitor persisted messages.

WHINT MessageStore Viewer for SAP CPI

The other way to fetch persisted data which I found is to consume API to call Message store details. Lets get started with the design and see the result.

1st iFlow : Persists the data

Sender Adapter – Normal HTTPS

1st Persist – Stores the triggered input data[in my case its XML data]

Mapping – Concatenates FirstName and LastName and the result will be FullName

2nd Persist – Stores Mapping output

Deploy the flow and make a note of Message ID

 

2nd iFlow : Retrieves persisted data from MessageStore

Content Modifier[MessageID] – Set Basic Auth credentials of your tenant in header and Message ID of the previous iFlow in property

Request-Reply : Call OData API- /MessageProcessingLogs(‘{MessageGuid}’)/MessageStoreEntries to fetch MessageStore details which will return response in XML format.

XML response :

   Next , I’ve used XML to JSON Converter, Groovy Script, Iterating Splitter and one more Groovy Script only to extract MessageStoreID captured in the above snip to pass on to another API call to fetch persisted data. You may design your convenient way to extract only the MessageStoreID from API call response.

Request-Reply : Call OData API /MessageStoreEntries(‘{MessageStoreEntryId}’)/$value to fetch persisted data.

Finally, I am sending fetched data to my E-mai for reference.

Output : Persist-BeforeMapping

Persist-AfterMapping

 

Likewise, you can try out other API operations and enjoy persisting the messages 🙂

 

Was it helpful?Please do let me know your thoughts.

 

!!!!!HaPpY LeArNiNg!!!!!

 

Sathya

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Rahul Yadav
      Rahul Yadav

      Very detailed explanation of Persist. It is recommended method by SAP for storing payload in SAP CPI

      Author's profile photo Nikhil Save
      Nikhil Save

      Nice blog!!!!!

      I am facing an issue after deploying the second IFlow. Error says "404 not found" when it is trying to reach API1 receiver.

      Could you please tell me from where to take "Tenant Host". Looks like something wrong i am putting there

      Regards,

      Nikhil Save

      Author's profile photo Sathyabhama BT
      Sathyabhama BT
      Blog Post Author

      Thanks Nikhil for trying out this approach!!

      <Tenant Host> value is taken from the Cloud integration URL

      Please do let me know if you could execute it without any issues

      Regards,

      Sathya

      Author's profile photo Vinicius Lara
      Vinicius Lara

      Sathyabhama,

      Your explanation was helpful for me.

      I would like to say thank you.

      Vinícius

      Author's profile photo Vishwakiran Devanagundhi Krishnappa
      Vishwakiran Devanagundhi Krishnappa

      Hi Sathyabhama,

       

      I was trying to execute 2nd flow , but am getting statusCode: 401

      https://<tenanthost>/api/v1/MessageProcessingLogs(%E2%80%98IDAGBLdkAhz5OZNbGfrPnHLkel5VHg%E2%80%99)/MessageStoreEntries with statusCode: 401

       

      Could you please confirm the  http Authorization header created as per this below note:

      https://launchpad.support.sap.com/#/notes/0002561389

      Thanks & Regards
      Vishwakiran

      Author's profile photo Vijhay Devarajan
      Vijhay Devarajan

      Hi SathyaBhama

       

      Good Explanation. In the scenario, you are manually copying the MessageID and executing the second IFlow. How do you seamlessly pass on the MessageID to the second IFLow to get back the persisted data.

       

      Thank You!

      Vijhay D