Convert a selection range table to the alpha numbers for later queries

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:

Signature for the method convert_gpart.
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).


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ad blocker detected

We have detected that you are using extensions to block ads. Please support us by disabling your ad blocker.

Powered By
100% Free SEO Tools - Tool Kits PRO