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

Alternative to READ table

Former Member
0 Likes
5,554

Dear all,

We can not use READ TABLE with LOGICAL operators like LT, LE,GT,GE ..........

Is there any alternative to read a particular line from an internal table with the logical operators......

Thanks in advance...............

1 ACCEPTED SOLUTION
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
3,166

Better read table and then use IF condition.

Dear all,

We can not use READ TABLE with LOGICAL operators like LT, LE,GT,GE ..........

Is there any alternative to read a particular line from an internal table with the logical operators......

Thanks in advance...............

9 REPLIES 9
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
3,167

Better read table and then use IF condition.

Read only

Former Member
0 Likes
3,166

HI,

you can use Loop WIth Where clause.

LOOP AT ITAB WHERE <COND>.

.....

....

ENDLOOP.

Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
3,166

Hi,

U can loop the particular internal table as:

loop at itab into wa where filedname LT '200'.

do ur coding..

endloop.

check for sy-subrc.

if sy-subrc = 0...that means there is a record r more than one record.

hoe this will help u

Keerthi

Read only

Former Member
0 Likes
3,166

hiii

i think using LOOP statement with condition you can achieve this.

or you can use read statement and if sy-subrc eq 0 then use condition for LT or GT.

regards

twinkal.

Read only

Former Member
0 Likes
3,166

Hi Ubhka,

You can read the Internal table by two way 1) Using the Loop and 2) Using the Read statement.

1) Loop at itab into wa_itab. 
 
  If wa_itab-A LT = '200'
    * the action that you would like to perfrom like moving data from one table to another or appending   
     *data
  endif. 
    endloop.  

2) Read table itab into wa_itab. 
 
 if wa_itab-A LT = '200'
    * the action that you would like to perfrom like moving data from one table to another or appending   
     *data
  endif.

I my view you can try with the loop. Using loop would be a good idea.

Regards,

Kittu

Read only

Former Member
0 Likes
3,166

read table into work area and then apply logical test for this value in work area.

Read only

dev_parbutteea
Active Contributor
0 Likes
3,166

Hi,

Instead of read, in this case you can do a loop

loop at i_tab where field LE value.

do processing.

exit.

Endloop.

Regards.

Read only

Former Member
0 Likes
3,166

isue solved.........thanks for your replies.......

Read only

Former Member
0 Likes
3,166

you can also do a "DELETE itab WHERE condition" and then do your "READ TABLE", that way you won´t worry for your data being out of your range