cancel
Showing results for 
Search instead for 
Did you mean: 

Filter not allowed characters - carriage return/line feed?

manuel_busse
Explorer
0 Kudos

Hello community,

we're facing not allowed special characters in a unicode-BI 7.0 when extracting data via 0FI_GL_4. In the "freetext"-fields (e.g. reference key). Especially we face carriage return/line feed encoded as a square-symbol.

How could we filter this symbol out as we could not copy and paste it to a formula rule in the transformation.

Any ideas?

manuel

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185181
Active Contributor
0 Kudos

use this FM in your field routine. This will solve your problem.

SCP_REPLACE_STRANGE_CHARS

manuel_busse
Explorer
0 Kudos

Thank you!

We solved it this way since we just have to replace to unwanted characters yet:


DATA i_text type c length 60.

i_text = SOURCE_FIELDS-/BIC/ZMBS_FT1.

REPLACE ALL OCCURRENCES OF '#'
          IN i_text WITH ' '.

REPLACE ALL OCCURRENCES OF 'u25A1'
          IN i_text WITH ' '.

RESULT = i_text.

Former Member
0 Kudos

I would just have replaced all ascii < 32 with space rather than individual hits (then you will replace the tab settings as well as 0D0A ie CRLF)

manuel_busse
Explorer
0 Kudos

Thank you for that idea, Simon!

Since I am an ABAP-beginner, could you explain me how the code would look like?

manuel

Former Member
0 Kudos

Hi Manuel,

The following code should replace any char that has an ascii value < 32 with a ' ' (space).

Obviously please test this code and ensure it meets your requirements before implementing.

Regards, Robin


data: lv_length    LIKE sy-index,
      lv_index     TYPE sy-index,
      lv_decnum    TYPE i,
      lv_char(1)   TYPE c,
      lv_vstr(60)  TYPE c. "character string to validate

FIELD-SYMBOLS: <n> TYPE x.

lv_vstr = 'string to valid'.

* Obtain length of character string
      lv_length = STRLEN( lv_vstr ).

* For each character in the string, perform the validation
      DO lv_length TIMES.

        lv_index = sy-index - 1.

        lv_char = lv_vstr+lv_index(1).

        ASSIGN lv_char TO <n> CASTING.

        MOVE <n> TO lv_decnum.

        IF lv_decnum < 32.

          lv_vstr+lv_index(1) = ' '.

        ENDIF.

      ENDDO.