Skip to Content
Technical Articles
Author's profile photo POOJA TIWARI

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

  1. Create the iflow as per your requirement
  2. Go to your SFTP/FTP receiver channel.
  3. 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.

 

  1. Create the iflow as per your requirement
  2. add “Content Modifier” (in my iflow, its “UserDefinedvalue”)
  3. set up a number range in CPI using this blog.
  4. once number range defined ,go to “Exchange Property of your Content modifier”
  5. 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”.

After deploying the changes you should get the file name as per expectations.

Your comments and feedback are most welcome.

 

References:

  1. https://answers.sap.com/questions/406943/number-range-object-in-cpi.html
  2. https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/b6e17fa17a70491da4a54216db298f84.html

Thanks and Regards,

Pooja

 

 

 

 

 

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Rajesh Dash
      Rajesh Dash

      Great article Pooja! I used option1 (wanted to avoid overhead of generating a number) and it worked fine.

      Author's profile photo POOJA TIWARI
      POOJA TIWARI
      Blog Post Author

      Thanks Rajesh.