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: 

Removing in # symbol in text .

Former Member
0 Kudos

Hi experts ,

This is the code in develpment server to remove # symbol in the purchase order text

SPLIT p_text AT c_# INTO l_text l_text1.

REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN l_text WITH ' '.

REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN l_text1 WITH ' '.

CONCATENATE l_text l_text1 INTO p_text SEPARATED BY ' '.

It is working fine in Development server , however , it is not working in PRODUCTION SERVER.

before writing the above code , i tried the code below .

REPLACE ' # ' WITH ' ' INTO p_text.

Even it is also not working in production server .

could you please tel me any alternative other than REPLACE AND SPLIT commands .

Pls.help in this regard .

Regards ,

kiran

1 ACCEPTED SOLUTION

Former Member
0 Kudos

'#' will come in your text is you press 'Enter' in the text editor. This is special character for 'Enter' . You can not remove it using 'REPLACE'.

Use FM 'CONVERT_STREAM_TO_ITF_TEXT' to remove special characters.

DATA: gt_text TYPE TABLE OF tline WITH HEADER LINE,

gt_stream TYPE TABLE OF char255 WITH HEADER LINE.

CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'

EXPORTING

language = sy-langu

TABLES

itf_text = gt_text[]

text_stream = gt_stream[].

gt_text is your output table without any special character.

gt_stream is input stream with special character

Regards,

Aparna

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try like this.....



data : lv_special_chars TYPE CHAR50 value '#'.
translate p_text using lv_special_chars.

Hope it will helps

Former Member
0 Kudos

'#' will come in your text is you press 'Enter' in the text editor. This is special character for 'Enter' . You can not remove it using 'REPLACE'.

Use FM 'CONVERT_STREAM_TO_ITF_TEXT' to remove special characters.

DATA: gt_text TYPE TABLE OF tline WITH HEADER LINE,

gt_stream TYPE TABLE OF char255 WITH HEADER LINE.

CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'

EXPORTING

language = sy-langu

TABLES

itf_text = gt_text[]

text_stream = gt_stream[].

gt_text is your output table without any special character.

gt_stream is input stream with special character

Regards,

Aparna

0 Kudos

Hello Aparna,

I am using same function module

      CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'

        EXPORTING

          language    = sy-langu

        TABLES

          itf_text    = gt_text[]

          text_stream = gt_stream[].

The special characters get removed, but I have one problem with this one.

If the data received is of the form excel table, then the columns are converted to TABs which are interpreted as next line and the formatting is disturbed.

Do we have solution for this?

Regards,

Kumail