Code: Alles auswählen.
select sum( EKET~WEMNG )
from eket inner join ekpo
on eket~ebeln = ekpo~ebeln
and eket~EBELP = ekpo~EBELP
inner join ekko
on eket~ebeln = ekko~ebeln
where ekko~lifnr eq s098-lifnum
AND eket~EINDT BETWEEN Datum1 AND Datum2
AND ekpo~matnr eq matnr
AND ekpo~MEINS EQ 'ST'.
Code: Alles auswählen.
SELECT eket~wemng eket~meins
FROM eket INNER JOIN ekpo
on eket~ebeln = ekpo~ebeln
AND eket~EBELP = ekpo~EBELP
INNER JOIN ekko
on eket~ebeln = ekko~ebeln
INTO (lv_wemng_count, lv_meins_count)
WHERE ekko~lifnr EQ s098-lifnum
AND eket~EINDT BETWEEN Datum1 AND Datum2
AND ekpo~matnr EQ matnr
AND ekpo~MEINS EQ 'ST'.
lv_wemng = lv_wemng + lv_wemng_count.
IF lv_meins IS INITIAL.
lv_meins = lv_meins_count.
ENDIF.
ENDSELECT.