Skip to content

Instantly share code, notes, and snippets.

@js1972
Created October 13, 2014 01:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save js1972/5af45936d2c38dd95131 to your computer and use it in GitHub Desktop.
Save js1972/5af45936d2c38dd95131 to your computer and use it in GitHub Desktop.
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: http://scn.sap.com/community/abap/eclipse/blog/2014/02/04/new-data-modeling-features-in-abap-for-hana (sp5) http://scn.sap.com/comm…
@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.
start-of-selection.
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