Skip to Content
0
Former Member
Feb 16, 2011 at 01:20 AM

General question for 'IN'

35 Views

Hi all,

Although this is simple, but I really do not understand why it does not work.

I have 4 conditions that need to be checked, in str4, the option is NP, but why it still meet the if statement condition below?

It seems like it is performing as OR instead of AND.

Please advise how could my code will be, if I do not want it to meet the If statement.

types: begin of tr_str,
            sign   type c length 1,
            option type c length 2,
            low    type co_sttxt,
            high   type co_sttxt,
           end of tr_str.
data: lr_str type range of tr_str,
      wr_str like line of lr_str,
      gv_str type co_sttxt.

wr_str-low    = 'str1*'.
wr_str-sign   = 'I'.
wr_str-option = 'NP'.
append wr_str to lr_str.

wr_str-low    = 'str2*'.
wr_str-sign   = 'I'.
wr_str-option = 'CP'.
append wr_str to lr_str.

wr_str-low    = 'str3*'.
wr_str-sign   = 'I'.
wr_str-option = 'NP'.
append wr_str to lr_str.

wr_str-low    = 'str4*'.
wr_str-sign   = 'I'.
wr_str-option = 'NP'.
append wr_str to lr_str.

gv_str = 'str4 str5 str6 str7'.
if gv_str in lr_str.
  write: / 'do something'.
endif.