Application Development 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: 

Using IF with IN and CP

Former Member
0 Kudos

Hi all,

probabily I'm loosing something, but I cannot understand why this code goes wrong, not selecting properly only 1 of the 2 record.

Thank You

REPORT zpn_test.
RANGES:  r_range  FOR  usr01-spld.
DATA:  lt_usr01 TYPE TABLE OF usr01 WITH HEADER LINE.
r_range-sign  = 'I'.
r_range-option = 'CP'.
r_range-low  = '+*'.
APPEND r_range.
lt_usr01-bname = 'user_w_spd'.
lt_usr01-spld  = 'LOCL'.
APPEND lt_usr01.
lt_usr01-bname = 'user_wo_spd'.
lt_usr01-spld  = ''.
APPEND lt_usr01.
LOOP AT lt_usr01.
  IF lt_usr01-spld IN r_range .
  WRITE: / 'user with printer',  AT 20 '>',lt_usr01-bname,'<', '>',lt_usr01-spld,'<'.
  ELSE.
  WRITE: / 'user without printer', AT 20 '>',lt_usr01-bname,'<', '>',lt_usr01-spld,'<'.
  ENDIF.
ENDLOOP.<br>

1 ACCEPTED SOLUTION

TMSingh_SAP
Participant
0 Kudos

Hi Robert,

When doing a check on space, we also have to exclude space. pls also add in r_range and see

r_range-sign  = 'E'.  " exclude
r_range-option = 'EQ'.
r_range-low  = ' '.
APPEND r_range.

2 REPLIES 2

TMSingh_SAP
Participant
0 Kudos

Hi Robert,

When doing a check on space, we also have to exclude space. pls also add in r_range and see

r_range-sign  = 'E'.  " exclude
r_range-option = 'EQ'.
r_range-low  = ' '.
APPEND r_range.

0 Kudos

Thank You mohan.

Your solution is good, I'll use it.

It's look like a "remedy" to some problem in using che condition CP '+*', that already (has to) not match fields "space".

Thank You again