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

Calling CDS associations in ABAP programs

ramesh_mohan3
Explorer
0 Likes
1,149

I'm trying to find the correct syntax to retrieve data from CDS associations from an ABAP program.

This is my CDS view with 3 associations.

define view y_ddl_flights as select from scustom as customer

association [1..*] to sbook as _bookings on customer.id = _bookings.customid { customer.id,

customer.name,

, _bookings[class = 'C'] as business_flights,

_bookings[class = 'Y'] as economy_flights,

_bookings[class = 'F'] as firstclass_flights }

Now how to get data from the association business_flights in an ABAP program.

I tried the following but it shows syntax error.

TYPES:BEGIN OF t_test,
id TYPE s_customer,
name TYPE s_custname,
carrid TYPE s_carr_id,
END OF t_test.

DATA: it_test TYPE STANDARD TABLE OF t_test.

SELECT id,name,\business_flights\_carrid FROM y_ddl_flights
INTO CORRESPONDING FIELDS OF TABLE @it_test
WHERE id = '00000001'.

I'm trying to find the correct syntax to retrieve data from CDS associations from an ABAP program.

This is my CDS view with 3 associations.

define view y_ddl_flights as select from scustom as customer

association [1..*] to sbook as _bookings on customer.id = _bookings.customid { customer.id,

customer.name,

, _bookings[class = 'C'] as business_flights,

_bookings[class = 'Y'] as economy_flights,

_bookings[class = 'F'] as firstclass_flights }

Now how to get data from the association business_flights in an ABAP program.

I tried the following but it shows syntax error.

TYPES:BEGIN OF t_test,
id TYPE s_customer,
name TYPE s_custname,
carrid TYPE s_carr_id,
END OF t_test.

DATA: it_test TYPE STANDARD TABLE OF t_test.

SELECT id,name,\business_flights\_carrid FROM y_ddl_flights
INTO CORRESPONDING FIELDS OF TABLE @it_test
WHERE id = '00000001'.

0 REPLIES 0