Skip to Content
avatar image
Former Member

Removing in # symbol in text .

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 03, 2008 at 08:57 AM

    '#' 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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Oct 03, 2008 at 08:33 AM

    Hi,

    Try like this.....

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

    Hope it will helps

    Add comment
    10|10000 characters needed characters exceeded