‎2009 Apr 05 12:12 PM
Hello Friends,
below is my internal table
it_bsis
bukrs hkont aufnr budat wrbtr1
1000 0000300101 000602000002 20080501 7500.00
1000 0000300101 000602000026 20080920 13350.00
1000 0000300101 000602000026 20080923 20025.00
1000 0000300102 000602000026 20080923 10000.00
1000 0000302111 99ASD 20081129 120000.00
1000 0000302111 99ASD 20081129 150000.00
1000 0000302111 99ASD 20081129 150000.00
1000 0000302111 99ASD 20081130 120000.00
1000 0000302118 08CARNINT001 20080731 150000.00
1000 0000302118 08CARNINT001 20080731 100000.00
1000 0000302118 08CARNINT001 20080831 20000.00
1000 0000302118 08CARNINT001 20080707 150000.00
1000 0000302118 08CARNINT001 20080707 100000.00
1000 0000302118 08CARNINT001 20080801 20000.00
Expected output is
it_bsis2
bukrs hkont aufnr budat wrbtr1
1000 0000300101 000602000002 20080501 7500.00
1000 0000300101 000602000026 20080920 13350.00 + 20025.00
1000 0000300102 000602000026 20080923 10000.00
1000 0000302111 99ASD 20081129 540000.00
1000 0000302118 08CARNINT001 20080801 54000.00
can some one guide me to get the correct output.
i want to group them together on the basis of these conditions.
against one aufnr there can be many hkont , i have to sum up all hkont along with wrbtr1.
‎2009 Apr 05 12:22 PM
Hi Jitesh,
SAP has a wonderful inbuilt feature to achieve this.
try to use this code.
loop at it_bsis.
at end of aufnr.
sum.
modify it_bsis.
endat.
endloop.
sort it_bsis by bukrs hkont ascending wrbtr1 descending.
delete adjacent duplicates comparing bukrs hkont aufnr.
I am sure it will solve your query.
Let me know in case you face any problem.
Gowri
‎2009 Apr 05 12:21 PM
Hi,
Use COLLECT hope will solve out your problem
Reply if any Issue,
Best Regards,
Faisal
‎2009 Apr 05 12:21 PM
Jithesh,
You could use either the Collect Statement or On Change Of statement to achieve this purpose.
Try playing in ABAP using those two statements.
Thanks,
Babu Kilari
‎2009 Apr 05 12:22 PM
Hi Jitesh,
SAP has a wonderful inbuilt feature to achieve this.
try to use this code.
loop at it_bsis.
at end of aufnr.
sum.
modify it_bsis.
endat.
endloop.
sort it_bsis by bukrs hkont ascending wrbtr1 descending.
delete adjacent duplicates comparing bukrs hkont aufnr.
I am sure it will solve your query.
Let me know in case you face any problem.
Gowri
‎2009 Apr 05 12:32 PM
Dear Gowri,
Your solution is wat i wanted .. but i need a lil more modifictaion.
1000 0000300101 000602000002 ******** 7500.00
1000 0000300101 000602000026 20080920 13350.00
1000 0000300101 000602000026 ******** 33375.00
1000 0000302111 99ASD 20081129 120000.00
1000 0000302111 99ASD 20081129 150000.00
1000 0000302111 99ASD 20081129 150000.00
1000 0000302111 99ASD ******** 540000.00
1000 0000302118 08CARNINT001 20080731 150000.00
1000 0000302118 08CARNINT001 20080731 100000.00
1000 0000302118 08CARNINT001 20080831 20000.00
1000 0000302118 08CARNINT001 20080707 150000.00
1000 0000302118 08CARNINT001 20080707 100000.00
1000 0000302118 08CARNINT001 ******** 540000.00
but the only drawback is .. it convert s my date into ********.
i need the date also
‎2009 Apr 05 12:45 PM
ha ha i expected this
anyway the solution is take the date field into a variable and then modify it.
something like this
loop at it_bsis.
l_date = it_bsis-budat.
at end of aufnr.
sum.
it_bsis-budat = l_date.
modify it_bsis.
endat.
endloop.
Due to the property of at end of... it converts all characters to ******* so hence the problem....
Tell me in case u need further help
Gowri
‎2009 Apr 05 12:58 PM
‎2009 Apr 05 12:26 PM
HI,
Try this Code.
SORT ITAB BY BUKRS HKONT AUFNR BUDAT DESCENDING.
LOOP AT ITAB.
WA = ITAB.
L_WRBTR = L_WRBTR + ITAB-WRBTR.
AT END OF AUFNR.
WRITE :/ WA-BUKRS,
WA-HKONT,
WA-AUFNR,
WA-BUDAT,
L_WRBTR.
CLEAR L_WRBTR.
SKIP.
ENDAT.
ENDLOOP.
‎2009 Apr 05 12:28 PM
Hi Jitesh,
First you will need to SORT internal table in ascending order on aufnr and hkont.
The Loop at internal table and use "ON CHANGE OF" statement to sum up the values of fields.
Regards
Shital