2014 Feb 10 4:31 AM
Hi All
I Have following internal table,
VBELN matnr qty
1000005 m1 5
1000005 m1 3
1000005 m2 2
1000006 m2 5
Requirement is :
1000005 m1 8
1000005 m2 2
1000006 m2 5
How i can do this.....
Rgds
pp
2014 Feb 10 5:08 AM
Hi Pramod,
Create one more internal table ITFIINAL with one more field v_total.
pass data intis internal table.
here itab is internal as you created in your program.
itfinal[] = itab[].
data: v_total like vbrk-menge. " Declare variable.
sort itfinal.
delete adjecent duplicat from itfinal comparing vbeln matnr.
loop at itfinal.
loop at itab where vbeln = itfinal-vbeln and matnr = itab-matnr.
itfinal-v_total = itfinal-v_total + v_toal .
endloop.
modify itfinal transporting v_total.
clear: v_total.
endloop.
Now internal table ITFINAL contains record as you want.
Any issue write.
Thanks,
Ranjit Kumar.
Hi All
I Have following internal table,
VBELN matnr qty
1000005 m1 5
1000005 m1 3
1000005 m2 2
1000006 m2 5
Requirement is :
1000005 m1 8
1000005 m2 2
1000006 m2 5
How i can do this.....
Rgds
pp
2014 Feb 10 4:44 AM
Hi Pramod,
Itab-vbeln = 1000005.
itab-matnr = m1.
itab-qty = 5.
collect itab.
Itab-vbeln = 1000005.
itab-matnr = m1.
itab-qty = 3.
collect itab.
Itab-vbeln = 1000005.
itab-matnr = m2.
itab-qty = 2.
collect itab.
Itab-vbeln = 1000006.
itab-matnr = m2.
itab-qty = 5.
collect itab.
You will get required output.
When using collect statement, if non-numerical(C,N,D,T) fields are same, numerical(P,I and F) fields will be added.
Arivazhagan S
2014 Feb 10 4:59 AM
Hi Arivazhagan
actually my internal table will dynamically change. so how can i put u r logic for it?
(Collect Line by line is not possible)
Rgds
pp
2014 Feb 10 5:08 AM
Hi Pramod,
Create one more internal table ITFIINAL with one more field v_total.
pass data intis internal table.
here itab is internal as you created in your program.
itfinal[] = itab[].
data: v_total like vbrk-menge. " Declare variable.
sort itfinal.
delete adjecent duplicat from itfinal comparing vbeln matnr.
loop at itfinal.
loop at itab where vbeln = itfinal-vbeln and matnr = itab-matnr.
itfinal-v_total = itfinal-v_total + v_toal .
endloop.
modify itfinal transporting v_total.
clear: v_total.
endloop.
Now internal table ITFINAL contains record as you want.
Any issue write.
Thanks,
Ranjit Kumar.
2014 Feb 10 5:10 AM
Hi Pramod , why not you are using the concept of ON CHANGE OF matnr.
Or you can use AT NEW statement.
Summarize your internal table accordingly.
2014 Feb 10 6:02 AM
hi sanjeev
As per my requirement AT NEW is not possible, because i have two veblen & matnr wise total..
Rgds
pp
2014 Feb 10 5:33 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |