How to filter in odata and how to get fileter values in odata
Filter in OData some time requirement to fetch multi pal records behalf of condition
so here solution to get multiple records behalf of the condition and helping a lot to get detail so happy to share the peace of code you and get a basic idea about how to get multiple records behalf of condition
DATA : lt_filter TYPE /iwbep/t_mgw_select_option,
ls_filter TYPE /iwbep/s_mgw_select_option,
ls_so TYPE /iwbep/s_cod_select_option.
****** Filter
lt_filter = io_tech_request_context->get_filter( )->get_filter_select_options( ).
LOOP AT lt_filter INTO ls_filter.
CASE ls_filter-property.
a simple method to go for a filter with help of filter you get your values as per the requirements
DATA: lt_filter TYPE /iwbep/t_mgw_select_option,
ls_filter TYPE /iwbep/s_mgw_select_option,
ls_so TYPE /iwbep/s_cod_select_option.
**** Filter
lt_filter = io_tech_request_context->get_filter( )->get_filter_select_options( ).
LOOP AT lt_filter INTO ls_filter.
CASE ls_filter-property.
WHEN 'ZRKNAME1'.
LOOP AT ls_filter-select_options INTO ls_so.
MOVE-CORRESPONDING ls_so TO rs_zzrkinfo.
APPEND rs_zrkinfo TO rt_zzrkinfo.
ENDLOOP.
WHEN 'ZRKNAMETYP'.
LOOP AT ls_filter-select_options INTO ls_so.
MOVE-CORRESPONDING ls_so TO rs_zrkinfo.
APPEND rs_zrkinfo TO rt_zzrkinfo.
ENDLOOP.
WHEN 'MATNR'.
LOOP AT ls_filter-select_options INTO ls_so.
MOVE-CORRESPONDING ls_so TO rs_matnr.
APPEND rs_matnr TO rt_matnr.
ENDLOOP.
WHEN 'ERDAT'.
LOOP AT ls_filter-select_options INTO ls_so.
MOVE-CORRESPONDING ls_so TO rs_erdat.
APPEND rs_erdat TO rt_erdat.
ENDLOOP.
ENDCASE.
ENDLOOP.
Comments
Post a Comment