Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

AT END PROBLEM--HELP

Former Member
0 Likes
900

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
874

Is the prctr is first field in tab? just check out the same.

Thanks

Sandeep

10 REPLIES 10
Read only

Former Member
0 Likes
874

i made sort before

Read only

Former Member
0 Likes
875

Is the prctr is first field in tab? just check out the same.

Thanks

Sandeep

Read only

Former Member
0 Likes
874

The pre requisite is that the PRCTR field must be the first as sandeep already pointed out.

Regards,

ravi

Read only

Former Member
0 Likes
874

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

Read only

0 Likes
874

i get erryou canot make sum at assiging

what the prob

Read only

0 Likes
874

i tried to make it wa

and i get dump

Read only

0 Likes
874

Hi,

What dump you are getting?

Regards,

Vigneswaran S

Read only

Former Member
0 Likes
874

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>

Read only

Former Member
0 Likes
874

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

Read only

Former Member
0 Likes
874

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