Anlegen des CDS-Views in Eclipse (ab ABAP 7.4 SP8)
* Menü -> File -> New -> Other -> Core Data Services -> Data Definition * CDS-View als DDIC Objekt erstellen @AbapCatalog.sqlViewName: 'ZCDS_MATNR_VIEW' @AbapCatalog.compiler.CompareFilter: true @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'MATNR lesen' @Metadata.allowExtensions: true define view ZCDS_MATNR as select from mara as ma inner join makt as kt on ma.matnr = kt.matnr { key ma.matnr as matnr, ma.ernam as ersteller, ma.vpsta as pflegestatus, case ma.lvorm when 'X' then 'gelöscht' else 'aktiv' end as loeschvormerkung, kt.maktx as kurztext };
ABAP-Quellcode zum Auslesen des CDS-Views
* Variante 1 (SELECT) DATA: it_matnr TYPE STANDARD TABLE OF zcds_matnr. SELECT * FROM zcds_matnr INTO TABLE @it_matnr. LOOP AT it_matnr ASSIGNING FIELD-SYMBOL(<mat>). WRITE: / <mat>-matnr, <mat>-ersteller, <mat>-pflegestatus, <mat>-loeschvormerkung, <mat>-kurztext. ENDLOOP. * Variante 2 (SALV TABLE IDA) TRY. cl_salv_gui_table_ida=>create_for_cds_view( CONV #( 'ZCDS_MATNR' ) )->fullscreen( )->display( ). CATCH cx_root INTO DATA(e_txt). WRITE: / e_txt->get_text( ). ENDTRY.
Links
- https://help.sap.com/viewer/f2e545608079437ab165c105649b89db/7.51.3/en-US/4ed1f2e06e391014adc9fffe4e204223.html
- https://blogs.sap.com/2017/09/09/abap-core-data-services-introduction-abap-cds-view/
- https://itpsap.com/dont-try-coding-abap-core-data-services-without-reading-this-first-2/
- http://www.saplearners.com/how-to-create-abap-cds-views-with-paramertes/
- http://www.sapyard.com/abap-on-sap-hana-part-v/
- http://www.sapyard.com/abap-on-sap-hana-part-xv-expose-cds-views-as-odata-service-through-annotation/
- http://www.cadaxo.com/high-class-development/abap-cds-views-6-schritte-zum-verstaendnis/
- https://blogs.sap.com/2016/03/10/my-cds-view-self-study-tutorial-part-1-how-to-test-odata-service-generated-by-cds-view/
- https://blogs.sap.com/2015/07/20/cds-one-model-two-flavors/
- https://blogs.sap.com/2018/07/03/performance-optimization-for-abap-cds-view/
- https://blogs.sap.com/2017/09/22/data-filtration-options-and-performance-analysis-in-abap-cds-views/
- https://medium.com/@naveenkumarbaskaran/cds-views-part-7-d3a3465ff75f