Skip to Content
0
Jun 21, 2017 at 04:35 PM

VALUE iterator for range, get low and high?

101 Views

Trying to use VALUE iterator to create a table from a range of type vbeln. When option = 'BT', how can I add the low AND high values to the expression? The below code gets the low, and I tried using COND inside the VALUE to act on 'BT', but there I'm still only able to pass one argument, so I can't get the high value. Any help is appreciated!

DATA: lrt_so TYPE RANGE OF vbak-vbeln,
      lr_so LIKE LINE OF lrt_so.
SELECT-OPTIONS o_so FOR lr_so.
---
  TYPES: BEGIN OF ty_result,
           so       TYPE vbak-vbeln,
           shipment TYPE vttk-tknum,
           invoice  TYPE vbrk-vbeln,
         END OF ty_result,
         ty_results_t TYPE TABLE OF ty_result WITH DEFAULT KEY.
---
DATA(lt_results) = VALUE ty_results_t(
  FOR ls_so IN o_so
  ( so = COND vbeln(
    WHEN ls_so-option = 'EQ' THEN ls_so-low
    ELSE ls_so-high )
  )
).