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 ITAB USING LOGICAL EXPRESSIONS

Former Member
0 Likes
1,197

Hi,

Could anybody explain me why we cant use logical expression like OR while reading the data from an Internal table using the following command?

READ TABLE itab INTO wa_itab WITH KEY f1 = 'AB' f2 = 'CD'.

Cheers

Mohan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
708

Hi,

For Reading Internal We Can use Key Field Or Index Method.

So If You Read Internal Table By Keys Then,

Statement is

READ TABLE ITAB WITH KEY f1,

When We Read table by table index then,

READ TABLE ITAB INTO WA INDEX n.

This The Syntax.

Thanks.

Edited by: Sujit Pal on Jun 27, 2008 6:02 AM

Edited by: Sujit Pal on Jun 27, 2008 6:11 AM

4 REPLIES 4
Read only

nikhil_chitre
Active Participant
0 Likes
708

Hi,

How have you defined your Internal table.

try like this

data: itab like STANDARD TABLE OF z_table_name WITH HEADER LINE.

Regards,

Nikhil

Read only

Former Member
0 Likes
708

Hi Mohan,

I think it's the syntax of the Read table statement. But you can make a work around depending on your requirement. Hope this will help you.

Rewards if useful.

Regards,

Mark

Read only

Former Member
0 Likes
709

Hi,

For Reading Internal We Can use Key Field Or Index Method.

So If You Read Internal Table By Keys Then,

Statement is

READ TABLE ITAB WITH KEY f1,

When We Read table by table index then,

READ TABLE ITAB INTO WA INDEX n.

This The Syntax.

Thanks.

Edited by: Sujit Pal on Jun 27, 2008 6:02 AM

Edited by: Sujit Pal on Jun 27, 2008 6:11 AM

Read only

Former Member
0 Likes
708

Hi Mohan,

The concept of key in Internal table is not exactly as it in database table. They just refer a specific column is the form of a set of values representing the very row of internal table by which you may compare the values only.

We use logical operator for single value variables or field value of Database table only as they are unique. That's why the syntax of READ is framed in such a way that you won't get any scope to give Logical operator to them.

Reward if found helpful.

Anirban Bhattacharjee