- 建一个结构:
TYPES :BEGIN OF tys_t001,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
END OF tys_t001.
- 建一个工作区:
DATA :BEGIN OF ty_t001,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
END OF ty_t001.
根据结构创建用TYPE
,根据工作区创建用LIKE
- 将数据传给工作区:
SELECT SINGLE
t001~bukrs
t001~butxt
INTO CORRESPONDING FIELDS OF ty_t001
FROM t001
WHERE bukrs = p_bukrs.
工作区只能存储一条值,用SINGLE
取出一条值
- 将内表值完全复制给另一个内表:
APPEND LINES OF gt_t001 TO gt_t002.
GT_T001,GT_T002
为两个结构相同的内表
Select到内表的值需要通过Loop循环传递值。
- 求和
LOOP AT GT_ANEP INTO GS_ANEP.
GS_ANEP-GJAHR = ''.
GS_ANEP-LNRAN = ''.
GS_ANEP-BUKRS = ''.
COLLECT GS_ANEP INTO GT_ANEP3.
ENDLOOP.
COLLECT 将除金额字段其他字段一致的汇总
网友评论