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

REPLACE '#' WITH ' '

Former Member
0 Kudos
840

Hi Experts,

i hope you can help me. I have to upload an excel sheet by FM 'TEXT_CONVERT_XLS_TO_SAP'. The result that i get contains a string that could implement line breaks. This line breaks are each identified by '#'.

Before the string is displayed the '#' has to be replaced. I have tempted it with

REPLACE '#' WITH ' ' but i get no positiv result.

Can anyone assist me to resolve this problem?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
698

It depends on what you wanna do with it. Those '#' are special characters to indicates new line or tab. You need to use the abap objects CL_ABAP_CHAR_UTILITIES to fix this issue.

Sample codes:

  • This code will split up the

REPLACE CL_ABAP_CHAR_UTILITIES=>NEWLINE IN myString WITH SPACE.

5 REPLIES 5
Read only

Former Member
0 Kudos
698

hi Florian,

do this way ..


replace all occurrences of 
  cl_abap_char_utilities=>CR_LF in str with space.

or


replace all occurrences of cl_abap_char_utilities=>HORIZONTAL_TAB
in str with space.

REgards,

Santosh

Read only

Former Member
0 Kudos
698

data temp_fill_string(50) type c value 'sfg###sjndks###fifis'.

translate temp_fill_string using '# '.

write temp_fill_string .

Message was edited by:

sunil kumar

Read only

Former Member
0 Kudos
698

Hi,

Replace # with CL_ABAP_CHAR_UTILITIES=>NEWLINE in the text, this will give the next text in the new line

Regards

Sudheer

Read only

Former Member
0 Kudos
699

It depends on what you wanna do with it. Those '#' are special characters to indicates new line or tab. You need to use the abap objects CL_ABAP_CHAR_UTILITIES to fix this issue.

Sample codes:

  • This code will split up the

REPLACE CL_ABAP_CHAR_UTILITIES=>NEWLINE IN myString WITH SPACE.

Read only

0 Kudos
698

Hi all,

thanks a lot. I've resolve the problem with Thungs answer. The replace statement by santosh does not work. I get the correct result from

REPLACE CL_ABAP_CHAR_UTILITIES=>NEWLINE IN myString WITH SPACE.

Thanks.