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 Statement..?

subbarao_ilam
Explorer
0 Likes
590

Hi All,

In the read statement after key vbeln can I use conditions like AND, OR

to check multiple conditions..?

Read table I_ITEMS with key vbeln = I_INV_ITEMS-VBELN

posnr = I_INV_ITEMS-uepos

binary search.

Pls let me know.

subbu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
560

answer for your question is No.

In read statement we are not suppose to use any AND and OR.

But this question is a basic question.

Before posting the question please do the some research. This kind of questions can be solved by yourself.

4 REPLIES 4
Read only

Former Member
0 Likes
560

For that logic, I think we would want to do:

LOOP at <table> [ assigning <field-symbol>]

where...condition

and ( xxxx=xxxx or ( yyyy=yyyy and zzzz <> aaaa ) )

endloop.

Read only

Former Member
0 Likes
561

answer for your question is No.

In read statement we are not suppose to use any AND and OR.

But this question is a basic question.

Before posting the question please do the some research. This kind of questions can be solved by yourself.

Read only

vinod_vemuru2
Active Contributor
0 Likes
560

Hi,

Just READ the F1 help on READ. You will get the answer+ some bonus documentation:)

Try to use OR and see what it says.

FYI... Basic questions are not allowed in forums.

Thanks,

Vinod.

Read only

Former Member
0 Likes
560

No, READ statement allows only simple = condition. If you want stronger condition with >, <, <=, AND, OR etc. there is trick for it using the loop cycle.

DATA: is_items LIKE LINE OF i_items.
LOOP AT i_items INTO is_items 
   WHERE vbeln = i_inv_items-vbeln 
                AND posnr = i_inv_items-uepos 
                OR <some other condition>.
   EXIT.
ENDLOOP.

After that loop you will have your line in the structure IS_ITEMS.

So the key is to use LOOP with additional WHERE condition and inside use EXIT. This will safely simulate READ functionality with possibility of strong logical condition.

And dont forget to check sy-subrc after loop