cancel
Showing results for 
Search instead for 
Did you mean: 

For converting text to binary and vice versa

Former Member
0 Kudos

Hi,

I need to convert the TEXT to Binary at the time of saving and from Binary to Text when display to users . I am using different context nodes with elements.

Is it any method to convert both text and binary to the context.

Thanks in advance.

dav

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

you can use the class cl_abap_conv_out_ce and cl_abap_conv_in_ce to convert text to binary & vice versa.

Shruthi

Former Member
0 Kudos

Hi,

Thanks for the reply. How to Implement in my method. Possible pl give steps with example.

Thanks in advance.

dav

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You can use the conversion classes as stated, but I find the function modules in function group SCMS_CONV even easier to user (basically wrappers around the suggested conversion classes). The function module names are pretty explanatory as to what they do (ie. binary to text or binary to string/text to binary, etc).

Former Member
0 Kudos

Hi,

String to Binary

data:

convout type ref to cl_abap_conv_out_ce.

data: lv_string type string,

lv_binarystring type xstring.

call method cl_abap_conv_out_ce=>create

receiving

conv = convout.

call method convout->write

exporting

  • N =

data = lv_string.

call method convout->get_buffer

receiving

buffer = lv_binarystring.

Binary to string

data : lv_binarystring type xstring,

obj_convin type ref to cl_abap_conv_in_ce,

lv_string type string.

call method cl_abap_conv_in_ce=>create

exporting

input = lv_binarystring

receiving

conv = obj_convin.

clear lv_string.

call method obj_convin->read

importing

data = lv_string.

Regards,

Shruthi R

Pls reward points if useful

0 Kudos

Super... It's as I expected.

Thanks a lot for help