SAP CPI Find tomorrows date

Find yesterday in SAP CPI

Once you are developing SAP  CPI integration. One of the things you often want to fetch is tomorrow's date or time 1hour ago. 

Sure integration developers often know the time. It is not like they're are more confused than other people. 

One of the options SAP CPI is giving is the Camel Expressions where you have a limited set of commands you can use. In an SAP CPI context, one of the best overviews is the following on Camel Simple Expression in SAP CPI.

There were some gaps in the time you could ask for ${date:now} or ${date:now:dd-MM-yyyy} but it was not possible to ask for other dates. Then you needed to resort to Groovy. Which just enabled you to create some small scripts to perform the action in. 

This weekend SAP CPI Cloud Foundry was released. One of them was an update of Camel runtime. 

It is now possible to perform simple data navigation. You can do it in a content modifier

  • ${date:now-24h:dd-MM-yyyy HH:mm z} to get time 24 hours ago and formatted to a given timezone
  • ${date:property.CamelCreatedTimestamp+1h} to add 1 hour to the property Camel Created Timestamp.  
  • date-with-timezone gives you option to use timezones. 

Camel timestamp.jpg

Which gives 

There may be other hidden treasures in the upgraded Camel runtime. 

 

Versions of Camel

This difference is because CF is using Camel version 2.24. In Camel 2.18 was this time addition added. 

 

Note:

If you run the same in Neo you will receive SimpleParserException. So if you want to design iflows that everybody needs to use, then stay away from the functionality for some time. 


Create CPI Service Key to send data to SAP CPI
Create a Git repository for your SAP CPI development in 20 minutes

0 comments

There are no comments yet. Be the first one to leave a comment!