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

IF that does not work

Former Member
0 Likes
512

IF eq '#' does not work!

i debug and i can see the value # in the variable but never do the next line!

  1. is a char type or ?

DATA:

linea(20),

zlineas type n.

zlineas = STRLEN( linea ).

if zlineas NE 0.

zlineas = zlineas - 1.

describe field linea+zlineas(1) type zchar.

  • move linea+zlineas(1) TO zchar.

  • if not is numeric zchar.

<b> if linea+zlineas(1) = '#'.</b>

linea = linea(zlineas).

endif.

endif.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
486

HI Javier

I guess the '#' you see in debugging is End of Line Character.

Please try with below declarations and check if this works for you:

data: crlf(1) type c value cl_abap_char_utilities=>cr_lf,
         newline(1) type c value cl_abap_char_utilities=>new_line.

if <b>linea+zlines(1) = crlf or linea+zlines(1) = newline</b>.
  linea = linea(zlineas).
endif.

Hope this helps.

Kind Regards

Eswar

4 REPLIES 4
Read only

Former Member
0 Likes
486

Try declaring a variable and compare

constants : c_hash type c value '#'.

Use C_hash for comparison.

Regards,

Ravi

Read only

Former Member
0 Likes
486

I am assuming that you are seeing this '#' in debugging, not an actual character in that string. It may be some special character like a tab or new line character.

Read only

0 Likes
486

the problem is that both are char type (1).

there is no space for another weird character..

Read only

Former Member
0 Likes
487

HI Javier

I guess the '#' you see in debugging is End of Line Character.

Please try with below declarations and check if this works for you:

data: crlf(1) type c value cl_abap_char_utilities=>cr_lf,
         newline(1) type c value cl_abap_char_utilities=>new_line.

if <b>linea+zlines(1) = crlf or linea+zlines(1) = newline</b>.
  linea = linea(zlineas).
endif.

Hope this helps.

Kind Regards

Eswar