on ‎2019 Nov 29 11:12 AM
Hello,
How to implement orderby in Code based OData? I try CDS based OData expose as RDS in SEGW and create the UI using Fiori Elements List Report. Then I redefine the GET_ENTITYSET in DPC_EXT class and I do not call the super class.
Here is how I currently implement the orderby
SELECT ....
INTO TABLE @DATA(lit_data)
....
" order by
CALL METHOD /iwbep/cl_mgw_data_util=>orderby
EXPORTING
it_order = it_order
CHANGING
ct_data = lit_data.
....
implement paging & stuff
I can debug and show that the internal table it is actually sorted correctly. But somehow, in the List Report application, the record is not shown as in the same order as in the internal table.
How to implement order by correctly?
Thank you.
Request clarification before answering.
Hi,
I solve this by specifying the correct keys in the CDS. So, in the report result there are actually 2 fields that make each record unique, but in the CDS I only specify 1 of those 2 field as the key. I set 2 fields as keys correctly and now the sorting works.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I've had an issue when using the it_order value. But I've replaced that by the content that you can read with io_tech_request_context->get_orderby( ). And I'm using et_entityset to do the operation:
DATA: lt_order TYPE /iwbep/t_mgw_sorting_order.
IF NOT it_order IS INITIAL.
DATA(lt_orderby) = io_tech_request_context->get_orderby( ).
LOOP AT lt_orderby ASSIGNING FIELD-SYMBOL(<fs_orderby>).
APPEND INITIAL LINE TO lt_order ASSIGNING FIELD-SYMBOL(<fs_order>).
MOVE-CORRESPONDING <fs_orderby> TO <fs_order>.
ENDLOOP.
/iwbep/cl_mgw_data_util=>orderby(
EXPORTING
it_order = lt_order
CHANGING
ct_data = et_entityset
).
ENDIF.
Maybe that helps.
Best Regards
Gregor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.