cancel
Showing results for 
Search instead for 
Did you mean: 

variable iv_filter_string with wrong brackets

Former Member
0 Kudos

Hi, in our UI5 apps with ODATA Services we have complicated search strings with or. We know we have to handle them in our code and will not get select options. But the variable iv_filter_string has not the format I expected. Sample with Service CB_GL_ACCOUNT_DP Request in gateway client /sap/opu/odata/sap/CB_GL_ACCOUNT_SRV/GLAccounts?$filter=substringof('11',GLAccountName) or substringof('11',GLAccount) Breakpoint in  Method at the first statement METHOD /iwbep/if_mgw_appl_srv_runtime~get_entityset. Value of variable iv_filter_string, when You run the url ( ( substringof ( '11' , GLAccountName ) or ( substringof ( '11' , GLAccount ) ) First there are more brackets than given in the url. Second the brackets are wrong. The expression will not work. There are solutions with deleting all brackets, but I don't want to parse the string. I only want to replace for instance substring() with like. Has anyone else this problem? Thanks for Your help. Greetings Kerstin

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello Kerstin,

Try to call io_tech_request_context( )->get_filter( )->get_filter_string( ) method.

You can also obtain complete range with use of method io_tech_request_context( )->get_filter( )->get_filter_select_options( ) for select or etc.

Former Member
0 Kudos

Seems to be a good tip.

In io_tech_request_context the string looks like this

( ( TXT20 like '%11%' ) or ( SAKNR like '%11%' ) )

Let me try this in my app. I will post the results.

Thanks a lot Sergey

Former Member
0 Kudos

Hi Sergey,

this was the right solution for my problem. The string in io_tech_request_context->get_filter( )->get_filter_string( ) is correct although there are a lot more brackets. The filter functions like substring are already converted.

I can work with that.

Thanks again an greetings

Kerstin

Answers (1)

Answers (1)

Former Member
0 Kudos

Sorry, the format of my message changes completely:

Hi,

in our UI5 apps with ODATA Services we have complicated search strings with or.

We know we have to handle them in our code and will not get select options. But the variable iv_filter_string has not the format I expected.

Sample with Service CB_GL_ACCOUNT_DP

Request in gateway client

/sap/opu/odata/sap/CB_GL_ACCOUNT_SRV/GLAccounts?$filter=substringof('11',GLAccountName) or substringof('11',GLAccount)

Breakpoint in  Method at the first statement

METHOD /iwbep/if_mgw_appl_srv_runtime~get_entityset.

Value of variable iv_filter_string, when You run the url

( ( substringof ( '11' , GLAccountName ) or ( substringof ( '11' , GLAccount ) )

First there are more brackets than given in the url. Second the brackets are wrong. The expression will not work.

There are solutions with deleting all brackets, but I don't want to parse the string.

I only want to replace for instance substring() with like.

Has anyone else this problem?

Thanks for Your help.

Greetings Kerstin

AshwinDutt
Active Contributor
0 Kudos

Hello Kerstin,

Based on the URL shared, according to me, you have to send the filters with AND operator considering you are performing pattern search based on 2 different parameters GLAccountName & GLAccount

Check as below ->

/sap/opu/odata/sap/CB_GL_ACCOUNT_SRV/GLAccounts?$filter=substringof('11',GLAccountName) and substringof('11',GLAccount)


You will receive all the information inside it_filter_select_options


Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin,

thanks a lot for Your answer.

We don't want to use AND. Actually we need OR.

We want to search different fields with one search string and combine it with or.

So I need the variable iv_filter_string with the same string I put to the option $filter.

But this varable is wrong with to much brackets that doesn't match.

Greetings

Kerstin

AshwinDutt
Active Contributor
0 Kudos

As far as i know this is how i have seen filters coming as part of iv_filter_string