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

using 'read table' command

Former Member
0 Likes
509

how to read more than one record that matches with the key

read table itab with key k1 = v1 ........................

thanks and regards

Cnu

4 REPLIES 4
Read only

Former Member
0 Likes
492

if more than 1 record matches then we can't use READ tsatement instead we need to use LOOP statement....

Loop at itab1.

Loop at itab2 where key1 = itab1-key1.

<do ur statements>.

endloop.

endloop.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
492

In that case, you should use the LOOP statement with a WHERE clause instead of the read statement.

loop at itab where k1 = v1.

endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
492

hi,

for more than one record,

u have to loop through the table. and u can add where condition to the loop statement to restrict entries.

regards,

madhu

Read only

johndeconinck
Participant
0 Likes
492

Or if conditions are more complex, you can exit the loop for the records you don't want:

Example:

loop at tab.

if tab-field1 cs 'A'.

exit.

endif.

do some stuff.

endloop.

Kind regards,

John.