Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

report

Former Member
0 Likes
392

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.

2 REPLIES 2
Read only

Former Member
0 Likes
373

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.

Read only

Former Member
0 Likes
373

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