Kamil
Kamil

Reputation: 433

Delete filters from Fiori ABAP backend

I tried to delete line from it_filter_select_options but don't know how. Is there any method to do that?

My URI passes the value in filter but sometimes in some specific conditions I don't want to filter with it, but at the same time I want to filter with others values.

if foo = 'xyz'.

  delete it_filter_select_options where property = 'foo'.

  call method /iwbep/cl_mgw_data_util=>filtering
    exporting
      it_select_options = it_filter_select_options
    changing
      ct_data = et_entityset.
endif.

gives this syntax error at line delete it_filter_select_options where property = 'foo'.:

field can't be changed

Upvotes: 1

Views: 1548

Answers (2)

butcher211
butcher211

Reputation: 1

  1. Please use io_tech_request_context->get_filter( )->get_filter_select_options( ).

  2. Uncheck the filter checkbox for the fields you don't want to be able to filter. (see Transaction SEGW, double-click your relevant OData entity)

  3. Don't evaluate the filters you don't want in the situations you mean programmatically.

Upvotes: 0

Jan Schulz
Jan Schulz

Reputation: 610

IMPORTING defines input parameters. When the method is called, an appropriate actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which pass-by-reference is defined cannot be changed in the method.[1]

Save the filter select options in an local table.

Data(lt_select_options) = io_tech_request_context->get_filter( )->get_filter_select_options( ).

Now you can modify the lt_select_options.

if foo = 'xyz'
"delete lt_select_options[ property = 'foo' ]-select_options[ sign = 'I' ].
delete it_select_options where property = 'foo'.
call method /iwbep/cl_mgw_data_util=>filtering
  exporting
   it_select_options = lt_select_options
  changing
   ct_data = et_entityset.
endif.

Upvotes: 1

Related Questions