‎2009 Dec 04 1:57 PM
Hi all Pandits,
I have an internal table 'itab1' containing a field 'field'.
I want to fill another internal table 'itab2' containing same 'field' from a 'dbtable'.
Now I want to use 'For All Entries' when fetch itab2 as it dbtable has got so many entries comparing that field <> itab1-field.
Concern is, when I am doing this I am getting, Iam not getting the required records, instead all the records from dbtable are coming. Why?
Can any pandit help me out here or can provide another way?
Regards
Vaibhav
‎2009 Dec 04 2:00 PM
Hi
First check the field is value in Itab1 is it same as u r expecting.And try to use the max keys when u r fetching the data.
Regards,
Raghu.
‎2009 Dec 04 2:03 PM
Yes Raghu,
I have checked the field value, itab1 is sorted. I am using keys. So everything as already taken care except the right one which willhelp to resolve my bizarre issue.
Reagrds
‎2009 Dec 04 2:02 PM
Do you check if table1 is empty? FOR ALL ENTRIES IN itab returns all rows in the FROM table when itab is empty.
‎2009 Dec 04 2:03 PM
Hi,
Before using FOR ALL ENTRIES you should check itab1 whether it is initial or not.
If you have not done this check and if no matching record is found in dbtable then all the records from Database Table are retrieved.
Regards,
lakshman.
‎2009 Dec 04 2:04 PM
‎2009 Dec 04 2:06 PM
‎2009 Dec 04 2:10 PM
Hi Raghav,
I am using all Z tables.
Issue is coming when I using '<>' operator with 'For All Entries'. But when I use '=', its giving the excact values which I require.
Can u pz check if even u are facing the same issue with '<>' operator?
Regards
Vaibhav
‎2009 Dec 04 2:12 PM
Can you please copy here part of your code?
1- data declaration of your internal tables
2- SQL where you fetch data for itab1
3- SQL where you fetch data for itab2
I cannot see any operator between your ''... and I think FAE conditions must be all equal ("=")
‎2009 Dec 05 6:36 AM
hi
before using for all entries first use if condition Eg .
ifi tab1[] is not initial.
select field from table
INTO CORRESPONDING FIELDS OF TABLE itba2
FOR ALL ENTRIES IN itab1
where field = itab1-field.
endif.
hope its helps you.
thanks,
Abhilash
‎2012 Feb 20 9:04 AM
Hi,
Make sure of the following:
1. Internal table 1 has values, else the result of select query will be all the records from database table.
2.The sequence of fields in Select query and the internal table2 should be the same .
Inttab1-field1, inttab2 --field1, dbtable-field1 are of same datatype.
if not inttab1[] is initial.
Select field1
from dbtable
into table inttab2
for all entries in inttab1
where field1 = inttab1-field1.
endif.
Regards,
Ramya
‎2012 Feb 20 9:29 AM
Hi,
Please paste your code for reference.
Regards,
Harsh Bansal
‎2012 Feb 20 9:52 AM
Try This
IF ITAB1[] IS NOT INITIAL.
SELECT FIELD FROM DBTABLE INTO CORRESPONDING FIELDS
OF TABLE ITAB2 FOR ALL ENTRIES IN ITAB1 WHERE FIELD1 = ITAB1-FIELD1.
ENDIF.