Technical Articles
SAP CPI – Use SELECT Operation To Fetch All Records From Datastore
Hi All,
There might be requirement to store the records temporarily in Datastore and use it later till all entries are consumed. For this article I have created two Iflows one is to store payload using WRITE operation and another Iflow is to fetch all the records from Datastore using SELECT operation in group of two. Hope this will be usefully to other who trying to achieve the same.
IFlow 1 – WRITE operation to store data. I am using ID value from incoming payload to generate entry IDs in Datastore.
IFlow 2 – I am using loop process call to fetch all the entries from datastore in group of 2. To avoid passing last empty records to target system I am using router. This will suppress processing of empty record.
Below is the used condition for the loop
So my loop will end whenever select step will give me empty entry or max number of iterations are reached. I am fetching records in group of 2 using SELECT operation.
Below is the list of entries in my datastore – DS_Books
Iflow 2 executed succesffuly, below are the monitoring page screenshots
Please share your thoughts if there are any other ways to achieve this.
Learning :-
- With GET operation this is not possible, GET is used for fetching single record at a time.
- This looks for the entry ID to fetch the data
- If we have selected save header values during WRITE operation, this can be fetched with GET operation
- You can download datastore record to check header
- With SELECT we can group the records and can be used with loop call
!Happy Learning!
Regards,
Rashmi
Hi Rashmi,
Thank you for sharing your knowledge and Integration experience.I am following your blogs it really helped.
Could you please share more useful CPI blogs my next assessment CPI Integration project before that i want gain more knowledge CPI Integration.
Thank you .
Dastagiri.N
Thanks Dastagiri N
It feels good to know my blog is helpful to others. I will try to post my learning as and when possible.
Cheers to learning 🙂
BR,
Rashmi
Hi Rashmi,
Nice Blog.Thanks for sharing.
Thank you,
Syam
Thank you Syam!
BR,
Rashmi
Hi Rashmi,
Thanks for putting this info as a blog.
I have a question related to the router step after the select operation. What's the condition there? I am trying to achieve this but failing to do so.
Your response will help.
Best regards,
Harsh
Hello Harsh, in case you still need it or anyone else reading the blog post, the condition you need to set on the router step to end if no records is the following:
Thanks for the great work Rashmi!
Best regards,
Marlon
Hello Rashmi
If I have dynamic number of entries in the datastore and I want whole data then what should be the value of the parameter 'number of polled messages' in that case?