Code: Alles auswählen.
types: begin of tp_data,
vbeln like vbak-vbeln,
vkorg like vbak-vkorg,
auart like vbak-auart,
erdat like vbak-erdat,
kunnr like kna1-kunnr,
name1 like kna1-name1,
zmeng like vbap-kwmeng,
end of tp_data,
data: it_data type standard table of tp_data.
data: t_heading type slis_t_listheader.
DATA: it_bapisdstat LIKE STANDARD TABLE OF bapisdstat,
wa_bapisdstat type bapisdstat.
DATA: wa_bapireturn TYPE bapireturn,
FIELD-SYMBOLS: <wa_data> like line of IT_data.
SELECT e~vbeln
e~vkorg
e~auart
e~erdat
l~kunnr
l~name1
INTO CORRESPONDING FIELDS OF TABLE it_data
FROM vbak as e
inner join kna1 as l on e~kunnr = l~kunnr
WHERE e~vbeln in s_vbeln
AND e~vkorg in s_vkorg
AND e~erdat in s_erdat
LOOP AT it_data assigning <wa_data>.
clear wa_bapisdstat.
CALL FUNCTION 'BAPI_SALESORDER_GETSTATUS'
EXPORTING
salesdocument = <wa_data>-vbeln
IMPORTING
return = wa_bapireturn
TABLES
statusinfo = it_bapisdstat.
Loop at it_bapisdstat into wa_bapisdstat.
AT LAST.
SUM.
endloop.
<wa_data>-zmeng = wa_bapisdstat-dlv_qty.
ENDLOOP.
Code: Alles auswählen.
SORT it_fb_daten by MATNR.
LOOP AT it_fb_daten INTO wa_fb_daten.
AT END OF matnr.
SUM.
-> hier hast du jetzt die Summe je Material in wa_fb_daten-auftragsmenge stehen und kannst damit was machen
ENDLOOP.