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: 

not equal in read ststement

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member404244
Active Contributor
0 Kudos

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

3 REPLIES 3

former_member404244
Active Contributor
0 Kudos

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

former_member386202
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.