Reputation: 554
I have a simple CDS view. When I execute it, I have the error invalid format (return table) row number 1 property name
.
I think I need to cast the date to string or char type, but there's this syntax error:
CAST DOGUM_TARIHI on type CHAR: Length information of target type is missing
Here is my code:
define view ZUMBS_CDS008
as select from zumhr_ddl001 as hr {
personel_numarasi,
personel_adi,
cast(dogum_tarihi as abap.char) as te33 //<== error at this line
} group by personel_numarasi,personel_adi,dogum_tarihi
Upvotes: 4
Views: 17632
Reputation: 10621
So add this length information for the God's sake:
cast(dogum_tarihi as abap.char(8)) as te33
However, this only converts date as-is, without making it readable:
20190822 -> 20190822
If you want to make it readable according to format DD.MM.YYYY, make it like this:
@AbapCatalog.sqlViewName: 'zcds_sql_usr02'
@EndUserText.label: 'test CDS view'
define view zcds_usr02 as select from usr02
{
usr02.bname,
usr02.gltgb,
cast(usr02.gltgb as abap.char(10)) as casted,
concat(
concat(substring( usr02.gltgb, 7, 2 ), '.'),
concat(substring( usr02.gltgb, 5, 2 ), concat('.', substring( usr02.gltgb, 1, 4 )))
) as readable
}
where usr02.gltgb <> '00000000';
This will make from 20190822 a date of 22.08.2019.
Upvotes: 4