|
How loop works in internal tables with example using
any SD table?
What is the effect on INTERNAL TABLE ITAB using CLEAR ITAB, REFRESH ITAB? Internal table is a temporary storage location which is only available at runtime. Now we are defining one internal table IT_KNA1 using the database table KNA1. DATA : BEGIN OF IT_KNA1 OCCURS 0,
With the above statement internal table is created with body and work area. Now we have populated the IT_KNA1 using select statement. Select ... from KNA1 into IT_KNA1 where.....
(or) select... from KNA1 into table IT_KNA1 where..... The total number of records statisfying the where condition will enter into the internal table. First one record enters work-area of the internal table then it gets appended into the body of the internal table, same procedure repeats for all the records. For displaying the data which is in the internal table. Loop at IT_KNA1.
Similarly as mentioned above for entering data, for displaying also. The first record from the body of the internal table is fetched into the work-area and then output is displayed, and procedure repeats for all the records in the internal table. Notes: How to Loop from second row in internal table? You can use if condition in the loop endloop. loop at it_tab1 . if sy-tabix > 1.
endloop. This skips the first record and you can continue the execution of the statements in the loop. |
|
See Also
Get help for your ABAP problems
ABAP Books
More ABAP Tips
SAP ERP Modules, Basis, ABAP and Other IMG Stuff All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|