cancel
Showing results for 
Search instead for 
Did you mean: 

manage customer line items fiori app : newly added custom fields Sort/Filter not working

0 Kudos

Need help to add sort/filter functionality for custom columns added to items in manage customer line items extended fiori app.

Added two custom fields ZTEST1 & ZTEST2 to the items. It has been mapped properly . Data is coming correct.

But the Sort/ Filter functionality for ZTEST1 & ZTEST2 not working correctly.

Changes Made in extended class method.

To sort as per the added Z* field we thought to sort it explicitly after the this method call.

Below code is just a tried approach.

ZCUSTOMER_LINE_DPC_EXT->ITEMSET_GET_ENTITYSET.

"--Manage Customer Line Items-AddColumn & Filter

DATA(lt_order) = it_order[].
LOOP AT lt_order ASSIGNING FIELD-SYMBOL(<fs_order>).
TRANSLATE <fs_order>-property TO UPPER CASE.
TRANSLATE <fs_order>-order TO UPPER CASE.
ENDLOOP.

"--Checking if the lt_order has record for ZTEST1, if yes then clearing this record and sort again at the end of this method.


READ TABLE lt_order INTO DATA(ls_order) WITH KEY property = 'ZTEST1'
order = 'ASC' .
IF sy-subrc IS INITIAL.
DATA(lt_order_tmp) = lt_order.
CLEAR lt_order.
ENDIF.

"--call of methods to get line items.

TRY.
CALL METHOD super->itemset_get_entityset
EXPORTING
iv_entity_name = iv_entity_name
iv_entity_set_name = iv_entity_set_name
iv_source_name = iv_source_name
it_filter_select_options = it_filter_select_options
is_paging = is_paging
it_key_tab = it_key_tab
it_navigation_path = it_navigation_path
it_order = lt_order "it_order
iv_filter_string = iv_filter_string
iv_search_string = iv_search_string
io_tech_request_context = io_tech_request_context " Real ISSUE
IMPORTING
et_entityset = et_entityset
es_response_context = es_response_context.
CATCH /iwbep/cx_mgw_busi_exception .
CATCH /iwbep/cx_mgw_tech_exception .
ENDTRY.

IF et_entityset IS NOT INITIAL.
lt_entityset[] = et_entityset[].
DELETE lt_entityset WHERE branch IS INITIAL.
SORT lt_entityset BY branch ASCENDING.
DELETE ADJACENT DUPLICATES FROM lt_entityset COMPARING branch.
IF lt_entityset IS NOT INITIAL.
SELECT kunnr,
sortl,
name1
INTO TABLE @DATA(lt_sortl)
FROM kna1
FOR ALL ENTRIES IN @lt_entityset
WHERE kunnr EQ @lt_entityset-branch.

IF sy-subrc EQ 0.
LOOP AT et_entityset ASSIGNING FIELD-SYMBOL(<fs_entityset>).
READ TABLE lt_sortl ASSIGNING FIELD-SYMBOL(<fs_sortl>) WITH KEY kunnr = <fs_entityset>-branch.
IF sy-subrc EQ 0.
<fs_entityset>-zztest1 = <fs_sortl>-sortl.
<fs_entityset>-ztest2 = <fs_sortl>-name1.
ENDIF.
ENDLOOP.

" Sorting Customer Division
IF lt_order IS INITIAL AND lt_order_tmp IS NOT INITIAL.
SORT et_entityset BY zztest1 ASCENDING.
ENDIF.
ENDIF.
ENDIF.
ENDIF.

Now the real issue: io_tech_request_context " Real ISSUE.

This paramter contains all the data and actions passed on by frontend FIORI. So , even after clearing IT_ORDER , sort takes places based on io_tech_request_context paramters data.

This is passed on to our method by standard runtime methods. I checked them.

If i could update this IO_TECH_REQUEST_CONTEXT , i think i will be able to manipulate sorting or filtering for custom fields.

1) HOW do i manipulate this object parameters? Need help with this.

else

2) How do i add FILTER/SORT functionality to the custom fields ZTEST1 & ZTEST2 added to items ?

0 Kudos

hi,

did you find the solution for this?

in my case, i see odata is getting the order by or sort by in IO_TECH_REQUEST_CONTEXT. it is not possible them at run time when my code runs to red the fields requested.

Regards,

Soumya

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185414
Active Contributor
0 Kudos

1. Since IO_TECH_REQUEST_CONTEXT is importing so you cannot manipulate.

2. Does the OData call have the orderby clause with custom fields ?

0 Kudos

Hi Ankit ,

Thanks for your response!

I do know it is an importing parameter which refers to an interface. On run time that parameter has all the parameters and values which is used further down to address the request made.

My point was to pass the parameter in local object, create the object.. manipulate that and pass it back.

But problem is methods in the interface doesn't have means to update the parameters that i know of.

Order by clause is there but it is also available there in io_tech_request_context which makes manioulating order by useless.

Thanks anyway!