Invalid Char Routine Scenario Use Case
Scenario 1 :
*****************************************************************************************
DATA : I_KNREF LIKE TRAN_STRUCTURE-KNREF.
MOVE TRAN_STRUCTURE-KNREF TO I_KNREF.
IF I_KNREF+0(1) = '#' or I_KNREF+0(1) = '!'.
I_KNREF+0(1) = '?'.
ENDIF.
IF I_KNREF+0(1) = '{' .
I_KNREF+0(1) = ''.
ENDIF.
RESULT = I_KNREF.
* Set Text To Upper case
TRANSLATE RESULT TO UPPER CASE.
* Get Allowed Characters When Initial
* And Store In Global Data Area For Subsequent Use
IF rsallowedchar-allowchar IS INITIAL.
SELECT SINGLE
allowchar
INTO (rsallowedchar-allowchar)
FROM rsallowedchar
WHERE allowkey = 'S'.
ENDIF.
* Call Function To Convert Any Invalid Characters In RESULT
CALL FUNCTION 'Y_BIW_TEXT_CONVERT'
EXPORTING
allowchar = rsallowedchar-allowchar
CHANGING
RESULT = RESULT.
* returncode <> 0 means skip this record
RETURNCODE = 0.
* abort <> 0 means skip whole data package !!!
ABORT = 0.
***************************************************************************************
Scenario 2 :
DATA : INT_VAR TYPE /BIC/OIZHRCWLCLR.
DATA : STR_VAR1(20) TYPE C.
DATA : VAR2 TYPE I.
DATA : VAR3 TYPE I.
DATA : VAR4 TYPE I.
DATA : STR_VAR6(20) TYPE C.
MOVE SOURCE_FIELDS-/BIC/ZHRCWLCLR TO INT_VAR.
TRANSLATE INT_VAR TO UPPER CASE .
IF INT_VAR CN
',<>?/\:;"''ABCDEFGHI JKLMNOPQRSTUVWXYZ!%^&*()__+=1234567890 ' .
STR_VAR1 = INT_VAR+0(SY-FDPOS).
VAR2 = STRLEN( INT_VAR ).
VAR3 = SY-FDPOS + 1.
VAR4 = VAR2 - VAR3.
STR_VAR6 = INT_VAR+VAR3(VAR4).
CONCATENATE STR_VAR1 STR_VAR6 INTO RESULT.
ELSE.
RESULT = INT_VAR.
ENDIF.
***************************************************************************************