06-11-2007 10:18 AM
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
06-11-2007 10:20 AM
06-11-2007 10:20 AM
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
06-11-2007 10:20 AM
06-11-2007 10:22 AM
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
06-11-2007 10:23 AM
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..........
06-11-2007 10:23 AM
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
06-11-2007 10:24 AM
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
06-11-2007 10:49 AM
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