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: 

How to use at new with field symbol .

Former Member
0 Kudos
495

Hi Gurus

Iam trying to use AT NEW with field wymbol like

AT NEW <RRi>-vbeln .

but iam getting an error like field symbol not defined .

Kindly advice me on the same .

Thanks ,

vinay.

2 REPLIES 2

Former Member
0 Kudos
93

You should use At New this way

at new name.

where name is the field name in the internal table.

below is a sample code.

data: begin of itab occurs 0,

name(10) type c,

end of itab.

itab-name = 'xxx'.

append itab.

itab-name = 'xxx'.

append itab.

itab-name = 'yyy'.

append itab.

loop at itab.

at new name.

write : itab-name.

endat.

endloop.

Former Member
0 Kudos
93

Hi

Refer the below code and change accordingly

DATA: BEGIN OF LINE,

COL1 TYPE I,

COL2 TYPE I,

END OF LINE.

DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.

FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.

DO 4 TIMES.

LINE-COL1 = SY-INDEX.

LINE-COL2 = SY-INDEX ** 2.

APPEND LINE TO ITAB.

ENDDO.

READ TABLE ITAB WITH TABLE KEY COL1 = 2 ASSIGNING <FS>.

<FS>-COL2 = 100.

READ TABLE ITAB WITH TABLE KEY COL1 = 3 ASSIGNING <FS>.

DELETE ITAB INDEX 3.

IF <FS> IS ASSIGNED.

WRITE '<FS> is assigned!'.

ENDIF.

LOOP AT ITAB ASSIGNING <FS>.

WRITE: / <FS>-COL1, <FS>-COL2.

ENDLOOP.

Regards

Shiva