09-14-2008 11:29 AM
hi experts
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
thanks
amit
09-14-2008 11:44 AM
Hi Amit,
I'm not sure if I understand "attributes" correctly.
But did you try to use command "at new <field>" and in this block do the summation?
Otherwise please provide the code ...
Regards,
Karol
09-14-2008 11:44 AM
Hi Amit,
I'm not sure if I understand "attributes" correctly.
But did you try to use command "at new <field>" and in this block do the summation?
Otherwise please provide the code ...
Regards,
Karol
09-14-2008 11:50 AM
here is the code attached:
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 lifnr .
at END OF grund.
SUM.
ENDAT.
ENDAT.
ENDLOOP.
i want to summary according those two attributes but the command doesn't work
thanks
amit
09-14-2008 12:05 PM
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