‎2007 Jan 16 4:22 AM
hai all,
i have one basic doubt .
i have two internal tables itab1 and itab2.
itab1 has all records with duplicate entries.
itab2 is another table which has duplicate entries. key fields are same as above internal
table.
then if we use read table we will get only one record at a time. but i have two check all entries .
to use read table the primary keys of table is compulsary or i can search with another field which is not primary key also.
please suggest me
thanks,
laxmi
‎2007 Jan 16 4:28 AM
No. Primary key is not compulsary. Read will retun you the first match it will hit with the condition you have mantioned.
- Guru
Reward points for helpful answers
‎2007 Jan 16 4:28 AM
Hi laxmi,
We can you non-primary key fields for Read statement. But if there is more than one entry with the same key, the system returns the first.
(Rewared helpful answers)
Regards,
Siddhesh Sanghvi.
‎2007 Jan 16 4:28 AM
Hi Laxmi,
Using Read table u can mention non key fields (its not mandatory)
But then also Read Table will fetch only one record.
For getting more than one record use LOOP AT table WHERE conditions.
Here u can use any field in WHERE-clause.
Hope this helps u.
Reward points for helpful Answers *********
‎2007 Jan 16 4:33 AM
you can use non key field also in your read command but the condition you are using it must be unique row identification other wise you will not get the result which you want. or you may do one thing loop inside loop but it will decrease the performance. so better to use read command if you can able to define your row uniqely.
regards
shiba dutta
‎2007 Jan 16 4:35 AM
Hi,
Look for a field which is getting changed every time in the table. it does not matter whether it is a primary or non primary key.
thanks
shiva
‎2007 Jan 16 4:39 AM
Hi,
if u want to read all the records in the internal table using READ statement then use INDEX method in the read stmt.
Regards,
Aravind
‎2007 Jan 16 5:06 AM
Hi Laxmi,
It is not compulsary to give key fields for read statements. You can give any field to check between two internal tables and then seperate it if you want. Loop at itab2 if you want all the records to be checked instead of doing it for a single record and use read statements to check for the duplicate entries.
One more way is if you have duplicate entries in itab2 then just delete those entries using "delete adjacent duplicates" statement.
Mark all helpful answers.