Skip to Content

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

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.
Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jul 22, 2020 at 07:52 AM

    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.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.