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: 

for all entries

Former Member
0 Kudos
132

hi

while doing FOR ALL ENTRIES what care we should take? can u plz explain it?

thanks in advance

bramara

1 ACCEPTED SOLUTION

Former Member
0 Kudos
94

the Internal table has contains records or not

IF NOT IT[] is INITIAL>

select

.

.

.

for all entries in it

ENDIF..

- Selva

6 REPLIES 6

Former Member
0 Kudos
95

the Internal table has contains records or not

IF NOT IT[] is INITIAL>

select

.

.

.

for all entries in it

ENDIF..

- Selva

Former Member
0 Kudos
94

hi,

check that internal table should have data on which u giving for all entry by

If itab[] is not initial.

select....

endif.

othrwise select statement select all the data from database table without matching condition....

reward if useful....

Former Member
0 Kudos
94

Also refer to the fields of the internal table in where condition in your select query

Former Member
0 Kudos
94

Hi Bramara,

Code the following.......

for all entries of first int table it will select further.

If not itab[] is initial.

select f1 f2 f3 f4

from table****

into table itab1

for all entries in itab

where f1 = itab-f1

and f2 = itab-f2.

endif.

if it is helpfull pls reward pts.

Regards

Srimanta

Former Member
0 Kudos
94

Hi,

In a join, the tables (base tables) are combined to form one results table. The join conditions are applied to this results table. The resulting composite for an inner join logic contains only those records for which matching records exist in each base table.

Join conditions are not limited to key fields.

If columns from two tables have the same name, then you have to ensure that the field labels are unique by prefixing the table name or a table alias.

A table join is generally the most efficient way to read from the database. The database is responsible for deciding which table is read first and which index is used (DB Optimizer).

At LEFT OUTER JOIN, results tables can also contain entries from the designated left hand table without the presence of corresponding data records (join conditions) from the table on the right. These table fields are filled by the database with null values and are then initialized according to ABAP type.

It makes sense to use a LEFT OUTER JOIN when data from the table on the left is needed for which there are no corresponding entries in the table on the right.

The following limitations apply for the Left Outer Join:

you can only have a table or a view to the right of the JOIN operator, you cannot have another join statement

Only AND can be used as a logical operator in an ON condition.

every comparison in the ON condition must contain a field from the table on the right.

if the FROM clause contains an Outer Join, then all ON conditions must contain at least one 'true' JOIN condition (a condition that contains a field from tab1 and a field from tab2).

-


FOR ALL ENTRIES works with a database in a quantity-oriented manner. Initially all data is collected in an internal table. Make sure that this table contains at least one entry (query sy-subrc or DESCRIBE), otherwise the subsequent transaction will be carried out without any restrictions).

SELECT...FOR ALL ENTRIES IN is treated like a SELECT statement with an external OR condition. The system only selects those table entries that meet the logical condition .

Using FOR ALL ENTRIES is recommended when data is not being read from the database, that is, it is already available in the program, for example, if the user has input the data. Otherwise a join is recommended.

The easiest technical option for reading from multiple (dependent) tables is to use nested SELECT statements. The biggest disadvantage of this method is that for every data record contained in the external loop a SELECT statement is run using the database. This leads to a considerably worse performance in client/server systems.

I think you got some clear idea on this .

Regds

Parvathi

Please reward points if helpful...

Former Member
0 Kudos
94

Hi,

Functionaly.

say suppose,

VBAK (Sales Order Header)

VBAP (Sales Order Details) tables are there,

for a sales order number there can be one detail or more than one details.

ie, sale order number (say) 00001,

for this sales order number there can be 1 or more line items like. pen, AC, pencil, etc..

(simply think somebody orders (customer) and somebody sells (company)).

so, here FOR ALL ENTRIES will come for VBAP why?

by this what i am trying to explain is for every VBAK (sales order number) select the VBAP(items).

technically:

select * from VBAP into internal table for all entries in VBAK where sales order = VBAK-sales order.

For all entries will be applicable to those tables which has Parent child relationship.

Edited by: jagannathan krishnan on Dec 27, 2007 2:35 PM