Application Development and Automation 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: 
Read only

table control

Former Member
0 Likes
666

what is the significance of table control..why/when/where do we use..

and the query select..forallentries... under which circumstances we use and what are the possible output

8 REPLIES 8
Read only

Former Member
0 Likes
605

Table Control:-

These are the screen elements used to display tabular data they can be called

as screen tables( like STEP LOOP).To use table control we have to create it on the screen using SCREEN PAINTER(SE51) and declare a control variable of TYPE TABLEVIEW using CONTROLS statement in the ABAP program. We have to use LOOP .. ENDLOOP statement in both PBO and PAI with or without AT int_table parameter. IF AT int_table parameter is not used than we have to place a MODULE call between the LOOP...ENDLOOP statement to fill the screen table rows from the ABAP program in PBO and program our own scrolling functions

using OK_CODE field.

Having a parallel loop(at screen table rows & int table rows) by using parameter

AT int_table makes the ABAP code simple.

A special structure of type CXTAB_CONTROL is used to set/get various

attributes of table control at runtime like CURRENT_LINE ,TOP_LINE.

forallentries:

U will be using this statment when u are querying a database based on all the entries in an internal table.

Suppose u have list of customer no's in itab and now u want to query the vbak for the respective entries in itab,in this case u have to use for all entrie.

Let me know if I am not clear.

Regards

Read only

Former Member
0 Likes
605

hi ,

Select ...For all entries is to improve the database performance ..

If we use select within a loop instead of select for all entries it has to loop and also select statement .

check sy-subrc value aslo .

before applying for all entries you must sort and also delete the duplicates if any from the internal table .

table control is to have a table pattern on screen for which all the properties will be set by default .

we can even update the databse using table controls.

regards

Read only

Former Member
0 Likes
605

Hi,

Kindly check the <b>syntax:</b>

... FOR ALL ENTRIES IN itab WHERE ... col operator itab-comp ...

<b>Effect</b>

If the addition FOR ALL ENTRIES is specified before the language element WHERE, then the components comp of the internal table itab can be used as operands when comparing with <b>relational operators</b>.

<b>WHERE - Relational operators</b>

<b>Syntax</b>

... col operator f ...

<b>Effect</b>

The logical expression compares the content of the column col, corresponding to the relational operator operator, with the content of f. Another column of a database table specified behind FROM, an ABAP data object, or a scalar subquery can be used for f. If f is another column, it must be specified via dbtabcomp or tabaliascomp.

The internal table itab must have a structured line type and the component comp must be

compatible with the column col.

The logical expression sql_cond of the WHERE condition can comprise various

logical expressions by using AND and OR. However, if <b>FOR ALL ENTRIES</b> is specified,

there must be at least one Comparison with a column of the internal table itab,

which can be specified either statistically or dynamically (Release 6.40 and higher).

In a statement with a SELECT statement with <b>FOR ALL ENTRIES</b>, the addition <b>ORDER BY</b>

can only be used with the addition <b>PRIMARY KEY</b>.

The whole logical expression sql_cond is evaluated for each individual line of the

internal table itab. The resulting set of the <b>SELECT</b> statement is the union of

the resulting sets from the individual evaluations.

Duplicate lines are automatically removed from the resulting set.

If the internal table itab is empty, the whole WHERE statement is ignored and

all lines in the database are put in the resulting set.

Reward points if it helps

Regards

Alfred

Read only

raguraman_c
Active Contributor
0 Likes
605

This is very useful link for table control,

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm

<b>for all entries</b>

"FOR ALL ENTRIES IN..." (outer join) are very fast but keep in the mind the special features and 3 pitfalls of using it.

(a) Duplicates are removed from the answer set as if you had specified "SELECT DISTINCT"... So unless you intend for duplicates to be deleted include the unique key of the detail line items in your select statement. In the data dictionary (SE11) the fields belonging to the unique key are marked with an "X" in the key column.

(b) If the "one" table (the table that appears in the clause FOR ALL ENTRIES IN) is empty, all rows in the "many" table (the table that appears in the SELECT INTO clause ) are selected. Therefore make sure you check that the "one" table has rows before issuing a select with the "FOR ALL ENTRIES IN..." clause.

(c) If the 'one' table (the table that appears in the clause FOR ALL ENTRIES IN) is very large there is performance degradation Steven Buttiglieri created sample code to illustrate this.

try this link as well.

/people/hema.rao/blog/2006/09/25/performance-tuning--an-overlooked-activity

--Ragu

Read only

gopi_narendra
Active Contributor
0 Likes
605

for all entreis is to get the values into a internal table based on the values of another internal table.

select... from table into itab2 for all entries in itab1 where field = itab1-field.

field is common to both int tables.

see the programs demo_dynpro_tabcont_loop

demo_dynpro_tabcont_loop_at

for table controls.

Regards

- Gopi

Read only

Former Member
0 Likes
605

Hi,

One more thing is If u use <b>FOR ALL ENTRIES</b> no need of deleting duplicate records.

IF u use JOINS u have to write statement like delete adjacent duplicate .

Regards,

Kishore.

Read only

Former Member
0 Likes
605

hi ,

To add with Kranthi's statement.

Before writing For all entries we should check the Internal table is not empty. Otherwise it select all the values from the table irrespective of the condition . So it is the performence issus.

TableControl.

We can very well use ALV grids. But in the future if you want to do BDC we cannot proceed with ALV grids. this is one main advantage with Table control.

regards

Satish

Read only

Former Member
0 Likes
605

This message was moderated.