数据定义
1
|
DATA(l_bukrs) = '1000'. "定义+赋值,相当于CHAR4
|
结构赋值
CORRESPONDING 相当于 MOVE-CORRESPONDING
1
2
3
4
5
6
7
8
9
10
11
12
|
DATA:
BEGIN OF ls_data,
bukrs TYPE bukrs,
txtna TYPE txtna,
END OF ls_data,
BEGIN OF ls_data1,
zbukrs TYPE bukrs,
txtna TYPE txtna,
END OF ls_data1.
ls_data = CORRESPONDING #( ls_data1 MAPPING
bukrs = zbukrs " 公司代码映射,字段名不同
EXCEPT txtna " 排除txtna字段 ).
|
RANGE表赋值
1、可以一次追加多条
2、这里的BASE,表示基于,也就追加数据意思
1
2
3
4
5
|
DATA r_matnr TYPE RANGE OF matnr18.
r_matnr = VALUE #( BASE r_matnr
( sign = 'I' option = 'EQ' low = '80001000' )
( sign = 'I' option = 'EQ' low = '80002000' ) ) .
* 注意:
|
内表赋值
可以参照上面的RANGE表赋值,也可以用 APPEND 追加
1
2
|
DATA: lt_data TYPE TABLE OF t001t.
APPEND VALUE #( bukrs = '1000' ) TO lt_data.
|
去前导0
1
|
l_matnr = |{ l_matnr ALPHA = OUT }|.
|
加前导0
1
|
l_matnr = |{ l_matnr ALPHA = IN }|.
|