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

not equal in read ststement

hi,

if I use not equal to in read statemnet i an SYNTAX error

READ TABLE itab INTO itab_wa

WITH KEY MATNR NE jtab--MATNR.

AND ALSO

READ TABLE itab INTO itab_wa

WITH KEY MATNR NE ''.

HOW TO WRITE READ STATEMENT WITH NOT EQUAL TO?

Message was edited by:

venkat s

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Dec 03, 2007 at 08:35 AM

    Hi,

    U cannot use NE sign while using READ statement...

    so do like this

    READ TABLE itab INTO itab_wa

    WITH KEY MATNR Eq jtab--MATNR.

    if sy-subrc ne 0.

    now do whatever u want

    endif.

    similarly

    READ TABLE itab INTO itab_wa

    WITH KEY MATNR eq jtab-matnr.

    if sy-subrc ne 0.

    now do whatever u want

    endif.

    Regards,

    nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2007 at 08:43 AM

    Hi,

    You can use not equal to in read table statement.

    do like this

    loop at itab1 into wa1

    Read table itab2 intop wa2 with key field = wa1-field

    binary search.

    if sy-subrc eq 0.

    if field2 NE wa1-field2 " check Your not equal to condition here

    statement

    endif.

    endif.

    endloop.

    Regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 10:01 AM

    Hi Venkat,

    Read Statement is able to Read only one Record i.e., one line if you use NE it may contains more records so it is not possible to use NE in Read Statement.

    example:

    Itab Contains 1,2,3,7,8.

    in that you use itab-num NE 1

    you get 2,3,7,8.

    Reward if useful,

    Mahi.

    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.