on 07-22-2020 8:47 AM
I have built an unmanaged application using the ABAP RESTful Programming Model using the Flight Reference scenario.
No data is shown in the table in the object page which is supposed to show bookings for a travel.
When checking the SAP Gateway Error Log I found the following error message:
Backend Error: Duplicate resource, Service:/SAP/-ZUI_RAP_TRAVEL_U_O2_1234-0001
The source code extract was
IF lv_count = 0.
" check whether this is a navigation: Lv_count = 0 is allowed for associations with target cardinality 0..1
" Probably the 100% correct behavior would be to throw an exception if the association has cardinality 'to 1' and not throw
" it for cardinality 'to 0..1'. But interpreting the model is pretty complicated (association, navi property, association set,
" left or right-end cardinality, ...
IF ls_entity_path-navigation_steps IS INITIAL.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
textid = /iwbep/cx_mgw_busi_exception=>resource_not_found
entity_type = _get_type_name( ls_entity_path-entity_name )
http_status_code = /iwbep/cx_mgw_busi_exception=>gcs_http_status_codes-not_found.
ENDIF.
ELSEIF lv_count > 1.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
textid = /iwbep/cx_mgw_busi_exception=>resource_duplicate
entity_type = _get_type_name( ls_entity_path-entity_name ).
ENDIF.
Since I found the solution I am posting also the answer.
The root cause was that I accidently forgot to add a one to n [0..*] cardinality to the composition that points from the root entity travel to the child entity booking.
define root view entity ZI_RAP_Travel_U_1234
as select from /dmo/travel
composition of ZI_RAP_Booking_U_1234 as _Booking
The error is not that easy to spot because the ADT tools show several values when navigating from a travel to a booking though there it is shown that it is a [0..1] association.
After adding the [0..n] cardinality the service worked as expected.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.