If you have an OData service, where you fetching a data type, that has an alpha conversion routine active, you may have experienced also the problem, that you need to convert your select options to work properly with SQL queries.
To do that, we create a small private method in our gateway class. Before we hand over the results, we read from the IT_SELECT_OPTIONS import parameter the select options with the key, from which we want the internal table. This internal table or range must now be converted with our private method:
METHOD convert_gpart.
LOOP AT it_range ASSIGNING FIELD-SYMBOL(<fs_range>).
<fs_range>-low = |{ <fs_range>-low ALPHA = IN }|.
IF <fs_range>-high IS NOT INITIAL.
<fs_range>-high = |{ <fs_range>-high ALPHA = IN }|.
ENDIF.
ENDLOOP.
rt_range = it_range.
ENDMETHOD.
In the example above, we can see that the business partner gets converted, so that we later have the business partner number with leading zeros. And since it is a range table, we need to loop through every value, even for the interval values (low and high).
Leave a Reply