cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hello,

I map Query to a function module that has range table as input parameter (method GetEntitySet is generated). Here is example of my call is I use filter=Material eq '51' or Material eq '52' or Material eq '35'

Generated code looks like this:

* Maps filter table lines to function module parameters
LOOP AT lt_filter_select_options INTO ls_filter.

LOOP AT ls_filter-select_options INTO ls_filter_range.
CASE ls_filter-property.
WHEN 'MATERIAL'. " Equivalent to 'Material' property in the service
lo_filter->convert_select_option(
EXPORTING
is_select_option = ls_filter
IMPORTING
et_select_option = lr_material ).

LOOP AT lr_material INTO ls_material.
ls_it_material-high = ls_material-high.
ls_it_material-low = ls_material-low.
ls_it_material-option = ls_material-option.
ls_it_material-sign = ls_material-sign.
APPEND ls_it_material TO it_material.
ENDLOOP.

Table IT_MATERIAL ends up with 9 entries (3 sets of same 3 materials) because it loops on the second loop three times since I have 3 materials and each time, adds three materials.

I know I can redefine method and delete duplicate entries but it seems like SAP should know NOT to do this. Is there a standard way of preventing this from happening?

Thanks in advance,

Natasha

0 Likes
View Entire Topic
natasha_baunach
Explorer
0 Likes

Correct that COLLECT will work but this is SAP generated code when you do mapping of FM from the model. One would need to redefine the method to adjust it and I am trying to avoid that.

Any suggestions if Gateway code could be generated differently?