我找到了这个用于填充范围表的代码(源代码已经离线(:
DATA lr_vkorg TYPE RANGE OF vkorg.
TYPES: lr_range_t TYPE RANGE OF vkorg.
lr_vkorg = VALUE lr_range_t(
LET s = 'I'
o = 'EQ'
IN sign = s
option = o
( low = '1100' )
( low = '1200' )
( low = '1300' )
( low = '1400' )
( low = '1500' )
).
但与其做这样的事情:
( low = '1' )
( low = '2' )
...
我想用内部表的值填充它['1', '2', ...]
.
有人知道如何做到这一点吗?
更新:这是我根据答案这样做的:
DATA:
lt_itab TYPE TABLE OF string,
lt_range_itab TYPE RANGE OF string
.
APPEND '1' TO lt_itab.
APPEND '2' TO lt_itab.
APPEND '3' TO lt_itab.
APPEND '4' TO lt_itab.
lt_range_itab = VALUE #(
FOR <ls_itab> IN lt_itab
( sign = 'I'
option = 'EQ'
low = <ls_itab> )
).
您可以使用声明的结构声明宏,如下所示:
DEFINE range.
lr_vkorg = VALUE lr_range_t( BASE lr_vkorg ( sign = 'I' option = 'EQ' low = &1 ) ).
END-OF-DEFINITION.
然后用这句单行词填充您的范围:
range: '1100', '1200', '1300', '1400', '1500', '1600'.
如果我们谈论 itab 的填充范围,请使用以下语句:
lr_vkorg = VALUE #( FOR ls_vkorg IN gt_vkorg
( sign = 'I'
option = 'EQ'
low = ls_vkorg-vkorg )
).
lr_vkorg = VALUE # ( sign = 'I' option = 'EQ' ( low = '1100' ) ( low = '1200' )
( low = '1300' ) ( low = '1400' ) ( low = '1500' ) ).