07-06-2007 9:53 AM
Hi,
I am trying to write the following code
if l_betrg ca '#'.
g_error = 'X'.
endif.
but even if l_betrg contains #, it is not going to g_error = 'X'
Could you please tell me where i am going wrong..I need to identify if l_betrg contains #. l_betrg is defined as
data: l_betrg(13) type c.
Thanks
Pranati
07-06-2007 9:56 AM
try this..
if l_betrg ca <b>CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.</b>
g_error = 'X'.
endif.
<b>OR</b>
if l_betrg ca <b>CL_ABAP_CHAR_UTILITIES=>CR_LF.</b>
g_error = 'X'.
endif.
07-06-2007 9:56 AM
try this..
if l_betrg ca <b>CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.</b>
g_error = 'X'.
endif.
<b>OR</b>
if l_betrg ca <b>CL_ABAP_CHAR_UTILITIES=>CR_LF.</b>
g_error = 'X'.
endif.
07-06-2007 10:02 AM
07-06-2007 10:04 AM
it depends on the unicode , even i am not sure about that...
it works sometimes and sometimes not...
07-06-2007 9:58 AM
Try this -
str1 type string value '#.
str2 type string.
move l_betrg to str2
if str2 cs str1.
g_error = 'X'.
endif.
Regards,
Amit
reward all helpful replies.
07-06-2007 9:59 AM
Your test case scenario doesn't happen... There might be a mistake in the content of the Variable... Please check the code.
Regards,
Pavan P.
07-06-2007 10:00 AM
07-06-2007 10:01 AM
Hi,
Check in debug mode if this actually contains '#' may its a case that it contains some value which is getting displayed as #.
Regards,
Sesh
07-06-2007 10:02 AM
i tried ur code.its working absolutely fine!!
data i_betrg(13) type c.
data g_error(1).
i_betrg = '#1234'.
if i_betrg ca '#'.
g_error = 'X'.
endif.
write g_error.
rgds
07-06-2007 10:02 AM
Hi,
I think CA operator checks to see whether any letter in field1 is in field2.
Reward if helpful
Regards
Raghavendra.D.S
07-06-2007 10:04 AM
Hi,
actual probem is "#" is not a value.... its just showing the deliminator..... u cant use in the condition.... actually sap use it when its unidentified value
sign just determine the space or deliminator.....its actuall value is not a "#"... thats why your condition is being false..
regards,
shardul shah
Message was edited by:
Shardul Shah