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

meaning

Former Member
0 Likes
572

Hi Friends,

I wanted to know the meaning of following code

loop.

loop at lt_tab to ls_tab.

if not ls_tab-f1 in S_f1.

l_flag = 'X'.

exit.

endif.

endloop.

if not l_flag is initial.

continue.

endif.

endloop.

Anybody will tell me pls what is the meaning of if not ls_tab-f1 in S_f1?

4 REPLIES 4
Read only

Former Member
0 Likes
536

Hello Neha,

if not ls_tab-f1 in S_f1 means S_F1 may be a range table.

So they are check is_itab-f1 value is not in that range table.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
536

Anybody will tell me pls what is the meaning of if not ls_tab-f1 in S_f1?

Basically the above condition checks the data for field f1 in ls_tab in the select-option for s_f1. If the data is not found than the condition is true.

In short, if the data for field f1 is not in S_f1. the flag l_flag would be set to 'X'.

Read only

Former Member
0 Likes
536

Hi Neha,

In a logical expression with language element IN, the conditions of a selection table are checked. Selection table is a global internal table with a header line, the columns SIGN, OPTION, LOW and HIGH and the name of a selection criterion. Information about these columns you can find in the description of the select-options statement.

So the statement

 if not ls_tab-f1 in S_f1 

means that the code under it will be performed if the field f1 of structure ls_tab doesn't satisfy the conditions in the table s_f1.

P.S.I see you are novice at this forum. So I kindly ask you to mark all of your questions as answered and award points for helpful answers.

Message was edited by:

Pavel Aleshko

Read only

Former Member
0 Likes
536

HI Neha,

Seems you are trying to check value from your SELECT-OPTION in the loop of internal table.

Refer sample code ...

tables:mara.

select-options: s_f1 for mara-MTART.

types: begin of ty_itab,

Document type char4,

type1 type char4,

end of ty_itab.

data: wa_itab type ty_itab,

wa_itab1 type ty_itab,

itab type standard table of ty_itab.

wa_itab-document = '1000'.

wa_itab-type1 = '1234'.

append wa_itab to itab.

clear wa_itab.

wa_itab-document = '1001'.

wa_itab-type1 = '12345'.

append wa_itab to itab.

clear wa_itab.

wa_itab-document = '1002'.

wa_itab-type1 = ''.

append wa_itab to itab.

clear wa_itab.

<b><b>data: wa_selopt type selopt.</b></b>

loop at itab into wa_itab.

if wa_itab-document in s_f1.

write:/ 'true'. " can check your flag l_flag = X

elseif.

Continue.

endif.

endloop.

Copy this code and execute. Enter 1000,1001 & 1002 in select-option and see in Debug mode. will understand better.

Reward pints if this helps.

Manish

Message was edited by:

Manish Kumar