Skip to Content
author's profile photo Former Member
Former Member

How to give OR in read

Hi all,

I need to write a READ statement for the below req.

I have one internal table as ITAB.

Loop at Itab1.

Read table ITAB2 with key ( CAN = Itab1-Value1 ) or

( CAN = Itab1-Value2 ).

endloop.

this is not working.How to give OR condn in Read statement

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 03, 2005 at 01:40 PM

    hi,

    you can't use or condition in the Read statement, for you try this

    Read table ITAB2 with key CAN = Itab1-Value1

    if sy-subrc <> 0

    Read table ITAB2 with key CAN = Itab1-Value2

    endif

    cheers,

    sasi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 03, 2005 at 01:44 PM

    You can also use another LOOP statement :

    LOOP AT Itab1.
      LOOP AT ITAB2 WHERE CAN = Itab1-Value1 
                       OR CAN = Itab1-Value2.
    
       ...
     
      ENDLOOP.
    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 03, 2005 at 01:54 PM

    Hi

    data can like itab2-can.

    Loop at Itab1.

    can = Itab1-Value1.

    do 2 times.

    Read table ITAB2 with key CAN = can.

    if sy-subrc = 0. exit. endif.

    CAN = Itab1-Value2.

    enddo.

    endloop.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.