2009 Jan 23 6:28 AM
Dear all
I have one internal table it_data with following data. And I want to Integrate this table by keeping
one entry for the same ARTNR by Collecting VVVOL3 VVVOL2 and VVVOL1
Now it_data is :-
ARTNR VVVOL3 VVVOL2 VVVOL1
1010371 60 0 0
1010371 0 800 0
1010371 0 0 100
1012376 16 0 0
1012377 80 0 0
3200853 0 40 0
It should be :-
ARTNR VVVOL3 VVVOL2 VVVOL1
1010371 60 800 100
1012376 16 0 0
1012377 80 0 0
3200853 0 40 0
COLLECT is not serving my purpose..because I want to modify the same internal table......
Could anybody suggest a solution ?
Thanksssssssssss.
2009 Jan 23 6:32 AM
Before the loop use SORT it_data by ARTNR.
Also make sure the fields VVVOL3 VVVOL2 and VVVOL1 are of type numeric.
Dear all
I have one internal table it_data with following data. And I want to Integrate this table by keeping
one entry for the same ARTNR by Collecting VVVOL3 VVVOL2 and VVVOL1
Now it_data is :-
ARTNR VVVOL3 VVVOL2 VVVOL1
1010371 60 0 0
1010371 0 800 0
1010371 0 0 100
1012376 16 0 0
1012377 80 0 0
3200853 0 40 0
It should be :-
ARTNR VVVOL3 VVVOL2 VVVOL1
1010371 60 800 100
1012376 16 0 0
1012377 80 0 0
3200853 0 40 0
COLLECT is not serving my purpose..because I want to modify the same internal table......
Could anybody suggest a solution ?
Thanksssssssssss.
2009 Jan 23 6:32 AM
Before the loop use SORT it_data by ARTNR.
Also make sure the fields VVVOL3 VVVOL2 and VVVOL1 are of type numeric.
2009 Jan 23 6:33 AM
Hi,
Collect can add only interger type fileds.
OR
Try this
SOrt irab by artnr.
Loop At itab.
itab1-artnr = itab-artnr.
itab1-VVVOL3 = itab1-VVVOL3 + itab-VVVOL3 .
itab1-VVVOL2 = itab1-VVVOL2 + itab-VVVOL2.
itab1-VVVOL1 = itab1-VVVOL1 + itab-VVVOL1.
AT END OF ARTNR.
Append itab1.
clear itab1.
ENDAT.
Endloop.
2009 Jan 23 6:44 AM
hi
First sort the internaltable by ATRNR and all fields should be numeric and this numeric condition is exception for Material .. if internal table contains material you can use collect by material number this is only exception for material number ..
2009 Jan 23 6:47 AM
hi for use collect statement you must have a CHAR field in your internal table.
because it adds the numeric value for that char field which have same value.
2009 Jan 23 6:52 AM
2009 Jan 23 10:36 AM
Hi,
You can start with the original internal table, collect in another internal table. Delete the contents of the original internal table and copy the contents of the collected internal table to the original internal table.
Something like this :
loop at itab into wa.
collect wa into itab_new.
endloop.
delete itab.
itab = itab_new[].
regards,
Advait
2009 Jan 23 10:53 AM
Hi Ubhaka,
Try it this way:
sort it_data by artnr.
loop at it_data into wa_data.
at end of artnr.
sum.
wa_data1-VVVOL1 = wa_data-VVVOL1.
wa_data1-VVVOL2 = wa_data-VVVOL2.
wa_data1-VVVOL3 = wa_data-VVVOL3.
append wa_data1 to it_data1. " final table
endat.
endloop.
With luck,
Pritam.
2009 Jan 28 6:54 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |