Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of Binary to Text

Former Member
0 Kudos
8,479

Hi Experts,

I have a text stored in the form of Binary,When i Read the text to display it in the report it displays "##" as a delimter at the end of each line.

Is there any way to convert the Binary data into text in 4.6.

Regards,

1 ACCEPTED SOLUTION

Former Member
0 Kudos
1,618

Hi,

May be also (older releases):

DATA: w_mm   TYPE c,
        w_xx   TYPE x,
        w_ss(2)   TYPE c,

  FIELD-SYMBOLS: <w_kk> TYPE c.

    w_ss = '3F'.
    w_xx = w_ss.
    ASSIGN ('w_xx') TO <w_kk> CASTING TYPE c.
    w_mm = <w_kk>.


*      agora w_mm tem o caracter binario.
      ASSIGN w_mm TO <w_kk> CASTING TYPE x.
      WRITE <w_kk> TO w_ss.

Best regards,

Leandro Mengue

3 REPLIES 3

Former Member
0 Kudos
1,618

Hi,

Try:

CALL FUNCTION 'SCMS_TEXT_TO_BIN'              
           EXPORTING TEXT_LINE = w_mm
           IMPORTING BIN_LINE  = w_kk.

and

CALL FUNCTION 'SCMS_BIN_TO_TEXT'             
         EXPORTING BIN_LINE  = w_xx
         IMPORTING TEXT_LINE = w_mm.

Best regards,

Leandro Mengue

Former Member
0 Kudos
1,619

Hi,

May be also (older releases):

DATA: w_mm   TYPE c,
        w_xx   TYPE x,
        w_ss(2)   TYPE c,

  FIELD-SYMBOLS: <w_kk> TYPE c.

    w_ss = '3F'.
    w_xx = w_ss.
    ASSIGN ('w_xx') TO <w_kk> CASTING TYPE c.
    w_mm = <w_kk>.


*      agora w_mm tem o caracter binario.
      ASSIGN w_mm TO <w_kk> CASTING TYPE x.
      WRITE <w_kk> TO w_ss.

Best regards,

Leandro Mengue

0 Kudos
1,618

Hi

You can use follow forms in the ABAP side

&----


*& FORM HEX_TO_CHAR *

&----


FORM Hex_to_Char CHANGING p_value TYPE string.

DATA:

x_length TYPE i,

x_hexval TYPE REF TO DATA.

x_length = strlen( p_value ) / 2.

CREATE DATA x_hexval TYPE x LENGTH x_length.

ASSIGN x_hexval->* TO <Xvalue> CASTING.

<Xvalue> = p_value.

ASSIGN <Xvalue>(x_length) TO <Cvalue> CASTING.

p_value = <Cvalue>.

ENDFORM.

&----


*& FORM CHAR_TO_HEX *

&----


FORM Char_to_Hex CHANGING p_value TYPE string.

DATA:

x_length TYPE i,

x_chrval TYPE REF TO DATA.

x_length = strlen( p_value ).

CREATE DATA x_chrval TYPE c LENGTH x_length.

ASSIGN x_chrval->* TO <Cvalue> CASTING.

<Cvalue> = p_value.

ASSIGN <Cvalue>(x_length) TO <Xvalue> CASTING.

p_value = <Xvalue>.

ENDFORM.