Skip to Content
Jul 08, 2022 at 10:21 AM

ABAP Rap - Remote Client Proxy get with $expand



I am trying to use the busines partner api to read the supplier company of a business partner.

I created the service consumption model with the metadata.xml from the $metadata call of the service in the backend system and selected entities business partner, supplier & supplier company.

Reading the BP works fine, but as soon as I add "->navigate_to_single( '_Supplier' )" and exception(/IWBEP/CX_V4_MED) is raised with text "Eigenschaft '_Supplier' nicht gefunden"

Any ideas?

      data ls_entity_key    TYPE ZA_BUSINESSPARTNER5CABDC63FB.
      data ls_business_data TYPE za_businesspartner5cabdc63fb.

        DATA(lo_http_destination) = cl_http_destination_provider=>create_by_cloud_destination( i_name = 'XXX' ).
        DATA(lo_web_http_client)  = cl_web_http_client_manager=>create_by_http_destination( lo_http_destination ) .
        DATA(lo_client_proxy) = cl_web_odata_client_factory=>create_v2_remote_proxy(
            iv_service_definition_name = 'ZS4_API_BUSINESS_PARTNER'
            io_http_client             = lo_web_http_client
            iv_relative_service_root   = '/sap/opu/odata/sap/API_BUSINESS_PARTNER/' ).

        " Set entity key
        ls_entity_key-businesspartner  = '300000050'.

        " Navigate to the resource
        DATA(lo_resource) = lo_client_proxy->create_resource_for_entity_set( 'A_BUSINESSPARTNER' )->navigate_with_key( ls_entity_key )->navigate_to_single( '_Supplier' ).
        DATA(lo_response) = lo_resource->create_request_for_read( )->execute( ).
        DATA(lo_response)->get_business_data( IMPORTING es_business_data = ls_business_data ).
      CATCH cx_root INTO DATA(e).
        DATA(text) = e->get_text( ).