cancel
Showing results for 
Search instead for 
Did you mean: 

Backend Error: Duplicate resource , No data is shown in object page table

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert

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.

Answers (0)