07-20-2015 3:36 PM
Hi,
I'm trying to do som calculation with date type fields.
@AbapCatalog.sqlViewName: 'ZDEMOSDN'
@EndUserText.label: 'test'
define view ZDEMOSDN as select from aufk as a inner join afko as b
on a.aufnr = b.aufnr
{
key a.aufnr,
a.erdat - a.idat2 as date2
}
I'm getting the error messages:
Data type DATS is currently not supported in an arithmetic expression
Will this be supported in near future? Is there kind of workaround .
Regards,
Bart
07-22-2015 8:53 AM
There are functions like
dats_is_valid
dats_days_between
dats_add_days
dats_add_months
If they are not available yet in your current SP-release then there is no workaround as date-time calculations are very complex (just think of leap years or things like that)
07-27-2015 3:58 PM
Thanks Christian. Unfortunately
not available, because of SP-release.
Regards,
Bart
08-16-2016 11:35 AM
can we use $session.system_date as one of the parameter to dats_days_between function.
I tried it in cds view, I the following error
Function DATS_DAYS_BETWEEN: At position 2, only Expressions,Literals,Columns,Paths,Parameters allowed
please help me on this.
09-13-2016 1:08 PM
Usage of a parameter could serve as workaround:
define view ...
with parameters
sydat : abap.dats @<Environment.systemField: #SYSTEM_DATE
as select from svers
{
dats_days_between( $parameters.sydat, $parameters.sydat ) as delta
}
or a join with another view (wrapping $session.system_date as column)
define view ...
as select from svers
{
$session.system_date as system_date
}