Skip to Content
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

I have received mail with datastore records –

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

 

 

 

4 Comments
You must be Logged on to comment or reply to a post.