Selects all entries which exists in both tables which meet ON condition. Below is the sample ABAP CDS views in which INNER JOIN is used among 3 tables to get the so_id, so_item_pos, product_id, amount and currency_code. Copy and paste the below code into DDL source
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
@AbapCatalog.sqlViewName: 'ZV_DEMO_01' @ClientDependent: true @AbapCatalog.compiler.CompareFilter: true @EndUserText.label: 'Demo' define view Zcds_Demo_Example1 as select from snwd_so join snwd_so_i on snwd_so.node_key = snwd_so_i.parent_key inner join snwd_pd on snwd_so_i.product_guid = snwd_pd.node_key { snwd_so.so_id, snwd_so_i.so_item_pos, snwd_pd.product_id, snwd_so_i.net_amount, snwd_so_i.currency_code } |
1 2 3 |
Selects all records from the left table matching with the right table which meet ON condition. If no record found in second table those record fields are null |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
@AbapCatalog.sqlViewName: 'Z_CDS_OUTJOIN' @AbapCatalog.compiler.compareFilter: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'Joins in ABAP CDS Views' define view Z_Cds_Joins as select from snwd_so left outer join snwd_so_i on snwd_so.node_key = snwd_so_i.parent_key { snwd_so.so_id, snwd_so.billing_status, snwd_so.delivery_status, snwd_so.op_id, snwd_so_i.so_item_pos, snwd_so_i.net_amount, snwd_so_i.currency_code } |
Selects all records from the right table matching with the left table which meet ON condition. If no record found in left table those record fields are null.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
@AbapCatalog.sqlViewName: 'Z_CDS_OUTJOIN' @AbapCatalog.compiler.compareFilter: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'Joins in ABAP CDS Views' define view Z_Cds_Joins as select from snwd_so right outer join snwd_so_i on snwd_so.node_key = snwd_so_i.parent_key { snwd_so.so_id, snwd_so.billing_status, snwd_so.delivery_status, snwd_so.op_id, snwd_so_i.so_item_pos, snwd_so_i.net_amount, snwd_so_i.currency_code } |