SAP/ABAP

Remove special char using hex or char.

Denise 2014. 11. 19. 10:46
FUNCTION zca_remove_escape.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(IV_HEX) TYPE  XSTRING OPTIONAL
*"     REFERENCE(IV_CHARS) TYPE  CSEQUENCE OPTIONAL
*"  CHANGING
*"     REFERENCE(CV_DATA) TYPE  CSEQUENCE
*"----------------------------------------------------------------------

  DATA : lv_chars  TYPE char100.
  DATA : lv_string TYPE string.

  IF iv_hex IS NOT INITIAL.
    CALL FUNCTION 'HR_RU_CONVERT_HEX_TO_STRING'
      EXPORTING
        xstring = iv_hex
      IMPORTING
        cstring = lv_string.
    lv_chars = lv_string.
  ENDIF.

  IF iv_chars IS NOT INITIAL.
    lv_chars = iv_chars.
  ENDIF.

  IF lv_chars IS INITIAL.
    EXIT.
  ENDIF.

  FIND lv_chars IN cv_data.
  IF sy-subrc IS INITIAL.
    REPLACE ALL OCCURRENCES OF lv_chars
                            IN cv_data
                            WITH space.
  ENDIF.

ENDFUNCTION.

'SAP > ABAP' 카테고리의 다른 글

how to call BAPI_ALM_ORDER_MAINTAIN  (0) 2014.11.27
Save Smartform Output in PDF format without code  (0) 2014.11.19
Lock ABAP program.  (0) 2014.10.27
SAPscript Control Tables  (0) 2014.10.24
Convert Internal date to External date ( date, month )  (0) 2014.09.24