‎2007 Jan 31 11:59 AM
Dear All,
I have a question related to using a method of a class with parameters.
What is wrong with my code ?
DATA ref_Var TYPE REF TO CL_ABAP_STRING_UTILITIES.
Data sour(5) type c value 'First'.
Data dest type string.
CL_ABAP_STRING_UTILITIES->C2STR_PRESERVING_BLANKS( sour dest ).
Regards
Ilhan
‎2007 Jan 31 12:09 PM
Hi Ertas,
If CL_ABAP_STRING_UTILITIES is a static class then use
<b>CL_ABAP_STRING_UTILITIES=>C2STR_PRESERVING_BLANKS</b>
otherwise
create object and call like this
<b>ref_var->C2STR_PRESERVING_BLANKS</b>
‎2007 Jan 31 12:02 PM
It should be = not -
CL_ABAP_STRING_UTILITIES<b>=></b>C2STR_PRESERVING_BLANKS( sour dest ).
and the code should be
<b>call method CL_ABAP_STRING_UTILITIES<b>=></b>C2STR_PRESERVING_BLANKS
exporting
source = source
importing
DEST = dest.</b>
or
dest = CL_ABAP_STRING_UTILITIES<b>=></b>C2STR_PRESERVING_BLANKS( sour ).
Regards,
Ravi
Message was edited by:
Ravi Kanth Talagana
‎2007 Jan 31 12:18 PM
hello,
call method is running but the second way with
or
dest = CL_ABAP_STRING_UTILITIES=>C2STR_PRESERVING_BLANKS( sour ).
returns the error message:
C2STR_PRESERVING_BLANKS does not have a Returning Parameter.
You can not use it in expressions.
Does it mean the second way is worng or is there onother alternative.
Regards
Ilhan
‎2007 Jan 31 12:23 PM
Hi Ilhan,
What the error message says is right. You cannot use the second code. Sorry for that. It should have a return parameter instead of the exporting parameter to use it that way. YOu have to use it the other way only.
Regards,
Ravi
‎2007 Jan 31 12:05 PM
‎2007 Jan 31 12:12 PM
sorry but it doesn' t help. I get still error message :
ref_Var->C2STR_PRESERVING_BLANKS("
is not defined please check your spelling
‎2007 Jan 31 12:15 PM
Hi Ilhan,
Try this code:
report ZRTTEST .
Data sour(5) type c value 'First'.
Data dest type string.
call method CL_ABAP_STRING_UTILITIES=>C2STR_PRESERVING_BLANKS
exporting
source = sour
importing
DEST = dest.
write: dest.
Regards,
Ravi
‎2007 Jan 31 12:09 PM
Hi Ertas,
If CL_ABAP_STRING_UTILITIES is a static class then use
<b>CL_ABAP_STRING_UTILITIES=>C2STR_PRESERVING_BLANKS</b>
otherwise
create object and call like this
<b>ref_var->C2STR_PRESERVING_BLANKS</b>