*skip/top/inline
zcl_segw_utilities=>skiptopinlinecount( exporting io_tech_request_context = io_tech_request_context changing ct_entityset = et_entityset cs_response_context = es_response_context ).
method skiptopinlinecount.
*----------------------------------------------------------------------*
* Author: Dave Price
* Date: 1/27/2017
* Purpose: Skip/top/inlinecount logic for any DPC ENTITYSET call
*----------------------------------------------------------------------*
* MODIFICATION LOG *
*----------------------------------------------------------------------*
* Author Date Transport Description
* ------- ---------- ---------- -----------
*
*----------------------------------------------------------------------*
*******NOTES
*skip=5 means start results from the 6th row
*top=3 means show the first three results after skipping
*so skip=5 and top=3 means return results 6,7,8
data:
lt_entityset type ref to data,
ls_paging type /iwbep/s_mgw_paging,
lv_skip type int4,
lv_top type int4.
field-symbols:
<fs_entityset> type any,
<fs_entityset_t> type standard table.
*create a second internal table like ct_entityset as a field symbol
create data lt_entityset like ct_entityset.
assign lt_entityset->* to <fs_entityset_t>.
move ct_entityset[] to <fs_entityset_t>.
* if skip > 0 retrieve the entries from skip + top - 1, e.g.
ls_paging-top = io_tech_request_context->get_top( ).
ls_paging-skip = io_tech_request_context->get_skip( ).
if io_tech_request_context->has_inlinecount( ) = abap_true. cs_response_context-inlinecount = lines( ct_entityset ). endif.
if ls_paging-skip is not initial. lv_skip = ls_paging-skip + 1. endif.
if ls_paging-top <> 0 and lv_skip is not initial.
lv_top = ls_paging-top + lv_skip - 1.
elseif ls_paging-top <> 0 and lv_skip is initial.
lv_top = ls_paging-top.
else.
lv_top = lines( ct_entityset ).
endif.
if io_tech_request_context->has_inlinecount( ) = abap_true.
describe table ct_entityset lines cs_response_context-inlinecount.
endif.
clear ct_entityset.
loop at <fs_entityset_t> assigning <fs_entityset> from lv_skip to lv_top.
append <fs_entityset> to ct_entityset.
endloop.
endmethod.
Class ZCL_SEGW_UTILITIES
Method SKIPTOPINLINECOUNT
Description Skip, Top and Inliine Count functions for any DPC ENTITYSET
IO_TECH_REQUEST_CONTEXT Importing Type Ref To /IWBEP/IF_MGW_REQ_ENTITYSET
CS_RESPONSE_CONTEXT Changing Type /IWBEP/IF_MGW_APPL_SRV_RUNTIME=>TY_S_MGW_RESPONSE_CONTEXT
CT_ENTITYSET Changing Type STANDARD TABLE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |