SAP BW .....all info @ one place
SAP BW relevant Information
Loading


Function module to remove special characteristics while loading data into SAP BW from different sources.

* Create ZSTRING OF LENGH "25O" AND TYPE "CHAR".
* Create STR_IN and STR_OUT with reference to ZSTRING.

FUNCTION <   >.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(STR_IN) TYPE  Z_STRING
*"  EXPORTING
*"     REFERENCE(STR_OUT) TYPE  Z_STRING
*"----------------------------------------------------------------------
  CONSTANTS:
    cc_okchar(59)   TYPE c VALUE ' !"%&''()*+,-./:;<=>?_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

  DATA:
    lc_okchar1(72)  TYPE c,
    lc_okchar2(59)  TYPE c,
    lc_okchar(131)  TYPE c,
    l_d_offset      LIKE sy-index,
    ls_string       TYPE Z_STRING,
    li_strlen       TYPE i.

* Get the list of allowed characters.
  CALL FUNCTION 'RSKC_ALLOWED_CHAR_GET'
    IMPORTING
      e_allowed_char = lc_okchar1
      e_default_char = lc_okchar2.
  IF sy-subrc IS INITIAL.

*   No error .. set the Ok Char variable
    CONCATENATE lc_okchar1 lc_okchar2 INTO lc_okchar.
    CONDENSE    lc_okchar NO-GAPS.
  ELSE.

*   Error ... Just use the value in the constant.
    lc_okchar = cc_okchar.
  ENDIF.

  ls_string = STR_IN.
  CONDENSE  ls_string.
  TRANSLATE ls_string TO UPPER CASE.

* Remove initial characters that can cause problems: !, #, ?, etc
  IF ls_string(1) = '!'.
    ls_string(1) = ' '.
  ELSEIF ls_string(1) = '#'.
    ls_string(1) = ' '.
  ELSEIF ls_string(1) = '?'.
    ls_string(1) = ' '.
  ENDIF.

* Get the length of the string being processed.
  DESCRIBE FIELD ls_string LENGTH li_strlen IN CHARACTER MODE.

* Process string and remove unwanted characters
  DO li_strlen TIMES.
    l_d_offset = sy-index - 1.
    IF ls_string+l_d_offset(1) CO lc_okchar.

*Character allowed, do nothing
    ELSE.
      ls_string+l_d_offset(1) = ' '.
    ENDIF.
  ENDDO.

  str_out = ls_string.

ENDFUNCTION.

 

 

How to Papers, related to BW direct download

Google
 

Recent Posts

SAP Jobs