2015 Nov 05 8:40 AM
Hi Everyone,
I've two questions about CDS Views:
1.) How can I consume cds view, in particular cds views with associations in opensql?
At the abap documentation I found CDS explicit syntax only for passing parameters, but nothing for projection:
... *
| {data_source1~*, data_source2~*, ...}
| {col_spec1 [AS a1], col_spec2 [AS a2], ...}
| (column_syntax) ...
2. Is there a comprehensive cds view syntax documentation availabe? I found this "By Example" Document CDS View Syntax Options - SAP HANA Developer Guide for SAP HANA Studio - SAP Library but I'm looking for something more like a railroad syntax. With the "By Example" style it's hard to see no subselects are supported...
Thanks and Regards,
Franz
2015 Nov 05 11:22 AM
Ok. Got 2.) By Pressing F1 - sometimes it's really simpler as expected. But 1.) is still open.
2015 Nov 05 12:12 PM
CDS views can be consumed like any other table view.
you need to write select query on the view.
Like,
select field1
from ZCDS_V
where field2 = 'ABC'.
2015 Nov 05 2:22 PM
Thanks. But how can I access associations for a CDS View like:
from aaa association [1..1] to bbb on ....
Is it possible to have the association at the projection somehow?
Regards,
Franz
2015 Nov 26 4:12 PM
Hi Franz,
In the Open SQL, the associations have to be prefixed with a backslash '\' in order to distinguish them from usual columns.
For example:
Association in the select-list:
SELECT salesorderuuid,
\_PaymentTerms-SalesOrderPaymentTerms as terms
FROM sepm_i_salesorder into table @data(tab1) .
or in the from clause:
SELECT SalesOrderItemUUID
FROM sepm_i_salesorder\_item into table @data(tab2) .
Note: Filter expressions are not yet available in the Open SQL.
For obvious reason we could not use the dot as a seperator in the path expressions in the ABAP. Associations are always prefixed with a backslash, columns are prefixed in path expressions with the ABAP Open SQL with a dash '-', the standard component selector.
best regards Andreas