Is there any way to get current timestamp or current date ?  SQL syntax is date.now() but it doesn't work in ABAP CDS. Is there any solution without parameters ?
In 7.50 you have tstmp_current_utctimestamp(). It may be used to compare with other timestamps, leading to a need to convert typical date and time fields. Example:
// As our system is set to UTC already, these cast and calculation are OK awaiting ABAP 7.51. Add a day if time is 24:00.
case resb.bdztp when '240000' 
                then cast( cast( cast( concat( DATS_ADD_DAYS( resb.bdter, 1, 'NULL'), '000000' ) as abap.numc(14) ) as abap.dec( 15, 0 ) ) as timestamp )
                else cast( cast( cast( concat( resb.bdter, resb.bdztp )                          as abap.numc(14) ) as abap.dec( 15, 0 ) ) as timestamp )
end as RequirementDateTimeUTC,
Consumption:
// Seconds since Requirement Date & Time for view isOverdue. 
tstmp_seconds_between( resb.RequirementDateTimeUTC, tstmp_current_utctimestamp(), 'NULL') as SecondsSinceReqDateTimeUTC,
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With