Skip to Content

How to Parse IV_FILTER_STRING in GET_ENTITYSET

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 20 at 09:01 AM

    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

    Add comment
    10|10000 characters needed 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

  • Apr 19 at 12:08 PM
      io_tech_request_context->get_filter( )->get_filter_select_options( ).
    Add comment
    10|10000 characters needed characters exceeded

    • 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?