Skip to Content

How to get HEX 000D = 13 = CR out of a CHAR ?

Hi ABAP Gurus,

how to get HEX 000D = 13 = <CR> out of a CHAR ?

Thank You

Martin

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 10, 2011 at 03:32 PM

    Hi Martin,

    the CR character is defined by CL_ABAP_CHAR_UTILITIES=>CR_LF(1) (note that CR is the first character of the 2 of that constant)

    and then you use something like FIND or SPLIT using that constant

    BR

    Sandra

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Martin Sautter

      Hi guys,

      I beleive Martin is looking for faster way to replace and remove CR value.

      Try something like this:

       
        FIELD-SYMBOLS:
          <bytes> TYPE x.
      
        CONSTANTS:
          cr TYPE x LENGTH 2 VALUE '0D00', "Unicode CR
          rc TYPE x LENGTH 2 VALUE '2000'. "Unicode RC - Replace Char in this case SPACE
      
        DATA:
          result TYPE char50.
      
        CONCATENATE
          'THIS is a Test'
          cl_abap_char_utilities=>cr_lf
          'for Martin'
        INTO result SEPARATED BY space.
      
        WRITE: / result.
        ASSIGN result TO <bytes> CASTING TYPE x.
        REPLACE ALL OCCURRENCES OF cr IN <bytes> WITH rc IN BYTE MODE.
        WRITE: / result.
      

      Regards,

      Igor.

  • Oct 09, 2015 at 12:37 PM

    Hi

    check in debugging

    if hex value for # is 000D

    then use:

    REPLACE ALL OCCURANCE OF cl_abap_char_utilities=>cr_lf(1) IN string WITH space.

    if hex value is 000A

    then use:

    REPLACE ALL OCCURANCE OF cl_abap_char_utilities=>cr_lf+1(1) IN string WITH space.

    similary you can check for HORIZONTAL_TAB, VERTICAL_TAB etc.

    hope this help

    Regards

    Add comment
    10|10000 characters needed characters exceeded