SAP ABAP 里用select 从三个相关联的表同时取数到一个TABLE里怎么写。
4个回答
展开全部
"定义内表:gt_data
data:begin of wa_data,
werks type afpo-werks,
aufnr type afpo-aufnr,
vornr type afru-vornr,
auart type aufk-auart,
end of wa_data,
gt_data like table of wa_data.
SELECT A~dwerk as werks
a~aufnr "工单号码
b~vornr "作业
c~auart "订单类型
FROM afpo as a
INNER JOIN afru as b ON a~aufnr = b~aufnr
inner join AUFK as c on a~aufnr = c~aufnr
INTO CORRESPONDING FIELDS OF TABLE gt_data
WHERE a~dwerk = '工厂' .
data:begin of wa_data,
werks type afpo-werks,
aufnr type afpo-aufnr,
vornr type afru-vornr,
auart type aufk-auart,
end of wa_data,
gt_data like table of wa_data.
SELECT A~dwerk as werks
a~aufnr "工单号码
b~vornr "作业
c~auart "订单类型
FROM afpo as a
INNER JOIN afru as b ON a~aufnr = b~aufnr
inner join AUFK as c on a~aufnr = c~aufnr
INTO CORRESPONDING FIELDS OF TABLE gt_data
WHERE a~dwerk = '工厂' .
展开全部
首先定义一个内表
DATA: BEGIN OF GWA_OUT,
MATNR LIKE MARA-MATNR,
WERKS LIKE MARC-WERKS,
LABST LIKE MARD-LABST,
END OF GWA_OUT.
DATA: GT_OUT LIKE TABLE OF GWA_OUT.
现在我从MARA里面取物料号从MARC里面取工厂从MRAD里面取库存
select a~matnr c~werks d~labst
into table gt_out
form mara as a
inner join marc as c on a~matnr = c~matnr
inner join mard as d on c-matnr = d~matnr
and c~werks = d~werks
where a~matnr = p_matnr
DATA: BEGIN OF GWA_OUT,
MATNR LIKE MARA-MATNR,
WERKS LIKE MARC-WERKS,
LABST LIKE MARD-LABST,
END OF GWA_OUT.
DATA: GT_OUT LIKE TABLE OF GWA_OUT.
现在我从MARA里面取物料号从MARC里面取工厂从MRAD里面取库存
select a~matnr c~werks d~labst
into table gt_out
form mara as a
inner join marc as c on a~matnr = c~matnr
inner join mard as d on c-matnr = d~matnr
and c~werks = d~werks
where a~matnr = p_matnr
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
data:begin of wa_data,
werks type afpo-werks,
aufnr type afpo-aufnr,
vornr type afru-vornr,
auart type aufk-auart,
end of wa_data,
gt_data like table of wa_data.
SELECT A~dwerk as werks
a~aufnr "工单号码
b~vornr "作业
c~auart "订单类型
FROM afpo as a
INNER JOIN afru as b ON a~aufnr = b~aufnr
inner join AUFK as c on a~aufnr = c~aufnr
INTO CORRESPONDING FIELDS OF TABLE gt_data
WHERE a~dwerk = '工厂' .
werks type afpo-werks,
aufnr type afpo-aufnr,
vornr type afru-vornr,
auart type aufk-auart,
end of wa_data,
gt_data like table of wa_data.
SELECT A~dwerk as werks
a~aufnr "工单号码
b~vornr "作业
c~auart "订单类型
FROM afpo as a
INNER JOIN afru as b ON a~aufnr = b~aufnr
inner join AUFK as c on a~aufnr = c~aufnr
INTO CORRESPONDING FIELDS OF TABLE gt_data
WHERE a~dwerk = '工厂' .
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询