‎2007 Apr 18 10:17 AM
WHAT IS WRONG
LOOP AT g_tab ASSIGNING <out>.
sum_open = <out>-zsum_open + sum_open.
AT END OF prctr.
ITAB1-PRCTR = <out>-prctr.
itab1-zsum_open = sum_open.
APPEND itab1.
CLEAR sum_open.
ENDAT.
ENDLOOP.
it's work but dont make at end statment
i have 3 kind of prctr
and i need to get 3 lines
i get 100 instead
‎2007 Apr 18 10:19 AM
Is the prctr is first field in tab? just check out the same.
Thanks
Sandeep
‎2007 Apr 18 10:19 AM
‎2007 Apr 18 10:19 AM
Is the prctr is first field in tab? just check out the same.
Thanks
Sandeep
‎2007 Apr 18 10:21 AM
The pre requisite is that the PRCTR field must be the first as sandeep already pointed out.
Regards,
ravi
‎2007 Apr 18 10:21 AM
Hi,
what is your purpose?
do you wants to display the SUMS on the basis of Profit centers.
then use this. first Sort by prctr.
then use SUM between AT end..endat.
<b>sort g_tab by prctr.</b>
LOOP AT g_tab ASSIGNING <out>.
sum_open = <out>-zsum_open + sum_open.
AT END OF prctr.
read table g_tab index sy-tabix.
SUM.
ITAB1-PRCTR = <out>-prctr.
itab1-zsum_open = sum_open.
APPEND itab1.
CLEAR sum_open.
ENDAT.
ENDLOOP.
reward if useful
regards,
ANJI
‎2007 Apr 18 10:28 AM
‎2007 Apr 18 10:37 AM
‎2007 Apr 18 11:28 AM
‎2007 Apr 18 10:22 AM
hi
Sort the itab with the prctr and make the prctr as the first field in your internal table.
hope it will clear ur doubt
regards
ravish
<b>plz dont forget to reward points if helpful</b>
‎2007 Apr 18 10:23 AM
Hi Liat,
The important fact that you should consider while using AT NEW AT ENDand ON CHANGE OF is while using AT NEW/AT END you should make the FIELD which you are checking as the first field of internal table , other wise if any of the fields which is in the left of the field that you are putting at "ATNEW/ END" changes it will get triggered.So u wont get the expected result
But ON CHANGE will only check that particular field and it can be at anywhere in the internal table
Regards
Avi
‎2007 Apr 18 10:23 AM
Hi,
Try to do like this.
SORT by PRCTR.
LOOP AT i_prctr_amt INTO wa_prctr_amt.
AT END OF prctr.
SUM.
wa_prctr_sum-prctr = wa_prctr_amt-prctr.
wa_prctr_sum-wrbtr = wa_prctr_amt-wrbtr.
APPEND wa_prctr_sum TO i_prctr_sum.
ENDAT.
CLEAR :wa_prctr_sum,
wa_prctr_amt.
ENDLOOP.
Regards,
-->Suresh