Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

VALUE iterator for range, get low and high?

0 Likes
1,112

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 )
  )
).
1 ACCEPTED SOLUTION
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
983

Another VALUE operator behind ELSE to construct what you want there? Or a LET expression at an appropriate position.

Not easy to answer, since it is not clear what you want to achieve, but I´m sure it´s possible. Think how you would do it with statements and translate to nested expressions.

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 )
  )
).
1 REPLY 1
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
984

Another VALUE operator behind ELSE to construct what you want there? Or a LET expression at an appropriate position.

Not easy to answer, since it is not clear what you want to achieve, but I´m sure it´s possible. Think how you would do it with statements and translate to nested expressions.