RSKC - транзакция где определяется набор разрешенных символов
предустановленные константы - 'ALL_CAPITAL' и 'ALL_CAPITAL_PLUS_HEX'
RSKC_ALLOWED_CHAR_GET - FM, доступные символы
SCP_REPLACE_STRANGE_CHARS - FM, стандартный, который может помочь.
Пример вызова (для RU)
CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
EXPORTING
INTEXT = SOURCE_FIELDS-SGTXT
* INTEXT_LG = 0
INTER_CP = '1501'
* INTER_BASE_CP = '0000'
* IN_CP = '0000'
* REPLACEMENT = 46
IMPORTING
OUTTEXT = RESULT
* OUTUSED =
* OUTOVERFLOW =
* EXCEPTIONS
* INVALID_CODEPAGE = 1
* CODEPAGE_MISMATCH = 2
* INTERNAL_ERROR = 3
* CANNOT_CONVERT = 4
* FIELDS_NOT_TYPE_C = 5
* OTHERS = 6
.
*IF SY-SUBRC <> 0.
** Implement suitable error handling here
*ENDIF.
-----------------
FUNCTION Z_BW_CLEAR_ILLEGAL_SYMB.
*"----------------------------------------------------------------------
*"*"Локальный интерфейс:
*" CHANGING
*" REFERENCE(CHANGING_VALUE)
*"----------------------------------------------------------------------
Constants:
l_x_A0 type X value 'A0'
, l_x_C2 type X value 'C2'
, l_x_09 type X value '09'
, l_x_20 type X value '20'
.
Data: int TYPE I
, buffer TYPE XSTRING
, l_x_D0A0 type XSTRING
, l_x_D009 type XSTRING
, l_result TYPE /BI0/OICRM_DESCR
, conv TYPE REF TO cl_abap_conv_out_ce
, conv2 TYPE REF TO cl_abap_conv_in_ce
.
l_x_D0A0 = 'D0A0'.
l_x_D009 = 'D009'.
l_result = CHANGING_VALUE.
int = strlen( l_result ).
conv = cl_abap_conv_out_ce=>create(
encoding = 'UTF-8'
endian = 'L'
).
CALL METHOD conv->write( data = l_result n = int ).
buffer = conv->get_buffer( ).
replace all occurrences of l_x_D0A0 in buffer with l_x_20 in byte mode.
replace all occurrences of l_x_D009 in buffer with l_x_20 in byte mode.
replace all occurrences of l_x_A0 in buffer with l_x_20 in byte mode.
replace all occurrences of l_x_C2 in buffer with l_x_20 in byte mode.
replace all occurrences of l_x_09 in buffer with l_x_20 in byte mode.
class cl_abap_conv_in_ce definition load.
conv2 = cl_abap_conv_in_ce=>create(
encoding = 'UTF-8'
endian = 'L'
input = buffer
).
CALL METHOD conv2->read(
*EXPORTING n = 4
IMPORTING data = l_result
).
CHANGING_VALUE = l_result.
ENDFUNCTION.
Комментариев нет:
Отправить комментарий