on 04-19-2018 10:41 AM
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
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.nitschke 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi andre.fischer,
Lets say io_tech_request_context->GET_OSQL_WHERE_CLAUSE_CONVERT( ) has WHERE clause on 2 or more fields that needs to be applied on 2 different SELECT queries?
Do we have to write custom logic as shown in the below blog.
https://blogs.sap.com/2012/12/29/gateway-odata-calls-convert-ivfilterstring-to-itfilterselectoptions/
Please provide your feedback.
io_tech_request_context->GET_OSQL_WHERE_CLAUSE_CONVERT( ) always only returns the SQL String that fits to the OData entityset.
How to map this to "real" SQL Queries or calls to backend API's is part of the work of the developer.
But if you are able to perform 2 SELECT queries I am wondering whether you wouldn't be able to map this to an CDS view.
In this case the framework would perform all the heavy lifting for you.
For any more detailed question please post the same in the Q&A section.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.