Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ABAP CDS Views. As of ABAP 7.40 sp5 we can create and use CDS view in ABAP. From ADT you can create a CDS view via menu New -> Other Repository Object -> Dictionary -> CDS View. See these blogs for some futher info: (sp5)…
@AbapCatalog.sqlViewName: 'ZPURITEMS'
define view PurchaseOrderItem
as select from ekko inner join ekpo on ekko.ebeln = ekpo.ebeln {
key ekko.ebeln as id,
key ebelp as item_no,
lifnr as vendor,
ernam as created_by,
ekko.aedat as created_on,
txz01 as text,
@Semantics.currencyCode waers as currency_code,
@Semantics.amount.currencyCode: 'currency_code' netpr as price
where ekko.bstyp = 'F'
report y_test_cds_view.
data po_items type standard table of zpuritems with empty key.
select * from zpuritems into table po_items order by id descending item_no ascending.
cl_demo_output=>display_data( value = po_items ).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment