Skip to Content
1
Jul 23, 2020 at 07:06 AM

OData Error while fetching single record

103 Views

I have created an oData service calling few entities from vbak table. Get_entityset method is fetching the complete data but get_entity is giving error " Resource not found for segment " and error log shows " Task facade not implemented for provider ".

get_entity code given below:

method table1set_get_entity.
    data: ls_key_tab type /iwbep/s_mgw_name_value_pair,
          lv_vbeln   type vbak-vbeln,
          ls_vbak    type vbak.

    READ table it_key_tab with key name = 'Vbeln' into ls_key_tab.
    lv_vbeln = ls_key_tab-value.

    select single * from vbak into ls_vbak where vbeln = lv_vbeln.
    if sy-subrc eq 0.
      er_entity-vbeln = ls_vbak-vbeln.
      er_entity-ernam = ls_vbak-ernam.
      er_entity-auart = ls_vbak-auart.
    endif.
  endmethod.