Skip to Content

Hi

This article addresses the requirement of a Routine in Transformation. Using this routine, I need to filter out the characters that have a hexadecimal display between HEX00 to HEX1F.

Live Scenario:

We face a issue something like when the data is loading from DSO source to InfoCube  target, we encountered an error like Value “XXXXXXX” (HEX 480069002C000D000A000D000A0048006F0070006500200079) of character.Control characters with the hex-display 00 1F are not permitted.

Therefore we need to eliminate the cause of such characters with SPACE ‘ ‘ and then to get load to BW

The records which are having ‘#’ values going to Error stack. We are not able to see the ‘#’ values in Error stack, but these are visible when we are editing the particular record in error stack.

Screenshot below:

Untitled.png

Below is list of characters that BW will not be permitted

Character Hex Value
NULL 0
StartOfHeading 1
StartofTeXt 2
EndofTeXt 3
EndOfTrans. 4
ENQuiry 5
ACKnowlege 6
BELL 7
BackSpace 8
HorizTab 9
LineFeed 0A
VerticalTab 0B
FormFeed 0C
CarriageReturn 0D
ShiftOut 0E
ShiftIn 0F
DataLinkEscape 10
DeviceControl1 11
DeviceControl2 12
DeviceControl3 13
DeviceControl4 14
NegativeAcK 15
SYNchron.Idle 16
EndTransBlock 17
CANcel 18
EndofMedium 19
SUBstitute 1A
ESCape 1B
FileSeparator 1C
GroupSeparator 1D
RecordSep. 1E
UnitSeparator 1F

So There can be various solution for it. But We have gone through the End routine – ABAP.

METHOD end_routine.
*=== Segments ===

     FIELD-SYMBOLS:
       <RESULT_FIELDS>    TYPE _ty_s_TG_1.

     DATA:
       MONITOR_REC     TYPE rstmonitor.

*$*$ begin of routine – insert your code only below this line        *-*
     … “insert your code here
*–  fill table “MONITOR” with values of structure “MONITOR_REC”
*-   to make monitor entries
     … “to cancel the update process
*    raise exception type CX_RSROUT_ABORT.

     DATA: LT TYPE STANDARD TABLE OF  _ty_s_TG_1,
           WA TYPE  _ty_s_TG_1.
     FIELD-SYMBOLS: <CRITICAL_X> TYPE x.

     DATA: LV_COUNT type I VALUE ‘0’,
           LV_LEN TYPE I,
           LV_COUNTER TYPE I VALUE ‘0’,
           LV_CODE TYPE X.

* first to check the result package should not be empty
* looping in result package
* making sure to clear the count.
* if the XXX field contains ‘#’ value
*finding the length of the string and looping in to the string and
*finding the ANSCII value of the
*Each character eg: ‘#’ is 2300 and for each and replacing the ‘#’
*character ’23’ with ”.
     IF RESULT_PACKAGE IS NOT INITIAL.
       LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
         CLEAR LV_COUNT.
         IF <RESULT_FIELDS>-/BIC/XXXXX IS NOT INITIAL.
           LV_LEN = STRLEN( <RESULT_FIELDS>-/BIC/NSVVALUE ).
           WHILE LV_COUNT < LV_LEN.
             ASSIGN <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) TO
             <CRITICAL_X> CASTING.
             MOVE <CRITICAL_X> TO LV_CODE.
             IF LV_CODE EQ ’23’. ” To Remove ‘#’ value
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’00’. ” To Remove NULL Character
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
            ELSEIF LV_CODE EQ ’01’. ” To Remove StartOfHeading Character
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’02’. ” To Remove StartofTeXt Character
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’03’. ” To Remove EndofTeXt Character
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’04’. ” To Remove EndOfTrans.
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’05’. ” To Remove ENQuiry
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’06’. ” To Remove ACKnowlege
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’07’. ” To Remove BELL
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’08’. ” To Remove Back”
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’09’. ” To Remove HorizTab
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘0A’. ” To Remove LineFeed
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘0B’. ” To Remove VerticalTab
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘0C’. ” To Remove FormFeed
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘0D’. ” To Remove CarriageReturn
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘0E’. ” To Remove ShiftOut
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘0F’. ” To Remove ShiftIn
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’10’. ” To Remove DataLinkEscape
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’11’. ” To Remove DeviceControl1
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’12’. ” To Remove DeviceControl2
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’13’. ” To Remove DeviceControl3
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’14’. ” To Remove DeviceControl4
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’15’. ” To Remove NegativeAcK
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’16’. ” To Remove SYNchron.Idle
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’17’. ” To Remove EndTransBlock
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’18’. ” To Remove CANcel
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’19’. ” To Remove EndofMedium
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘1A’. ” To Remove SUBstitute
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘1B’. ” To Remove ESCape
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘1C’.” To Remove FileSeparator
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘1D’. ” To Remove GroupSeparator
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘1E’.” To Remove RecordSep.
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘1F’. ” To Remove UnitSeparator
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’21’. ” To Remove !
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’22’. ” To Remove “
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’24’. ” To Remove $
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’25’. ” To Remove %
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’26’. ” To Remove &
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’27’. ” To Remove ‘
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’28’. ” To Remove (
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’29’. ” To Remove )
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘2A’. ” To Remove *
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘2B’. ” To Remove +
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘2C’. ” To Remove ,
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘2D’. ” To Remove –
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘2E’. ” To Remove .
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘2F’. ” To Remove /
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘3A’. ” To Remove :
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘3B’. ” To Remove ;
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘3C’. ” To Remove <
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘3D’. ” To Remove =
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘3E’. ” To Remove >
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘3F’. ” To Remove ?
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’40’. ” To Remove @
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘5B’. ” To Remove [
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘5C’. ” To Remove \
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘5D’. ” To Remove ]
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘5E’. ” To Remove ^
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘5F’. ” To Remove _
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ’60’. ” To Remove `
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘7B’. ” To Remove {
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘7C’. ” To Remove |
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘7D’. ” To Remove }
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘7E’. ” To Remove ~
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ELSEIF LV_CODE EQ ‘7F’. ” To Remove DELete
               <RESULT_FIELDS>-/BIC/NSVVALUE+LV_COUNT(1) = .
             ENDIF.
             LV_COUNT = LV_COUNT + 1.
           ENDWHILE.
         ENDIF.
         LV_COUNTER  = LV_COUNTER  + 1.
       ENDLOOP.
     ENDIF.

So what ever character between hex00 – 7f are now replaced with space and data is getting loaded properly. For safer measure we eliminated the characters till 7 7F 🙂

Thanks,

Siva

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply