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 question

Former Member
0 Likes
526

Hi every,

I got a question. I have the following code:

READ TABLE itab WITH KEY value = lv TRANSPORTING NO FIELDS.

IF sy-subrc IS INITIAL.

flag = 'X'.

ENDIF.

If I want to change the condition to " value <= lv ". Then how to rewrite the code? Thanks!

Regards

Pheily

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
506

Hi,

This is not possible in the read statment because read statment only returns one single record. This can only be acheived using LOOP WHERE...ENDLOOP .

regards,

Advait

3 REPLIES 3
Read only

Former Member
0 Likes
506

Hi,

maybe u can try to sth like this.

loop at itab where value <= lv.

flag = 'X'.

exit. " it will trigger after to have change the value of flag

endloop.

Regards

Read only

Former Member
0 Likes
507

Hi,

This is not possible in the read statment because read statment only returns one single record. This can only be acheived using LOOP WHERE...ENDLOOP .

regards,

Advait

Read only

Former Member
0 Likes
506

You would have to sort the table and use multiple READs, but it can be done.

Rob