2008 Jun 23 3:29 PM
Why * and 0 are displayed in AT NEW and END AT?? wht is the reason behind it
2008 Jun 24 5:48 AM
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
2008 Jun 23 3:30 PM
2008 Jun 23 3:36 PM
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??
2008 Jun 23 3:33 PM
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
2008 Jun 23 3:34 PM
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
2008 Jun 23 3:34 PM
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.
2008 Jun 23 3:35 PM
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.
2008 Jun 23 3:37 PM
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
2008 Jun 23 3:37 PM
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
2008 Jun 23 3:37 PM
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
2008 Jun 23 3:39 PM
2008 Jun 24 5:48 AM
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
2008 Jun 24 5:53 AM
Hi,
Chk the link:
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/content.htm
Regards.
2008 Jun 24 6:08 AM
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
2008 Jun 24 6:42 AM
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
2008 Jun 24 7:43 AM
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.
2008 Jun 24 7:52 AM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |