‎2008 Apr 15 4:37 PM
Hi friends
My senario is
there is 3 line item for a invoice no.
I want to calculate total no of box of 3 line item of invoice no.
i have use this code.
MOVE I_VBTAB-VBELN TO INV_NO.
IF INV_NO = I_VBTAB-VBELN.
.
TBOX = TBOX + I_VBTAB-BOX_NO.
ELSE.
CLEAR TBOX.
ENDIF.
but its is not showing total no of lineitem box of invoiceno.
it is add all boxs of other invoice.
‎2008 Apr 15 4:57 PM
hi adaper
remove the else statement from your code.
b'coz there is no need to clear the tbox otherwise it will flush the previous total of the number of boxes.
MOVE I_VBTAB-VBELN TO INV_NO.
IF INV_NO = I_VBTAB-VBELN.
.
TBOX = TBOX + I_VBTAB-BOX_NO.
ENDIF.
‎2008 Apr 15 9:56 PM
Hi,
for your requirement its better to use internal table event at new.
in your internal table you have headeritem and lineitem.each header item will have multiple lineitems.so you want to sum the line items box number for each header item.
so let us suppose that the header field is denoted by 'h' in your internal table and the box field is denoted by 'b'.first make sure that the box field is before header field in the internal table.now use the following code.
loop at itab.
at new headerfield.
sum box.
endat.
endloop.
it will definitely work.but if your not clear about internal table events your code is good.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 15, 2008 5:00 PM