on 02-26-2015 5:50 PM
Hi all.
I'm actually having problems when showing some data in a Fiori App. Fiori App is basically making this call:
/sap/opu/odata/sap/APPROVAL_SRV/PaymentBatchCollection?$skip=0&$top=20&$inlinecount=allpages
Without implementing the skip and top functionality, is strange what I get from ET_ENTITYSET. Debuggin the method I can see 38 entries however in the Fiori App I can see that 58 entries have been passed. I'm pretty sure that is because of missing implementation of the top and skip, but after trying with some coding i'm not able to do the correct paging. This is what I wrote ..
lv_top = io_tech_request_context->get_top( ).
lv_skip = io_tech_request_context->get_skip( ).
IF lv_skip IS NOT INITIAL.
DELETE et_entityset TO lv_skip.
endif.
DESCRIBE TABLE et_entityset lines lv_lines.
DELETE et_entityset from lv_top to lv_lines.
With this piece of code I can only see 19 first entries, with no option to get to next page.
Can anybody help me?
Thanks in advance.
Hello Garcia,
DATA ls_paging TYPE /iwbep/s_mgw_paging.
DATA lv_skip TYPE int4.
DATA lv_top TYPE int4.
ls_paging-top = io_tech_request_context->get_top( ).
ls_paging-skip = io_tech_request_context->get_skip( ).
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( lt_data ).
ENDIF.
LOOP AT lt_data INTO ls_data FROM lv_skip TO lv_top.
" map only required fields as GW response.
APPEND ls_data TO et_entityset.
CLEAR ls_data.
ENDLOOP.
Where,
lt_data is the internal table which is holding the data fetched by your backend logic.
et_entityset would be your return table which will be sent as part of GW response ( fields which are part of your GW model i.e., fields which you would like to see in Fiori App )
This should work. Please check.
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A sample code in DPC may may look like
IF lv_skip IS NOT INITIAL.
DELETE lt_table FROM 1 TO lv_skip .
ENDIF.
IF ( lv_top + 1 ) LE lines( lt_table ) .
DELETE lt_table FROM ( lv_top + 1 ) TO lines( lt_table ) .
ENDIF.
however it is the responsibility of the UI to fire the call with correct $top and $skip value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.