Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Use of $Projection Keyword and Filters in Association

Active Participant
0 Kudos

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.


Pawan Akella


Active Participant
0 Kudos

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