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 table

Former Member
0 Likes
630

Hi,

Suppose I have some records in my internal table. I got all the records through FM.

Now I wanted to read the records based on following selection

read table itab with key LAND1 <> 'US'.

But I am getting error.

anybody will help me for this??

6 REPLIES 6
Read only

Former Member
0 Likes
607

Read table will not work with not equl to.

Read only

Former Member
0 Likes
607

Hi Salil, Read only reads one record at a time...not multiple records.One thing which can be done here is move the data to another internal table and then use the delete the data from that internal table where land1 NE 'US'.

Regards,

Swaroop

Read only

Former Member
0 Likes
607

Hello ,

I dont think you can use <> in read table statement.

What i would suggest is try the follwoing code.

loop at itab where land1 NE 'US'.

  • Do your processing and exit from this loop

ENDLOOP.

Read only

Former Member
0 Likes
607

REad table would get the required recod into the header .

In can hold only one record at a time.

But for your condition, there may be so many records (NOT equal).

hence you have to use the following syntax instead.

loop at itab where land <> 'US'.

  • write your logic here.

move itab-field to <target>

exit.

endloop.

Regards,

Ravi

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
607

Hi,

loop at itab where land1 ne 'US'.

...

endloop.

Read only

Former Member
0 Likes
607

Hi,

Read table syntex will not support <> operator. You can use the following option:

Loop at itab into lw_itab where land1 <> 'US'.

  • here u may move all the records to another internal table where land1 will

*not be 'US' and then if u need u can read that new internal table with key

*fields.

Endloop.

Cheers.