Skip to Content
0
Former Member
Feb 06, 2009 at 07:40 AM

logic help regarding internal table operation

10 Views

hi please help me how to write the logic .

i had belew data in one internal table .

vbeln item netvalue tax grand total outstanding amt

5260002779 10 0 0 0 60888.28

5260002779 11 54454.73 2178.19 56632.97 60888.28

5260002779 20 0 0 0 60888.28

5260002779 21 42836.34 1713.45 44549.79 60888.28

5260002779 30 0 0 0 60888.28

5260002779 31 19801.73 792.07 20593.8 60888.28

LOOP AT IT_MAT INTO WA_MAT.

WA_MAT1-VBELN = WA_MAT-VBELN.

WA_MAT1-POSNR = WA_MAT-POSNR.

WA_MAT1-MATNR = WA_MAT-MATNR.

WA_MAT1-MATKL = WA_MAT-MATKL.

WA_MAT1-NETWR = WA_MAT-NETWR.

WA_MAT1-MWSBP = WA_MAT-MWSBP.

WA_MAT1-OUTAMT = WA_MAT-OUTAMT.

WA_MAT1-OUTAMT1 = WA_MAT-OUTAMT1.

WA_MAT1-KDGRP = WA_MAT-KDGRP.

WA_MAT1-KTEXT = WA_MAT-KTEXT.

WA_MAT1-KUNNR = WA_MAT-KUNNR.

WA_MAT1-NAME1 = WA_MAT-NAME1.

WA_MAT1-ORT01 = WA_MAT-ORT01.

WA_MAT1-TSO = WA_MAT-TSO.

WA_MAT1-VNAMC = WA_MAT-VNAMC.

WA_MAT1-BELNR = WA_MAT-BELNR.

WA_MAT1-POSTD = WA_MAT-POSTD.

WA_MAT1-BLART = WA_MAT-BLART.

WA_MAT1-BLDAT = WA_MAT-BLDAT.

WA_MAT1-REFER = WA_MAT-REFER.

WA_MAT1-SCHEM = WA_MAT-SCHEM.

WA_MAT1-VTEXT = WA_MAT-VTEXT.

WA_MAT1-ZTERM = WA_MAT-ZTERM.

APPEND WA_MAT1 TO IT_MAT1.

CLEAR WA_MAT.

ENDLOOP.

I want to display the invoice items ( first in first out ) by comparing each time grand total with my outstanding amt .

in this case i need to display first 4 items ( upto which grand total sum is less than my outstanding amt ).

the 4th item grand total should be replaced with 4255.31 in place of 44549.79.

and delete last two items.

please provide sample code how to proceed.

Thanks & regards,

Hari priya