05-23-2016 6:52 PM
Hi Experts,
I want to know the use of $projection keyword. when should we use this keyword.
I want to know the difference of below two statements
business_partners[ bp_role = '01' ].company_name as customer_name --
I know this statement is used to display the customer name whose Bp_role value is equal to 01
But I didn't understand the below statement
mard[1: matnr = '0000000010'].lgort
Can you also please tell me about use of associations. Since we can use inner joins in which business scenario we can use associations.
Thanks
Pawan Akella
05-24-2016 7:34 AM
Hi Pawin,
$projection is used, when you want to refer to a name defined as alias in the projection list e.g. in an on-condition of an assocation.
The 1: when using a filter for an association tells the compiler, that the association gets a to 0..1 cardinality when the filter is applied. Otherwise you would get a warning that the cardinality of your view might change by following the assocation.
Associations can be used within CDS, from OpenSQL or by exposing then via OData.
Regards, Thomas