Skip to Content
0

How to Parse IV_FILTER_STRING in GET_ENTITYSET

Apr 19 at 09:41 AM

71

avatar image

Hi Experts,

Can anyone advise me on how IV_FILTER_STRING is parsed to become select option format? I have been reading a lot but the solution is either unclear or obsolete (Class Missing). Appreciate if someone can help or point to the right direction.

Best Regards

Andre Julius

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Andre Fischer
Apr 20 at 09:01 AM
1

Hi Julius,

It might happen that the statement

 io_tech_request_context->get_filter()->get_filter_select_options().

doesn't return any result. Reason is that not all OData filter clauses can be converted into select options.

The inconsistency in the API you observed has historical reasons. That's why we introduced the use of the io_tech_request_context object.

You should not use the parameters IV_FILTER and so on because they do not support conversion.

With io_tech_request_context you have for example the option to use

io_tech_request_context->GET_OSQL_WHERE_CLAUSE_CONVERT( )

For select options the handling of conversions is a little bit trickier but explained very comprehensively in Thomas Nitschkes blog

https://blogs.sap.com/2017/01/23/conversions-in-sap-gateway-foundation-part-2/ where he explains how to use the method

CONVERT_SELECT_OPTION

Regards,

Andre

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Andre Fischer

Thanks for the detailed response, right now I am using lv_wstrg = lo_filtr->GET_FILTER_STRING( )

where they return me the where condition in ABAP-field name convention, I hope it works out of the box all the time :D


Best Regards


Andre Julius

0
Ralf Handl
Apr 19 at 12:08 PM
0
  io_tech_request_context->get_filter( )->get_filter_select_options( ).
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Ralf Handl ,

Thanks for the direction. I've tried that but the result is empty.

  io_tech_request_context->get_filter()

This code above returns me something though. It contains the where condition in MV_FILTER_STRING and select options in MT_SIMPLE_PROPERTY instead of MT_FILTER_SELECT_OPTIONS (which is why GET_FILTER returns blank I guess)


I wonder why....can you advise?

Best Regards

Andre Julius

0

If I use lv_wstrg = lo_filtr->GET_FILTER_STRING( ) then I get the WHERE statement directly... what bothers me is the inconsistencies...if I use 1 parameter, it's in IT_FILTER_SELECT_OPTIONS. else it's in where string...is it supposed to be like this?

0