on ‎2022 Mar 24 7:37 AM
Hi Experts
I am trying to create travel app with travel, booking and booking supplement using Managed type. I created 3 CDS views travel, booking and booking supplement with necessary parent and child relationship. When i create behavior definition, I am getting No behavior is defined for the association "_travel" of entity, I am unable to understand this error. I am practicing these scenario on SAP cloud trail.
Please see the my CDS view
1) Travel CDS view
@AbapCatalog.sqlViewName: 'ZVK10MTRAVEL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Travel for Managed composite View'
define root view ZVK_10_M_TRAVEL as select from /dmo/travel_m as _Travel
composition[0..*] of ZVK_10_M_BOOKING as _booking
association [1] to /dmo/agency as _agency
on $projection.AgencyId = _agency.agency_id
association [1] to /dmo/customer as _customer
on $projection.CustomerId = _customer.customer_id
association [1] to I_Currency as _currency
on $projection.CurrencyCode = _currency.Currency
{
key _Travel.travel_id as TravelId,
_Travel.agency_id as AgencyId,
_Travel.customer_id as CustomerId,
_Travel.begin_date as BeginDate,
_Travel.end_date as EndDate,
@Semantics.amount.currencyCode: 'CurrencyCode'
_Travel.booking_fee as BookingFee,
@Semantics.amount.currencyCode: 'CurrencyCode'
_Travel.total_price as TotalPrice,
_Travel.currency_code as CurrencyCode,
_Travel.description as Description,
_Travel.overall_status as OverallStatus,
@Semantics.user.createdBy: true
_Travel.created_by as CreatedBy,
@Semantics.systemDateTime.createdAt: true
_Travel.created_at as CreatedAt,
@Semantics.user.lastChangedBy: true
_Travel.last_changed_by as LastChangedBy,
@Semantics.systemDateTime.lastChangedAt: true
_Travel.last_changed_at as LastChangedAt,
_customer,
_agency,
_currency,
_booking
}
2) Booking CDS View
@AbapCatalog.sqlViewName: 'ZVK10MBOOK'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Booking child object composite child'
define view ZVK_10_M_BOOKING as select from /dmo/booking_m as _booking
association to parent ZVK_10_M_TRAVEL as _travel
on $projection.TravelId = _travel.TravelId
composition[0..*] of ZVK_10_M_BOOKING_SUP as _bookingsuppliment
association [1..1] to /DMO/I_Customer as _customer
on $projection.CustomerId = _booking.customer_id
association [1..1] to /DMO/I_Carrier as _carrier
on $projection.CarrierId = _carrier.AirlineID
association[1..1] to /DMO/I_Connection as _connection
on $projection.CarrierId = _connection.AirlineID
and $projection.ConnectionId = _connection.ConnectionID
{
key _booking.travel_id as TravelId,
key _booking.booking_id as BookingId,
_booking.booking_date as BookingDate,
_booking.customer_id as CustomerId,
_booking.carrier_id as CarrierId,
_booking.connection_id as ConnectionId,
_booking.flight_date as FlightDate,
_booking.flight_price as FlightPrice,
_booking.currency_code as CurrencyCode,
_booking.booking_status as BookingStatus,
_booking.last_changed_at as LastChangedAt,
_travel,
_customer,
_connection,
_carrier,
_bookingsuppliment
}
3) Booking Supplement CDS View
@AbapCatalog.sqlViewName: 'ZVK10MBOOKSUP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Booking Suppliment for parent association'
define view ZVK_10_M_BOOKING_SUP as select from /dmo/book_suppl as _booksup
association to parent ZVK_10_M_BOOKING as _booking
on $projection.BookingId = _booking.BookingId
and $projection.TravelId = _booking.TravelId
association[1..1] to ZVK_10_M_TRAVEL as _travel
on $projection.TravelId = _travel.TravelId
association[1..1] to /DMO/I_Supplement as _product
on $projection.SupplementId = _product.SupplementID
association[1..1] to /dmo/suppl_text as _supplimentText
on $projection.SupplementId = _supplimentText.supplement_id
{
key _booksup.travel_id as TravelId,
key _booksup.booking_id as BookingId,
key _booksup.booking_supplement_id as BookingSupplementId,
_booksup.supplement_id as SupplementId,
_booksup.price as Price,
_booksup.currency_code as CurrencyCode,
_booking,
_travel.LastChangedAt,
_product,
_supplimentText,
_travel
}
4) Behavior definition
managed implementation in class zbp_vk_10_m_travel unique;
//strict; //Comment this line in to enable strict mode. The strict mode is prerequisite to be future proof regarding syntax and to be able to release your BO.
define behavior for ZVK_10_M_TRAVEL //alias <alias_name>
persistent table /DMO/TRAVEL_M
lock master
authorization master ( instance )
etag master LastChangedAt
{
create;
update;
delete;
association _booking { create; }
}
define behavior for ZVK_10_M_BOOKING //alias <alias_name>
persistent table /DMO/BOOKING_M
lock dependent by _travel
authorization dependent by _travel
etag master LastChangedAt
{
update;
delete;
field ( readonly ) TravelId;
association _travel;
association _bookingsuppliment { create; }
}
define behavior for ZVK_10_M_BOOKING_SUP //alias <alias_name>
persistent table /dmo/book_suppl
lock dependent by _travel
//authorization dependent by <association>
etag master LastChangedAt
{
update;
delete;
field ( readonly ) BookingId, TravelId;
association _booking;
}
I am getting error in behavior definition

I dont know why this error is occuring. even i have defined travel association in booking supplement. Still i am getting this error.
Kindly let me know how to fix this issue.
Thanks and Regards
Vijay
Request clarification before answering.
You forgot to add the statement
association _Travel { }in the behavior definition for supplements.
When I comment out this statement in the code of the BDEF of our managed flight sample /DMO/I_Travel_M I get exactly the same error.
define behavior for /DMO/I_BookSuppl_M alias booksuppl
implementation in class /DMO/BP_BOOKINGSUPPLEMENT_M unique
//persistent table /DMO/BOOKSUPPL_M
with unmanaged save
etag master last_changed_at
lock dependent by _Travel
early numbering
authorization dependent by _Travel
{
// static field control
field ( mandatory ) price,supplement_id;
field ( readonly ) travel_id, booking_id, booking_supplement_id;
// mapping entity's field types with table field types
mapping for /DMO/BOOKSUPPL_M corresponding;
// standard operations for booking supplement entity
update;
// determination for calculation of total suppl. price
determination calculateTotalPrice on modify {create; field price, currency_code; }
// association _Travel { }
association _Booking { }
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andre,
Once i uncomment the association _Travel {}, Started getting error 'No behavior can be defined for association "_Travel"..
Code reference i have taken from below link
https://help.sap.com/docs/BTP/923180ddb98240829d935862025004d6/cb558d9c68cc4082a6b18769a19cec06.html

Regards,
OldMonk
Hi Andre
Yes you are right. Thank you helping the beginner in RAP.
Thanks and Regards
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.