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: 

tables statement

Former Member
0 Kudos

Hi guys can you please tell me siginficance of using TABLES statement with appropriate example

5 REPLIES 5

Former Member
0 Kudos

hi this gives the buffer other wise it will access the database directly..

generally if u r calling a database many times it is not good for the performance...to avoid this u can use a buffer using the tables statement...after using the tables statement if u r calling the database many times it will come from the buffer not from the database table ...

regards,

venkat.

rahulkavuri
Active Contributor
0 Kudos

TABLES statement wil be useful when u declare select-options..

If you do not declare tables then you will get syntax error

Former Member
0 Kudos

Hi

When you declare the word TABLES as:

TABLES : KNA1.

It will create a work area similar to KNA1 table

If you wants to use the work area of that table you declare the Tables.

otherwise declare a internal table and use.

when you declare TABLES

you can write

select single * from KNA1 where kunnr = '0000001200'.

if kna1-land1 <> 'US'.

write:/ kna1-kunnr, kna1-name1.

endif.

But in ECC 6-0 we should not declare Tables and should not use the internal tables with header line.

Regards

Anji

Former Member
0 Kudos

hi,

tables staement create external work area,

it is used for select-options,

if we use tables: in our prgm no need to create any work area,

this statement cteate buffer so it decreases the efficiancy

so avoid tables,

for select options use variables

ex:

data: gv_matnr type matnr,

select-option material for gv_matnr.

regards,

chandu

Former Member
0 Kudos

Hi ,

One common kind of interface work area are table work areas, which you declare using the

TABLES <dbtab>.

statement. This statement creates a structure with the same data type and the same name as a database table, a view, or a structure from the ABAP Dictionary.

Before Release 4.0, it was necessary to declare a database table <dbtab> to an ABAP program using the statement TABLES <dbtab> before you could access the table using Open SQL statements. This restriction no longer applies to Open SQL statements.

However, you still need to use the TABLES statement if you want to define input/output fields on a screen with reference to database tables, views, or ABAP Dictionary structures (Get from Dict. function in the layout editor of the Screen Painter). In the PBO event, the ABAP program sends the contents of the fields to the screen fields. In the PAI event, it receives the contents of the screen fields back into the corresponding components of the table work area.

Whenever you are using select-options if you did not use tables statement , it shows error. inorder to avoid that error we have to create a variable of that type and use that.

Eg:

Code with TABLES STMT.

tables: mara. " this creates buffer and it is maintained by the server. hence performance decreases.

select-options: matnr for mara-matnr.

alternative and effecient method.

data gv_matnr type mara-matnr.

select-options matnr for gv_matnr.

*This method doesnt create any buffer and hence there is no need of maintaining buffer on the server which indirectly increases the effecieny and performance.

<REMOVED BY MODERATOR>

Thanks and Regards.

Edited by: Ammavajjala Narayana on Mar 26, 2008 9:09 PM

Edited by: Alvaro Tejada Galindo on Mar 26, 2008 4:25 PM