Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Showing posts with label Internal Tables. Show all posts
Showing posts with label Internal Tables. Show all posts

Friday, April 18, 2008

How Loop Works in Internal Tables

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,
CUST_NO LIKE KNA1-KUNNR,
NAME LIKE KNA1-NAME1,
CNTRY LIKE KNA1-LAND1,
END OF IT_KNA1.

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.....
append IT_KNA1.
Endselect.

(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.
WRITE :/IT_KNA1-CUST_NO, IT_KNA1-NAME, IT_KNA1-CNTRY.
ENDLOOP.

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.

Easy Way To Remember Table In SAP

The easiest way to remember the table in sap is:

Just try to remember the sap terminology of representing the business or buisness objects... such as

all vendor tables start with L such as lfa1, etc..

all customer tables start with K ... Kna1, konv...

all sales tables start with V... vbak vbap

all master data tables start with T... T001, t001w

all bank tables start with B.. Bknf, bkpf....

all purchasing tables start with E.. ekko, ekpo etc..

all material tables start with M... mara, makt, marc...


And


in sales, delivery, billing, purchasing...

if the tables name contains K init it is Header data
such as vbak, likp, vbrk, ekko...

if the tables name contains P init it is Item data
such as vbap, lips, vbrp, ekpo ....

Coming to FI tables... there are only 6 important tables in whole Finance module which are mostly used by abapers.


They can be remember by:

.if the table name contains I, that is open item

if the table name contains A, that is closed item

if the table name ends with S, that is GL account

exp BSIS- GL master open items
BSAS- GL master closed items
like wise...

if the table name ends with D, that is customer

if the table name ends with K, that is vendor

Finally, table TSTC contains the list of all transaction codes.

Recent Topics