Skip to Content
0

Calling CDS associations in ABAP programs

Feb 14 at 05:11 PM

48

avatar image

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'.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers