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

small query....

Former Member
0 Likes
724

Hi frnds,

In case of FOR ALL ENTRIES, we are checking the prerequisite,

whether the table contains data or not, by using

if TABLE IS NOT INITIAL.

my doubt is, if we doesn't use the statement IF TABLE IS NOT INITIAL, then what happens.................kindly let me know the ans..

regards,

rav.

7 REPLIES 7
Read only

Former Member
0 Likes
695

Then all the data of second database table (i.e. one in next SELECT statement ) will be selected.

regards,

anirban

Read only

bpawanchand
Active Contributor
0 Likes
695

Hi

well if table is initial then what it will read so teh SY-SUBRC value will be 4.

Regards

pavan

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
695

If you do NOT check that the table has data, then the next SELECT statement with the FOR ALL ENTRIES, will bring back ALL records for that database table, and this would be wrong, and take a lot of time, potentiallly.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
695

Hi RAVKP ,

Even though if u don't use if TABLE IS NOT INITIAL.statement it will work unless the table contains value .

Regards,

Vikram.S

Read only

Former Member
0 Likes
695

Hi,

1. If we don't check IF ITAB[] is not inital,

then suppose the itab does not have any records.

So logically, we should not get any matching records.

2. BUT, it does not happen, and the system fetches

ALL records.

It is similar as if we had not written/used for all entries.

regards,

amit m.

Read only

Former Member
0 Likes
695

hiii

if data is there in first internal table then if you use select with for all entries without using if TABLE IS NOT INITIAL..then it will not effect...but if data is not there then how select query will work as it will have JOIN condition with for all entries like

SELECT matnr " Material Number

werks " Plants

prctr " Profit Center

FROM marc

INTO TABLE i_marc

FOR ALL ENTRIES IN i_mara

WHERE matnr = i_mara-matnr

AND werks IN s_werks.

in this if i_mara will not have any value then this statement wil not work properly..so it will give you a wrong output or error.

regards

twinkal

Read only

Former Member
0 Likes
695

Hi,

It will bring all the data records from the corresponding table.

suppose

select carrid

connid

for all entries t_spfli

from sflight.

where carrid eq t_spfli-carrid.

in this case if t_spfli is empty

then it will bring all records irrespective condition from sflight.