Technical Articles
SAP CPI-Dynamic file name-adding CPI Message id
Dear All,
I am writing this blog to address the requirement where we need to add SAP CPI message-id in FILE-NAME for FTP/SFTP receiver adapter.
In my scenario, 10 +files were getting created at the same time (up to milliseconds) hence adding time stamp was not the solution.
So I followed many blogged to make every filename unique but could not achieve the result.
Here are the detailed steps required to add “Message-ID” in File Name.
Option 1- Add only Message-id
- Create the iflow as per your requirement
- Go to your SFTP/FTP receiver channel.
- set file name like this
Order_${date:now:yyyyMMddHHmmss}_${header.SAP_MessageProcessingLogID}.xml
Date time is optional here.
It will add the CPI message-id in the file name and it will be helpful to monitor the message as well in CPI.
Option 2- Add Message-id along with a Counter
In my iflow I have also added <counter> in the file name.
- Create the iflow as per your requirement
- add “Content Modifier” (in my iflow, its “UserDefinedvalue”)
- set up a number range in CPI using this blog.
- once number range defined ,go to “Exchange Property of your Content modifier”
- creat a Property and give it a name ex- number, and in value -give the same as you have set in number range in “operation view” ex “NumberRange”
6. now go to your SFTP/FTP receiver channel and set the filename like this
Order_${date:now:yyyyMMddHHmmss}_${property.number}_${header.SAP_MessageProcessingLogID}.xml
Date time is optional here.
HereĀ ${property.number} – is the name we sent in “exchange Property”.
Your comments and feedback are most welcome.
References:
- https://answers.sap.com/questions/406943/number-range-object-in-cpi.html
- https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/b6e17fa17a70491da4a54216db298f84.html
Thanks and Regards,
Pooja
Great article Pooja! I used option1 (wanted to avoid overhead of generating a number) and it worked fine.
Thanks Rajesh.