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: 

use of for all entries

Former Member
0 Kudos

can i use an inequality option in for all entries, i mean....

select * from <ZTABLE>

into table itab

for all entries in itab2

where field1 NE itab2-field2.

Regards

Pratyusha

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Yes,U can Use.

Regards,

Padmam.

7 REPLIES 7

0 Kudos

Hi,

You can use NE when you are using FOR ALL ENTRIES, but its always good to use +ve checks like = or IN where ever possible than NOT IN and <>.

Perfromance is better for + ve checks.

Regards,

Sesh

Former Member
0 Kudos

Hi,

Yes,U can Use.

Regards,

Padmam.

Former Member
0 Kudos

Hi Patyusha,

Yes U can definitely use the negative checks while using FOR ALL ENTRIES, but it is always better in a performance point of view to avoid such usage.

Regards,

Kiran

Former Member
0 Kudos

Hi,

No you can not use inequaltiy option. it is manadatory to have one common field between two tables for using "for all entries". and you have to specify common field in where condition.

regards,

Ruchika

reward if useful..........

Former Member
0 Kudos

HI,

To avoid nested select statements we use SELECT FOR ALL ENTRIES statement.

If there r more than 10000 records SELECT FOR ALL ENTRIES is used.

Performance wise SELECT FOR ALL ENTRIES is better to use.

Note: before using for all entries u should check internal table is empty or not.

Regards

suresh.d

Former Member
0 Kudos

hi,

try this,

data: itab like bsik OCCURS 0 WITH HEADER LINE.

data: lfa1 like lfa1 OCCURS 0 with header line.

select * from bsik into TABLE itab up to 4 rows.

select * from lfa1 into table lfa1 UP TO 3 rows

FOR ALL ENTRIES IN itab

where lifnr ne itab-lifnr.

if sy-subrc eq 0.

endif.

regards,

venkatesh

Former Member
0 Kudos

Hi,

Performance wise FOR ALL ENTRIES IS USEFUL

You can only use FOR ALL ENTRIES IN ...WHERE ...in a SELECT statement.

SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns the union of the solution sets of all SELECT

statements that would result if you wrote a separate statement for each line of the internal table replacing the symbol

itab-f with the corresponding value of component f in the WHERE condition.Duplicates are discarded from the result

set. If the internal table itab does not contain any entries, the system treats the statement as though there were

no WHERE cond condition, and selects all records (in the current client).

for example:

SELECT * FROM sflight INTO wa_sflight

FOR ALL ENTRIES IN ftab

WHERE CARRID = ftab-carrid AND

CONNID = ftab-connid AND

fldate = '20010228'.

this condition, return all entries of the sflight

Regards