i am running a loop on a table and i want to use the command sum but my process block is defined by to attributes.
how can i do this
Karol Seman replied
SORT i_data by lifnr grund. LOOP at i_data INTO wa_data. if i_data-shkzg = 'H'. i_data-erfmg = i_data-erfmg * -1. modify i_data. ENDIF. AT END OF grund. SUM. WRITE: / wa_data-lifnr, wa_data-grund. ENDAT. ENDLOOP.
the table is already sorted by lifnr and grund so you don't need nested "AT"
sum supports types I , F and P, make sure you have this data type there