cancel
Showing results for 
Search instead for 
Did you mean: 

SUBSTRINGOF - How to read the value from OData?

Former Member
0 Kudos

Hi!

Actually I started to develop some OData services and I am facing the following problem:

I want to filter s.th. with "SUBSTRINGOF" but I do not see this filter

IT_FILTER_SELECT_OPTIONS, IV_FILTER_STRING or IV_SEARCH_STRING

Any way to receive this information in SAP Netweaver Gateway?

Best regards

Torsten

Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor
0 Kudos

Hi,

To be able to execute the substringof filter, the URI should be http://XXXXXXXXXXX/Z_DEMO_2_SRV/E1Set?$filter=substringof('Q',p1).  You can check the information in parameter  IV_FILTER_STRING  and IT_FILTER_SELECT_OPTIONS in method GET_ENTITYSET of your Data Provider Class. For the given example the content of   IT_FILTER_SELECT_OPTIONS  and IV_FILETER_STRING would be

   IV_FILTER_STRING  :---> ( substringof ( 'Q' , p1 )

   IT_FILTER_SELECT_OPTIONS

    |_ _ _ _ _ _PROPERTY :--> p1

    |_ _ _ _ _ _SELECT_OPTIONS :--->ICP*Q*

Hope this helps.

Atanu

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

a late answer, so you might have found a solution.

You can use the io_tech_request_context.

There more filter information is stored.

You could use this for example:

DATA lv_select_string TYPE string.

lv_select_string = io_tech_request_context->get_osql_where_clause( ).

Example: $filter=substringof('Apel', Name2) eq true

It returns: NAME_ORG2 LIKE '%Apel%'

Which you can use in your select statement.

Regards, Toine.