In AT NEW and AT END OF event blocks SUM statement finds all the rows within the control level and calculates the totals of numeric fields that are right to the control level and places the totals in the corresponding fields of work area.
*————————————————————–* *Data Declaration *————————————————————–*
DATA: gwa_spfli TYPE spfli. DATA: gt_spfli TYPE TABLE OF spfli. SELECT * UP TO 5 ROWS FROM spfli INTO TABLE gt_spfli. LOOP AT gt_spfli INTO gwa_spfli. AT FIRST. WRITE:/ 'Flight Details'. WRITE:/ 'Airline Code' COLOR 5,14 'Connection No.' COLOR 5, 29 'Departure City' COLOR 5, 44 'Arival City' COLOR 5, 58 'Distance' COLOR 5. ULINE. ENDAT. AT NEW carrid. WRITE:/ gwa_spfli-carrid, ' : New Airline'. ULINE. ENDAT. WRITE:/14 gwa_spfli-connid,29 gwa_spfli-cityfrom, 44 gwa_spfli-cityto,58 gwa_spfli-distance. AT END OF carrid. ULINE.SUM.
WRITE:/ gwa_spfli-carrid,58 gwa_spfli-distance. ULINE. ENDAT. AT LAST.SUM.
WRITE:/ 'Total',58 gwa_spfli-distance. WRITE:/ 'End of Loop'. ENDAT. ENDLOOP.
Serkan AKKAVAK Computer Engineer ABAP Developer & SAP S/4 HANA Logistics Consultant Contact : serkurumsal@yandex.com
Social Plugin