on 06-24-2021 8:51 PM
Hello Colleagues,
I am trying to implement an API call with the below URI :
$filter=substringof('ABC',FirstName) and substringof('XYZ',LastName) and (substringof('DEF',FirstName) or substringof('STW',LastName))
I am aware that IO_TECH_REQUEST_CONTEXT->GET_FILTER( )->GET_FILTER_SELECT_OPTIONS( ) would be empty.
Only parameters that I am receiving being filled are IO_TECH_REQUEST_CONTEXT->GET_REQUEST_HEADERS( ) and IO_TECH_REQUEST_CONTEXT->GET_FILTER_EXPRESSION_TREE( ).
I followed this blog by Andre(Option1) as well. But I would like to know is there any other way to fetch the filter parameters.
I am left with the option to scan the request headers but want to seek advice on any other solution if available.
Regards,
Subhajit
Hi Subhajit,
not sure why you want this.
But there would be a way to retrieve the filter string as an osql where clause
data(osql_where_clause) = io_tech_request_context->get_osql_where_clause( ).
I tested it with the following request
/sap/opu/odata/sap/ZSALESORDER_SRV/SalesOrderSet?$filter=substringof('ABC',Salesorder)
and substringof('XYZ',Customer) and (substringof('DEF',Salesorder) or
substringof('STW',Customer))
<br>
and got the following value for osql_where_clause.
( ( SALESORDER LIKE '%ABC%' AND CUSTOMER LIKE
'%XYZ%' ) AND ( SALESORDER LIKE '%DEF%' OR CUSTOMER LIKE '%STW%' ) )<br>
Please note, there is also the method
io_tech_request_context->get_osql_where_clause_convert( )
available that would deliver the filter values after having applied conversion exits.
What you could also do is the following.
1. Read all data from the backend without applying the filter condition that stems from substringof
2. Apply osql_where_clause to the resultset et_entityset before returning it.
But this would only work in systems later than SAP NetWeaver 752 where Open SQL can be applied on internal tables.
This way you wouldn't have to parse the osql_where_clause but the resultset might become to big.
Kind regards,
Andre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andre,
Thanks for the prompt response and apologize for the delay in counter response.
Though its strange as I tried :
get_osql_where_clause( ) , get_osql_where_clause_convert( ), get_osql_with_placeholders(), get_search_string( ), get_request_headers( ), get_filter( ), get_filter_expression_tree( ),get_filter_expression_tree_con( )
But somehow I could only get Headers and Filter_expression_tree
I will try it one more time by rechecking with the URI and respond back.
Regards,
Subhajit
Thanks Andre as usual and apology for the delayed response.
That actually worked.
Had to customize my query a bit to fit it into the belt.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.