How can I sum rows in ABAP using alv report?
sum=gross_weight + net_weight
it creates a new column sum which is the sum of two rows. I have tried using:
wa-fieldname = 'IT_NET_WEIGHT'.
wa-seltext_s = 'Qun'.
wa-ddic_outputlen = '10'.
APPEND wa TO fcat.
wa-fieldname = 'WA_GROSS_WEIGHT'.
wa-seltext_s = 'Qun'.
wa-ddic_outputlen = '10'.
APPEND wa TO fcat.
* Calculate Total for Price
wa-fieldname = 'TOTALS'.
wa-cfieldname = 'WAERK'.
wa-seltext_s = 'Qun'.
wa-do_sum = 'X'.
DO_SUM
is intended to enable a totals line below the entire table. If you want to have a column that contains the sums, you will have to add this to the data table you're displaying - this is not something the ALV will do for you.
You should expand your internal table with "sum" column. ie
LOOP AT itab.
itab-sum = itab-gross_weight + itab-net_weight.
MODIFY itab.
ENDLOOP.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.