2006 Nov 20 2:26 PM
Hi All,
I have one internal table as below:
<b>I_TAB</b>.
<b>VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
QTY LIKE VBAP-KWMENG,
SUM LIKE VBAP-KWMENG,
</b>
Now i have filled in this internal table from select statement
Data is:
100, 10, 100
100, 10, 200
100, 10, 300
100, 20, 50
100, 30, 100
100, 30, 200
etc.
Now what i want is i want t calculate SUM field in above internal table based on VBELN & POSNR
Finally data should come as
100, 10, QTY, 600
100, 20, QTY, 50
100, 30, QTY, 300
(or)
we can update QTY with SUM of all VBELN/POSNR.
Can anybody tell me what is the logiic!
Thanks,
Deep.
2006 Nov 20 2:28 PM
Hi,
Declare on more table as ITAB, say JTAB.
Loop at ITAB.
JTAB-VBELN = ITAB-VBELN.
JTAB-POSNR = ITAB-POSNR.
JTAB-SUM = ITAB-QTY.
COLLECT JTAB
endloop.
JTAB will have ur required output, But u cant put QTY in between since, the Qunattity is Integer field u cant place 'QTY', since it is a char.
Sreedhar
Message was edited by:
Sreedhar Kanchanapalli
Hi All,
I have one internal table as below:
<b>I_TAB</b>.
<b>VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
QTY LIKE VBAP-KWMENG,
SUM LIKE VBAP-KWMENG,
</b>
Now i have filled in this internal table from select statement
Data is:
100, 10, 100
100, 10, 200
100, 10, 300
100, 20, 50
100, 30, 100
100, 30, 200
etc.
Now what i want is i want t calculate SUM field in above internal table based on VBELN & POSNR
Finally data should come as
100, 10, QTY, 600
100, 20, QTY, 50
100, 30, QTY, 300
(or)
we can update QTY with SUM of all VBELN/POSNR.
Can anybody tell me what is the logiic!
Thanks,
Deep.
2006 Nov 20 2:28 PM
Hi,
Declare on more table as ITAB, say JTAB.
Loop at ITAB.
JTAB-VBELN = ITAB-VBELN.
JTAB-POSNR = ITAB-POSNR.
JTAB-SUM = ITAB-QTY.
COLLECT JTAB
endloop.
JTAB will have ur required output, But u cant put QTY in between since, the Qunattity is Integer field u cant place 'QTY', since it is a char.
Sreedhar
Message was edited by:
Sreedhar Kanchanapalli
2006 Nov 20 2:30 PM
hi
loop at itab.
at end of posnr.
sum.
write: / itab-vbeln, itab-posnr, itab-qty.
endat.
endloop.
i dint understand why u would want to print QTY agn as the sum is what you need.
santhosh
mark if helps
Message was edited by:
Kaluvala Santhosh
2006 Nov 20 2:30 PM
loop at i_tab.
at end of posnr.
sum.
i_tab-sum = i_tab-qty.
modify i_tab index sy-tabix.
endat.
endloop.
2006 Nov 20 2:36 PM
Hi,
loop at i_tab
at end of posnr.
sum.
i_final-vbeln = i_tab-vbeln.
i_final-posnr = i_tab-posnr.
i_final-qty = 'QTY'
i_final- sum = i_tab-qty.
append i_final.
clear i_final.
endat.
Regards,
Satya
endloop.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |