
The OData $filter system query option filters a subset of the entries from the collection that are addressed in the request URL. SAP NetWeaver Gateway provides filter APIs which can be used to query in the SAP backend. Filter expression tree is a tree representation of OData filter system query option provided in the request URI. A visitor interface /IWBEP/IF_MGW_EXPR_VISITOR has been provided to process the filter expression tree. You have the option to:
To get the filter expression tree, invoke the /IWBEP/IF_MGW_EXPR_NODE API in the GET_ENTITYSET method of the Data Provider class (DPC).
01.Data: lo_filter_tree TYPE REF TO /iwbep/if_mgw_expr_node. lo_filter_tree = io_tech_request_context->get_filter_expression_tree( ).
To get the Open SQL WHERE clause, use the code below in the GET_ENTITYSET method of the DPC of an OData service:
01.DATA: lv_osql_where_clause TYPE string. *----get Open SQL WHERE Clause from $filter-----* lv_osql_where_clause = io_tech_request_context->get_osql_where_clause( ).