在ABAP开发中,对于不能使用join的聚集表或者需要使用SELECT 的内表,我们一般使用for all entries in 语句将该表与内表串联,查询出需要的数据,例如
TYPES: BEGIN OF t_asnum,
asnum LIKE asmd-asnum,
END OF t_asnum.
DATA:gt_asnum TYPE TABLE OF t_asnum.
CLEAR: g_matkl,gt_asnum.
SELECT SINGLE matkl FROM zmm_ys_jsdlx INTO g_matkl WHERE jsdlx = g_jsdlx1.
SELECT asnum FROM asmd INTO TABLE gt_asnum WHERE matkl = g_matkl.
SELECT *
FROM zmm_ys_yw
INTO TABLE gt_order
FOR ALL ENTRIES IN gt_asnum
WHERE asnum = gt_asnum-asnum.
这样查询条件就是 asnum字段的值存在于内表gt_asnum的asnum字段值中
时间: 2024-11-14 01:48:13