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

read table

Former Member
0 Likes
797

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

7 REPLIES 7
Read only

Former Member
0 Likes
772

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

Read only

Former Member
0 Likes
772

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.

Read only

Former Member
0 Likes
772

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 *********

Read only

Former Member
0 Likes
772

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

Read only

Former Member
0 Likes
772

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

Read only

Former Member
0 Likes
772

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

Read only

Former Member
0 Likes
772

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.