Application Development 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: 

Reading a table with multiple conditions

Former Member
0 Kudos
14,427

Hi,

Can we read a internal table by specifying more htan one condition. For eg, READ ITAB WITH KEY IT_MARA-MATNR AND IT_MARC-WERKS AND IT_MARD-LGORT.

If we write like this..is this correct logic...

thanks,

Ram.

1 ACCEPTED SOLUTION

Former Member
2,428

Hi,

Correct syntax would be :

READ ITAB WITH KEY IT_MARA-MATNR

IT_MARA-WERKS

IT_MARA-LGORT.

AND should not be specfied.

Pls reward points if useful.

Shruthi

Edited by: Shruthi R on Jun 9, 2008 6:11 AM

3 REPLIES 3

Former Member
2,429

Hi,

Correct syntax would be :

READ ITAB WITH KEY IT_MARA-MATNR

IT_MARA-WERKS

IT_MARA-LGORT.

AND should not be specfied.

Pls reward points if useful.

Shruthi

Edited by: Shruthi R on Jun 9, 2008 6:11 AM

Former Member
0 Kudos
2,428

loop at it_mara.

read table it_marc with key matnr = it_mara-matnr.

read table it_mard with key matnr = it_mara-matnr.

..

..

..

endloop.

Former Member
2,428

Hi,

You can read internal table by specifying more than one condition.

But you need not use AND key word for that, follow up with next condition too...

example


read table itab into watab with key matnr = p_matnr
                                                  gjahr = p_gjahr
                                                  werks = p_werks.

Reward points if this helps,

Kiran