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: 

Difference between tables statement and work area

radhushankar
Participant
0 Kudos

Hi

i would like know the difference between these statement.

tables: vttk.

data :itab type standard table of vttk,

wa_itab like line of vttk.

what will happen with the table statement keyword ???

whether any difference between the ouput created through tables and wa_itab statement???

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

1)<b>tables: vttk</b>. and <b>wa_itab like line of vttk</b>.= Declares a work area of type vttk.

output will be same using any of the above statment.

2)<b>data :itab type standard table of vttk,</b> = Declares a table without work area of type vttk

Regards,

Amit

8 REPLIES 8

Former Member
0 Kudos

Hi

HI,

INTERNAL Table and it's background:

===================================

Internal table acts as a container which is used to store the record sets. That is used to store the data fetched from the database table.

So due to performance reason every time access to database would not be so good and decrease the performance. So you just select the data from the database and store it in the intermediate table. This table is called INTERNAL TABLE. So it's an replica of the database. The design foes like this,

PRESENTATION SERVER <> APPLICATION SERVER <>

DATABASE SERVER.

So everytime gain accessing to database results in high resource usage and bad permformance.

So always play around with internal tables. So obviously the whenever you access the data in the INTERNAL TABLE, the application server will be used.

WORK AREA:

==========

When ever you loop at the internal table, the current record should be stored in a temporary work place. That is called WORK AREA.

LOOP AT ITAB INTO WORKAREA.

ENDLOOP.

ITAB :An internal table

WORKAREA:An instance of internal table

Go thru the link below

<b>Reward if usefull</b>

Former Member
0 Kudos

Hi radhu,

Tables will just create the work-area of type VTTK.

So there is no difference.

Regards,

Atish

Former Member
0 Kudos

hi

if u declare table statement, no need to add work area, it ll act as as a work area.

but it ll occupy memory space, insted of that we r using work area, but if u select option , u have to use mandatorily

regards

karthik

Former Member
0 Kudos

Hi,

WORKAREA is a structure that can hold only one record at a time. It is a collection of fields. We use workarea as we cannot directly read from a table. In order to interact with a table we need workarea. When a Select Statement is executed on a table then the first record is read and put into the header of the table and from there put into the header or the workarea(of the same structure as that of the table)of the internal table and then transferred top the body of the internal table or directly displayed from the workarea.

Each row in a table is a record and each column is a field.

wa_itab like line of vttk.

---> using this code we reate a Work area with the Structure of table VTTK.

For that there is no need for table declaration like <b>tables: vttk.</b>

If you have use Selection-screen in your program you should give the Table declaration.

For your case, Remove the table declaration and execute. It will work fine.

Thanks,

Reward If Helpful.

Former Member
0 Kudos

Hi,

1)<b>tables: vttk</b>. and <b>wa_itab like line of vttk</b>.= Declares a work area of type vttk.

output will be same using any of the above statment.

2)<b>data :itab type standard table of vttk,</b> = Declares a table without work area of type vttk

Regards,

Amit

0 Kudos

Hi,

TABLES is a special kind of work area. Bothe of these store data. But when you declare TABLES VTTK, it creates a work area of the same name and structure as that of the DB table VTTK.

And ABAP determines this variable by default in database operations and places/ takes data from this.

For eg.If you use a different work area,.

You have to say ,

SELECT SINGLE * FROM VTTK

INTO WA_VTTK

WHERE .......

Instead, if you declare a work area using the TABLES statement, u can write,

SELECT SINGLE * FROM VTTK

WHERE.......

This will place the value selected in the work area called VTTK. Normally we call this variable as TABLE HEADER.

Similarly for updation into DB also, if we don't specify the work area specifically, it will try to get the value from the table header .

Hope this solves your doubt. Pls reward if you find it useful.

0 Kudos

Thank you everybody. My doubt got cleared.

Former Member
0 Kudos

Hi,

There is no difference since you are using table structure itself in work area.

If you need a few fields of the table, better avoid TABLES statement and create a work area containing the required fields alone.