Skip to Content

How to use paging in Odata?

paging in oData abap..

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Feb 28 at 11:43 AM

    Hi Parul,

    You first need to implement the method: GET_ENTITY_SET in odata.


    METHOD maraset_get_entityset.
    DATA : it_tab TYPE STANDARD TABLE OF zmara_130495.DATA : wa_tab TYPE zmara_130495,
    ls_entityset TYPE zcl_zmara_130495_pagin_mpc=>ts_mara,
    lt_entityset TYPE zcl_zmara_130495_pagin_mpc=>tt_mara,"FOR FILTER
    wa_filter TYPE /iwbep/s_mgw_select_option,
    wa_id LIKE LINE OF wa_filter-select_options,id TYPE zmara_130495-matnr.READ TABLE it_filter_select_options INTO wa_filter WITH KEY property = 'Matnr'.IF sy-subrc = 0.READ TABLE wa_filter-select_options INTO wa_id INDEX 1 .
    IF sy-subrc = = wa_id-low.ENDIF.ENDIF.
    IF id IS NOT INITIAL.SELECT * FROM zmara_130495 INTO TABLE it_tab WHERE matnr = id ."END OF FILTER CODE
    ELSE.SELECT * FROM zmara_130495 INTO TABLE it_tab .ENDIF.IF it_tab IS NOT INITIAL.LOOP AT it_tab INTO wa_tab.MOVE-CORRESPONDING wa_tab TO ls_entityset.APPEND ls_entityset TO lt_entityset.ENDLOOP.ENDIF.
    DATA: lv_top TYPE i,
    lv_skip TYPE i,
    lv_table_size TYPE i.

    lv_top = io_tech_request_context->get_top( ).
    lv_skip = io_tech_request_context->get_skip( ).
    * >> Client Paging (top/skip)IF lv_top IS NOT INITIAL OR
    lv_skip IS NOT INITIAL.LOOP AT lt_entityset INTO ls_entityset.IF sy-tabix > lv_skip.APPEND ls_entityset TO et_entityset.
    lv_table_size = lines( et_entityset ).IF lv_top IS NOT INITIAL AND
    lv_table_size >= lv_top.EXIT.ENDIF.ENDIF.ENDLOOP.ELSE.* >> No Paging
    et_entityset = lt_entityset.ENDIF.


    Go to gateway: Run the URL


    note: ZMARA_130495 here is custom table created in se11.

    maraset_get_entityset is the name of GET_ENTITY_SET method.



    Add comment
    10|10000 characters needed characters exceeded

  • Feb 28 at 11:37 AM


    Paging (pagination) is a functionality that can be achieved with the $top and $skip commands. there has to be implemented by the data provider.

    The topic is covered in the GW100 standard training too, but you can find many resources on the SAP help:

    and on the community too:


    Add comment
    10|10000 characters needed characters exceeded

  • Feb 28 at 11:46 AM

    Hi Mrinalini,

    Thanks for the great help.



    Add comment
    10|10000 characters needed characters exceeded