cancel
Showing results for 
Search instead for 
Did you mean: 

Parameterized target Entity in Association - ABAP RAP

0 Kudos
801

Hello Expert,

We have 2 entities BaseEntity and TargetEntity both accepts parameters and there is an association defined between them.

How do we pass the parameters to the TargetEntity in this case?

Is it possible to pass the parameters or is there any alternative in this case.

Regards,

Anthony

View Entire Topic
Patrick_vN
Active Contributor
0 Kudos

Have you tried something like this the code below? ( Mind you this is written in notepad, so I haven't tested it 🙂 )

define view BASE with parameters
		param_base1 : [dataelement],
		param_base2 : [dataelement],
	as select from ...
  		association[0..*] to TARGET as _target
		                  on $projection.key = _target.key
	{
		key base_field_a,
		key _target(param_target : :param_base2).target_field_a,
		_target(param_target : :param_base2).target_field_b,
		..
	}
	where base_field_key = :param_base1
0 Kudos

Hi Patrick,

Thanks for responding to my query.

I tried exactly the same solution which you posted. view is returning the data but i don't see the association _target in my service binding or in my metadata.

for me it's required since i need to provide the association name for my ALP UI application for facet.

Regards,
Anthony

Patrick_vN
Active Contributor
0 Kudos

I haven't done much with ABAP RAP yet, so maybe a silly question: are the service binding, etc. objects/services automatically modified if you make changes the CDS below them? Or do you have to regenerate them or something?

0 Kudos

Yes Patrick, when we update the underlying CDS views, service binding will be updated automatically, no need to generate again.

you may have to reopen the file to see the changes.