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

CAN I USE 2 FOR ALL ENTRIES IN A SINGLE SELECT STATMENT

FOR JOINING 3 DATABASE TABLE

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Ashok,

No. You can use for all entries only one time in select.

If you want to join 3 tables.logic should be.

1. select data into first table

2. select data into second table for all entries in first table

3. select data into third table for all entries in first or second table.

Reward points if useful,

Aleem.

5 REPLIES 5

Former Member
0 Kudos

For all entries can be used only once in a select statement. For joining 3 tables, you can use the join addition with the select statement provided the joined tables have at least one common field.

Former Member
0 Kudos

Hi

- For example:

SELECT-OPTIONS: SO_VBELN FOR VBAK-VBELN.

U can write:

SELECT ............... FROM VBAK INNER JOIN VBAP ON VBAK-VBELN = VBAP-VBELN

or

SELECT * FROM VBAK INTO TABLE T_VBAK WHERE VBELN IN SO_VBELN

SELECT * FROM VBAP

FOR ALL ENTRIES IN T_VBAK WHERE VBELN = T_VBAK-VBELN.

- When u use SELECT SINGLE statament the system'll try to active certain strategies to improve the reading performance, i.e. it'll try to use the primary index, but it can use only if you use all key fields in WHERE condition.

So if you need to get the first record and you can't use all keys in WHERE condition it would be better use SELECT UPTO ONE ROW than SELECT SINGLE

Regards

Former Member
0 Kudos

No matter how many database tables you join, you can't use 2 FOR ALL ENTRIES in your SELECT query.

Regards,

Pavan

Former Member
0 Kudos

Hi,

You cannot use 2 for all entries. You will have to use Joins.

Regards,

Shruthi R

Former Member
0 Kudos

Hi Ashok,

No. You can use for all entries only one time in select.

If you want to join 3 tables.logic should be.

1. select data into first table

2. select data into second table for all entries in first table

3. select data into third table for all entries in first or second table.

Reward points if useful,

Aleem.