Application Development 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: 

AT END OF for char field not working

Former Member
0 Kudos

Hi all,

AT END OF (char field) not working,

I sorted the itab and also avoid the stars(*) problem also, but its not working.

Thanks in advance.

Edited by: Vijay Babu Dudla on Jan 28, 2009 11:01 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
AT END OF <field>.

automatically compares all fields preceding <field> and including <field>, so if yous internal table has it structure like

field1 field3 field3 field4

and you do

AT END OF <field3>.

field1, field2 and field3 will be compared, so you need to sort the table upto and including all fields preceding field3

10 REPLIES 10

Former Member
0 Kudos

hi

there can be some problems like the fields on which we want BREAK,should always be on the left.also

SORT on the date field initially.

check the order of your fields and sort it accordingly.

hope it helps

regards

Aakash Banga

Former Member
0 Kudos
AT END OF <field>.

automatically compares all fields preceding <field> and including <field>, so if yous internal table has it structure like

field1 field3 field3 field4

and you do

AT END OF <field3>.

field1, field2 and field3 will be compared, so you need to sort the table upto and including all fields preceding field3

0 Kudos

Thank U Vuishnu,

ur timely response solved my problem.

Regards Niranjan.

Former Member
0 Kudos

wat is it showing any error...you used with in the loop only???

Former Member
0 Kudos

hi

these thread may give you some idea

former_member184657
Active Contributor
0 Kudos

Reported to SCN for using the U word.

pk

Former Member
0 Kudos

Hi Niranjan.

Please beware of the list as follow when u want to use loop control suach AT END OF ,AT *

1.All fields which you want to use as a key of loop must be ordered and sorted.

2.Don't use WHERE condition on LOOP AT

3.beware to use LOOP inside LOOP

Hope it helps.

Sayan.

dev_parbutteea
Active Contributor
0 Kudos

Hi,

At end will work only if the field is on the first position in the table structure.

Regards,

Dev.

Former Member
0 Kudos

Hello Niranjan

try this it will help you



AT END OF field name.
       .
     ENDAT.

At end of check automatically end of the field value that you have compared.

Thanks

Arun kayal.

faisal_altaf2
Active Contributor
0 Kudos

Hi, Niranjan

Test the following Sample Code it will solve out your Problem,

" This is not working properly right now.
TYPES: BEGIN OF t_name,
  name1(10),  " if You Change Cut the Name2 from the 2nd line and past it up to the Name one will work fine
  name2(10),
  amount1 TYPE p,
  amount2 TYPE p,
  END OF t_name.

DATA: it1_sum TYPE STANDARD TABLE OF t_name WITH HEADER LINE,
      wa_it1_sum TYPE t_name,
      it2_sum TYPE STANDARD TABLE OF t_name WITH HEADER LINE,
      wa_it2_sum TYPE t_name.


wa_it1_sum-name1 = 'AAAAAA'.
wa_it1_sum-name2 = 'AAAAAA'.
wa_it1_sum-amount1 = 500.
wa_it1_sum-amount2 = 200.
APPEND wa_it1_sum  TO it1_sum.
wa_it1_sum-name1 = 'AAAAAA'.
wa_it1_sum-name2 = 'AAAAAA'.
wa_it1_sum-amount1 = 500.
wa_it1_sum-amount2 = 200.
APPEND wa_it1_sum  TO it1_sum.
wa_it1_sum-name1 = 'BBBBBB'.
wa_it1_sum-name2 = 'AAAAAA'.
wa_it1_sum-amount1 = 100.
wa_it1_sum-amount2 = 200.
APPEND wa_it1_sum  TO it1_sum.
wa_it1_sum-name1 = 'AAAAAA'.
wa_it1_sum-name2 = 'AAAAAA'.
wa_it1_sum-amount1 = 500.
wa_it1_sum-amount2 = 10000.
APPEND wa_it1_sum  TO it1_sum.
wa_it1_sum-name1 = 'BBBBBB'.
wa_it1_sum-name2 = 'AAAAAA'.
wa_it1_sum-amount1 = 105000.
wa_it1_sum-amount2 = 20500.
APPEND wa_it1_sum  TO it1_sum.
wa_it1_sum-name1 = 'BBBBBB'.
wa_it1_sum-name2 = 'AAAAAA'.
wa_it1_sum-amount1 = 21000.
wa_it1_sum-amount2 = 22000.
APPEND wa_it1_sum  TO it1_sum.

SORT it1_sum BY name1 name2.
LOOP AT it1_sum INTO wa_it1_sum.

  APPEND wa_it1_sum TO it2_sum.

  AT END OF name2. " When you will use this in this Condition it will give you wrong Because this row is on number two and 
                   " it is not changing but the Row one is Changing so it will work fine if LEFT MOST
    SUM.
    wa_it1_sum-name1 = 'End Name 2'. 
    wa_it1_sum-name2 = 'End Name 2'.
    APPEND wa_it1_sum TO it2_sum.
  ENDAT.

  AT LAST.
    SUM.
    wa_it1_sum-name1 = 'At Last'.
    APPEND wa_it1_sum TO it2_sum.
  ENDAT.

ENDLOOP.

Please Reply if need more help about it.

Kind Regards,

Faisal