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 new

Former Member
0 Likes
1,945

Why * and 0 are displayed in AT NEW and END AT?? wht is the reason behind it

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,918

hi,

At New field: it compares with the previous record of the internal table whether the value is different or not, if different the event is triggered...all the fields on the right hand side of the at new field is marked as *...this is maily bcoz at runtime their are many records for the at new field say for a carrid there r many connid...ur carrid is the at new carrid...so if you want to access a connid system will not undersatand to which connid you really want to access

Rewards point if useful

regards

pritam

Why * and 0 are displayed in AT NEW and END AT?? wht is the reason behind it

16 REPLIES 16
Read only

Former Member
0 Likes
1,918

Show us the code where you're using this.

Read only

0 Likes
1,918

I'm asking in General why *s and 0s are displayed when we try to display data from the work area or headerline of the internal table when working with control break statments??

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,918

hi Harshu,

that is the way AT NEW / AT END etc. works. It is clearly written down is SAPHelp:

"If you are working with a work area <wa>, it does not contain the current line in the AT... ENDAT statement block. All character fields to the right of the current group key are filled with asterisks (*). All other fields to the right of the current group key contain their initial value. "

ec

Read only

Former Member
0 Likes
1,918

Hi

go through this.

https://www.sdn.sap.com/irj/sdn/abap-forums

Hi,

At New

1. When a new record comes at new triggers. Atnew only used inside loop and endloop.

2. At new is controlbreak statment on at new the left side field change, the event

trigers and the values become 0 and *

AT NEW <field>

The block will be executed when the SY-TABIX is 1 (or) when the SY-TABIX 1 value has a change with the SY-TABIX value.

With this block the field towards the right to the field are not accessable with in the block, and are shown with '*'. They can be accessed outside the block.

REPORT DEMO.

DATA: T1(4), T2 TYPE I.

FIELD-GROUPS: HEADER.

INSERT T2 T1 INTO HEADER.

T1 ='AABB'. T2 = 1. EXTRACT HEADER.

T1 ='BBCC'. T2 = 2. EXTRACT HEADER.

T1 ='AAAA'. T2 = 2. EXTRACT HEADER.

T1 ='AABB'. T2 = 1. EXTRACT HEADER.

T1 ='BBBB'. T2 = 2. EXTRACT HEADER.

T1 ='BBCC'. T2 = 2. EXTRACT HEADER.

T1 ='AAAA'. T2 = 1. EXTRACT HEADER.

T1 ='BBBB'. T2 = 1. EXTRACT HEADER.

T1 ='AAAA'. T2 = 3. EXTRACT HEADER.

T1 ='AABB'. T2 = 1. EXTRACT HEADER.

SORT BY T1 T2.

LOOP.

AT FIRST.

WRITE 'Start of LOOP'.

ULINE.

ENDAT.

AT NEW T1.

WRITE / ' New T1:'.

ENDAT.

AT NEW T2.

WRITE / ' New T2:'.

ENDAT.

WRITE: /14 T1, T2.

AT END OF T2.

WRITE / 'End of T2'.

ENDAT.

AT END OF T1.

WRITE / 'End of T1'.

ENDAT.

AT LAST.

ULINE.

ENDAT.

ENDLOOP.

Edited by: Chaithanya A on Jun 23, 2008 4:37 PM

Read only

Former Member
0 Likes
1,918

Hi,

Stars will be displayed to all the fields next to field on which you are doing AT END or AT NEW.

Thats why sequence of fields while defining internal table is very important. It can be avoided by using dummy work area.

Your question is why: This might be because these comands dont care those fields and will be working according to the preceeding fields on which AT is applied.


loop at itab.
move itab to itab2.
AT NEW ..
.......... here you can use fields in itab2, which will not show stars.
ENDAT.
endloop.

Also read in detail help for AT NEW, AT END etc.. there are importants points to be taken care..

I hope this helps.

thnx,

ags.

Read only

Former Member
0 Likes
1,918

IF u use AT NEW and ATEND all characters will be * and all neumerics will be 0.....better use another work area.....

loop at <> <WA>.

WA1 = WA.

At new.

use contenet of WA1.

AT end.

use contenet of WA1.

Read only

Former Member
0 Likes
1,918

AT NEW :

As soon as the system encounters new value of that field, it stops reading further. The unread fields are filled with * (for numeric) and Space for char.

Cheers

Vamshi

Read only

Former Member
0 Likes
1,918

Hi Harshu,

  • is the property in the AT New for this suppose you want to acees the subsiquent data then what you need to do is first get the data into the variables and then go inside AT NEW.


 data: v_matnr type mara-matnr.
         v_maktx type makt-maktx.
 loop at itab.
   v_matnr = itab-matnr.
   v_maktx = itab-makt.
   AT NEW MATNR.
       
   ENDAT.
 endloop.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Jun 23, 2008 10:38 AM

Read only

Former Member
0 Likes
1,918

hiiii

if your field is after AT NEW field then it will print value * for that field.like

AT NEW FIELD1 is there..& your structure is

Field0 Field1 Field2....

At this time You have used AT NEW command on Field1 & if you are trying to print Field2..then it will print * for that field..

<REMOVED BY MODERATOR>

thx

twinkal

Edited by: Alvaro Tejada Galindo on Jun 23, 2008 10:39 AM

Read only

Former Member
0 Likes
1,918

Refer to the thread below:

Regards

Kannaiah

Read only

Former Member
0 Likes
1,919

hi,

At New field: it compares with the previous record of the internal table whether the value is different or not, if different the event is triggered...all the fields on the right hand side of the at new field is marked as *...this is maily bcoz at runtime their are many records for the at new field say for a carrid there r many connid...ur carrid is the at new carrid...so if you want to access a connid system will not undersatand to which connid you really want to access

Rewards point if useful

regards

pritam

Read only

Former Member
Read only

Former Member
0 Likes
1,918

Hi Harshu,

See its like this....

The main thing is system reads up to the field you had provided and doesnt go beyond that.. so in short it doesnt bother about the field that are after the specified field in AT NEW < field> so it gives * for character types and 0 for numeric types...

And for the field left to it as it goes throught from left to that particular field you mentioned it reads and displays that field if required.

Hope this may help you to understand..

Regards

Narin Nandivada

Read only

Former Member
0 Likes
1,918

hi

As soon as system enocounters AT NEW / AT END then the system knows the header of the record or the variable but it doesnt know how mant records are there related to that entry.

so it will show the '*' in the right side records.

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
1,918

Hi,

when you use ATNEW within the loop then the right side fields of the ATNEW field are treated as one group.

In debugging the values right to the field are displayed as * ,because inside the group you are unable to get the individual values of right side fields. Because in a group the field values are different for the fields.

Read only

Former Member
0 Likes
1,918

Hi Harsh,

The reason is quite simple. Using AT NEW <field name>, we are referring to the record with that field name, and the table may contain more than one record satisfying that condition. So, it should represent more than one record. So, instead of going for only one record and showing its records, it gives * and 0 s stating that there are more than one record that satisfies that record.

Hope this helps you.

Any queires, get back to me.

Regards,

Chandra Sekhar