Hello All,
I am having a internal table with fields vbeln (1st field) and matnr(2nd field). which are sorted by
vbeln and matnr. Now there is a fresh requirement that i have to display a total on change on matnr.
How can i do it in the same loop 😔 i am restricted to use another loop for it?.
Is there any way?
Thanks
SDN
data: xtab like line of itab. loop at itab. xtab = itab. total = total + xtab-kwmeng. at end of matnr. Write:/ total. clear total. endat. endloop.
Regards,
Rich Heilman
---If not wrong you wish to have the total on material and not document+material ..correct ---in that case
please note AT Event wont work for MATNR since you have the first field in your table as VBELN. So even if the Matnr is same but different VBELN...the at event would be triggered.
The only way is to SORT the table with MATNR and VBELN.
and use the on change event...as shown below. Unfortunately you would need a separate loop.
sort itab by matnr vbeln.
loop at itab.
l_sum = l_sum + qty.
on change of matnr.
write : / l_sum.
clear l_sum.
endon.
endloop.
Message was edited by: Anurag Bankley
Add a comment