‎2008 Feb 06 7:15 AM
hi,
I have two fields in output.
profitcenter (prctr) wogbtr (Amount).
I want to display only subtotal of each profit center without displaying all the values.and subtotal text as corresponding profit center.please help me out in resolving this.
like
output is coming like this
prctr wogbtr
1010 200
1010 300
2020 300
2020 100
expected output.
1010 500.
2020 400.
total 900
‎2008 Feb 06 7:20 AM
Hi
before sending the internal table to output sort it and use
ATNEW statement to add amounts of corresponding profit.
‎2008 Feb 06 7:20 AM
Hi
First take final table into one more internal table and
for loop it like this (here I_analysis is final table and I_analytot is copied from i_analysis) ex:
LOOP AT i_analysis INTO wa_analytot.
AT NEW kunnr.
SUM.
READ TABLE i_analysis INTO wa_analysis WITH KEY kunnr = wa_analytot-kunnr
BINARY SEARCH.
APPEND wa_analytot TO i_analytot.
ENDAT.
ENDLOOP.
Regards
Rams
Edited by: ramesh on Feb 6, 2008 8:21 AM
‎2008 Feb 06 7:22 AM
Hi,
sort itab by prctr wogbtr.
at end of wogbtr.
sum.
write /wogbtr.
at last.
sum.
write /wogbtr.Cheers,
jose.
Edited by: jose on Feb 6, 2008 8:37 AM
‎2008 Feb 06 7:24 AM
Hi
1st sort the ITAB
Use the Control breaks AT END OF in the LOOP
for eact at last, populate record into temp_ITAB
Then print this TEMP_ITAB
Reward if useful
nARENDRA
‎2008 Feb 06 7:30 AM
Hi
To get subtotoal of any field , basis straties are
fields shud be sorted
1. sort profit center and amount
2. put a loop on internal table.
loop at itab.
endloop.
3. now use control statement to have sum of any field.
U can use AT NEW and SUM
or ON CHANGE OF.........ENDON.
logic is on change of profit center.
sum the amount.
hope concept is clear
. please reward points if helpful
‎2008 Feb 06 7:40 AM
Hi Vinutha,
Use this one,
select prctr sum ( wogbtr ) into table itab from tablename
where ..........
group by prctr.
and then display the internal table itab.
Regards,*
Azhar.