SAP ABAP 中有关数据查询与计算问题

2025-01-07 04:35:48
推荐回答(4个)
回答1:

代码你自己都贴出来了...
建议:
SELECT
EKKO~BEDAT EKKO~EBELN EKPO~EBELP EKPO~AFNAM EKPO~MENGE EKPO~MEINS EKET~EINDT MAKT~MATNR MAKT~MAKTX LFA1~ LIFNR
LFA1~ NAME1
INTO CORRESPONDING FIELDS OF TABLE ITAB
From LFAL inner join EKKO on LFAL~LIFNR = EKKO~LIFNR
Inner join EKET on EKKO ~EBELN = EKET ~EBELN
Inner join EKPO on EKET~EBELN = EKPO~EBELN
AND EKET~EBELP = EKPO~EBELP
inner join MARK on EKKO~MATNR = MARK ~ MATNR.
Where LFA1~ NAME1in NAME1 .
"这里已经取出订单数量了.LOOP去查交货数量就好了.
LOOP AT ITAB.
Select EKBE-SHKZG EKBE-MENGE EKBE-VGABE from EKBE
INTO CORRESPONDING FIELDS OF TABLE WA_EKBE
From LFAL inner join EKKO on LFAL~LIFNR = EKKO~LIFNR
Inner join EKET on EKKO ~EBELN = EKET ~EBELN
Inner join EKBE on EKET~EBELN = EKBE~EBELN
AND EKET~EBELP = EKBE~EBELP
Where LFA1~ NAME1in NAME1
AND EKET~EBELN = ITAB-EBELN
AND EKET~EBELP = ITAB-EBELP .
LOOP AT WA_EKBE.
If WA_EKBE-SHKZG = S.
WA_EKBE -MENGE = WA_EKBE -MENGE.
Else.
WA_EKBE -MENGE = WA_EKBE -MENGE * -1.
Endif.
交货数量ITAB = 交货数量ITAB + WA_EKBE -MENGE.
ENDLOOP.
"汇总
If EKBE-VGABE=1.
Collect itab.
endif.

ENDLOOP.

未经测试!!!

回答2:

本来需要做一个PO统计,正好兄台给了解释,多谢多谢,很详细,很需要!

回答3:

你不是都写清楚了吗? 还想知道什么?

回答4:

adasdasd