2010 Aug 10 10:20 AM
S.No WBS matnr menge menge1
1 00000507 0010000503 00010 1000.000 0.000
2 00000507 0010000504 00010 900.000 0.000
3 00000507 0010000511 00030 3000.000 0.000
4 00000507 0010000511 00060 2000.000 0.000
5 00000531 0010000511 00010 1000.000 0.000
6 00000531 0010000511 00040 1000.000 0.000
7 00000532 0010000511 00020 2000.000 0.000
8 00000532 0010000511 00050 1000.000 0.000
above is an internal table.
how to code that the output should be in such a manner that all identical WBS quantity should be added and displayed correspondingly in the same internal table itself.
S.No WBS matnr menge menge1
1 00000507 0010000503 00010 1000.000 0.000
2 00000507 0010000504 00010 900.000 0.000
3 00000507 0010000511 00030 3000.000 0.000
4 00000507 0010000511 00060 2000.000 6900.00
5 00000531 0010000511 00010 1000.000 0.000
6 00000531 0010000511 00040 1000.000 2000.00
7 00000532 0010000511 00020 2000.000 0.000
8 00000532 0010000511 00050 1000.000 3000.00
This should be the output.
Help with the code.
Thanks for yout time.
2010 Aug 10 10:35 AM
Hi
first you need to sort your table by WBS and then apply loop, Use AT END OF event for wbs and calculate the sum of WBS.
like
data: sum type i value = 0.
sort table by EBS.
loop at table.
at end of wbs.
sum = sum + wbs.
endat.
endloop.
try something like this.
Thanks
lalit Gupta
S.No WBS matnr menge menge1
1 00000507 0010000503 00010 1000.000 0.000
2 00000507 0010000504 00010 900.000 0.000
3 00000507 0010000511 00030 3000.000 0.000
4 00000507 0010000511 00060 2000.000 0.000
5 00000531 0010000511 00010 1000.000 0.000
6 00000531 0010000511 00040 1000.000 0.000
7 00000532 0010000511 00020 2000.000 0.000
8 00000532 0010000511 00050 1000.000 0.000
above is an internal table.
how to code that the output should be in such a manner that all identical WBS quantity should be added and displayed correspondingly in the same internal table itself.
S.No WBS matnr menge menge1
1 00000507 0010000503 00010 1000.000 0.000
2 00000507 0010000504 00010 900.000 0.000
3 00000507 0010000511 00030 3000.000 0.000
4 00000507 0010000511 00060 2000.000 6900.00
5 00000531 0010000511 00010 1000.000 0.000
6 00000531 0010000511 00040 1000.000 2000.00
7 00000532 0010000511 00020 2000.000 0.000
8 00000532 0010000511 00050 1000.000 3000.00
This should be the output.
Help with the code.
Thanks for yout time.
2010 Aug 10 10:35 AM
Hi
first you need to sort your table by WBS and then apply loop, Use AT END OF event for wbs and calculate the sum of WBS.
like
data: sum type i value = 0.
sort table by EBS.
loop at table.
at end of wbs.
sum = sum + wbs.
endat.
endloop.
try something like this.
Thanks
lalit Gupta
2010 Aug 10 11:04 AM
Hi ,
Please follow the below step .
- Make sure WBS is the first field in your internal table.
- It must be sorted.
- Calculate the sum for each loop
- Use AT END Control break and update the table with calculated sum.
Please check the below program created based on your requirement.
Loop at it_tab INTO lw_tab.
lv_sum = lv_sum + lw_tab-menge1.
at END OF wbs.
READ TABLE it_tab ASSIGNING <fs_tab> INDEX sy-tabix.
if sy-subrc = 0.
<fs_tab>-total = lv_sum.
clear lv_sum.
endif.
ENDAT.
endloop.
This above code snippet work fine as per your requirement.
Regards,
Deban
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |