cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CPI to pick the files from SFTP location in particular sequence

R_Swetha1
Explorer
0 Kudos
555

Hi Experts,

In SAP CPI we have a requirement to pick the files from SFTP location in particular sequence.

For example, source systems places three files daily in SFTP location

Newfile_050824.csv
Testfile_050824.csv
Changefile_050824.csv

CPI has to pick the files in below sequence 

first file :Testfile_050824.csv
second file :Changefile_050824.csv
third file  Newfile_050824.csv

 and route the files to a process call where it has steps to change the structure.

Please let me know how to pick the files in the above order from cpi. Thanks in advance.

View Entire Topic
nageshrao
Product and Topic Expert
Product and Topic Expert
0 Kudos

To pick up files in a particular sequence, you can design the iflow in below manner. 

By employing sequential multicast, we establish three branches that execute in sequence. Each branch contains a Content Modifier that generates a property called "filename" with a unique value. This property is utilized by the SFTP Poll Enrich adapter, enabling the filenames to be passed and polled sequentially.

iFlow Design - 

nageshrao_0-1722993538275.png

Content Modifier - "Filename 1" 

nageshrao_1-1722993687568.png

Content Modifier - "Filename 2" 

nageshrao_2-1722993732058.png

Content Modifier - "Filename 3" 

nageshrao_3-1722993762335.png

SFTP Poll Enrich Adapter - 

nageshrao_4-1722993871745.png

 



R_Swetha1
Explorer
0 Kudos
If filenames are dynamic ? like the date changes this can be handled.Also please let me know the aggregation algorithm used in poll enrich
nageshrao
Product and Topic Expert
Product and Topic Expert
0 Kudos

If your filenames are dynamic, so say current date is appended to the filename and your requirement is to pick up only current dated files then the content modifier where filename is being set must be updated as below.

Example for first file : "Testfile_050824.csv" it must be updated to "Testfile_${date:now:ddMMyy}.csv"

nageshrao_0-1723100475901.png

Aggregation algorithm in Poll Enrich depends on what you want to do after polling all these three files individually. Here in above design it would create three branches and you would have each branch with its own file's payload. "Replace" should be the used. 

  • Combine XML: Combines the message polled from the external component with the original message without any conditions. The messages are combined in multimapping format.

  • Concatenate: The message polled from the external component is added to the existing message.

  • Replace: The existing message is replaced with the message polled from the external component.

You can read more about aggregation algorithm here - https://help.sap.com/docs/integration-suite/sap-integration-suite/define-poll-enrich



 

R_Swetha1
Explorer
0 Kudos
Thank for the reply.As per the requirement we have to pick the files in sequence and process them individually
Swetha_3
Discoverer
0 Kudos
@nageshrao so if we want to pick the files in sequence as per the filenames given and map each file to target structure and send the files to the target in the same sequence. So could you please let me know how the poll enrich work here.