banner ads

ABAP 7.40 For Iteration Expression | For Iteration in SAP ABAP | For Statement in SAP ABAP 7.40 | For syntax in ABAP

FOR Iteration Expression

As of ABAP 740, There is a new iteration expression available – FOR. This can be used along with VALUE to populate the desired data. ABAP 740 has lot of new features and FOR is one of them. FOR is the Iteration Expression. An iteration expression is to perform the iteration on the table. 

FOR Expression in ABAP 7.40

In this blog we are discussing about one of the most important feature of new ABAP that is for statement or for iteration expression. SAP has introduced for as an alternative of loop statement but with consideration of performance. In this blog we will see some basic part of for operator and we will see advance part in next discussion.

Below is the sample code for your reference which I have used in Video session available on youtube. Click here to see video session on For statement in SapAbap. As you can copy this code for practice purpose only and can see how does it work in actual ABAP Platforms.

FOR Statement in SAP ABAP.


TYPES : BEGIN OF ty_empdata,
TYPE char10,
TYPE char10,
END OF ty_empdata,


DATA(lt_empdata) = VALUE tty_empdata(
name 'Jackson' city 'MUMBAI' )
name 'Ramesh'  city 'Pune' )
name 'Mahesh'  city 'banglore' )
name 'swapnil' city 'MUMBAI' ) ).




write 'Fetching city'.

data(lt_city) = VALUE tty_cityFOR ls_empdata IN lt_empdata
ls_empdata-city ) ).

LOOP AT lt_city INTO DATA(ls_city) .

write / ls_city.



For Syntax in SAP ABAP 7.4

Technical Explanation of program.

1) Define structure with some fields.

2) Define table types in order to create table and append data

3) Creating table with reference to table type and Filling Internal table with     values.

4) Display Internal table data.

5) Fetching City from internal table using FOR Clause or For keyword.

6) Display Fetched record using for operator.

7) Output.

Good Job !!!!

Now you have learnt how to use FOR iteration keyword in SAP ABAP 7.40.

Thanks for reading. 😊

1 comment: