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: 

Alternative looping Procedure

Former Member
0 Kudos

How can we loop an internal table without using a workarea of it's line type?

<Has nothing to do with ABAP Objects - moved to ABAP General. Please choose your forums more carefully in future>

Edited by: Mike Pokraka on Aug 4, 2008 9:33 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ,

you can loop an internal table without an workarea by using field-symbols.

FIELD-SYMBOLS: <ls_record> TYPE ANY.

LOOP AT itab ASSIGNING <ls_record>.

...

ENDLOOP.

the field symbol acts an an counter to the internal table. the field symbol can also be declared as the type of the internal table.

Regards ,

Debojyoti.

6 REPLIES 6

Former Member
0 Kudos

to access a internal table you always need a work area whether implicit or explicit that is with header line or without header line.

refer to the link below:

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb36a1358411d1829f0000e829fbfe/content.htm

http://www.sap-img.com/abap/how-loop-works-in-internal-tables.htm

With luck,

Pritam.

Former Member
0 Kudos

hi,

in case of Loop At to an internal table you need to use work area.

however you may not use Explicit Work area if you work with Internal table with header line.

In that case the syntax will be

LOOP AT itab.
.......
.......
ENDLOOP.

here one work area having same as that of the internal table is created inplicitly.

Regards,

anirban

Former Member
0 Kudos

hi

create an explicit work area like internal table .

loop at itab into wa_area

write: wa_area-fields,

..........

endloop.

uwe_schieferstein
Active Contributor
0 Kudos

Hello

You can use a field-symbol instead:


FIELD-SYMBOLS: <ls_record>     TYPE ANY.

LOOP AT itab ASSIGNING <ls_record>.
...
ENDLOOP.

Regards

Uwe

0 Kudos

Hi.

What you actually want is this:

LOOP AT itab TRANSPORTING NO FIELDS.

.....

ENDLOOP.

This syntax does not require any workarea.

Former Member
0 Kudos

Hi ,

you can loop an internal table without an workarea by using field-symbols.

FIELD-SYMBOLS: <ls_record> TYPE ANY.

LOOP AT itab ASSIGNING <ls_record>.

...

ENDLOOP.

the field symbol acts an an counter to the internal table. the field symbol can also be declared as the type of the internal table.

Regards ,

Debojyoti.