Application Development and Automation 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: 
Read only

Convert Xstring to String

rahul_rajagopal
Explorer
0 Likes
11,335

Hi Experts,

I have an Z table consist of some xstring fields. I need to convert the xstring to sting. Is there any function module for that ?.

5 REPLIES 5
Read only

Former Member
0 Likes
4,444

Please search SDN before posting.

You can use FM ECATT_CONV_XSTRING_TO_STRING. Or you can try the below:

First convert XSTRING to BINARY using SCMS_XSTRING_TO_BINARY

And then convert BINARY to STRING using SCMS_BINARY_TO_STRING.

Read only

Former Member
0 Likes
4,444

Try the FM:

DP_SPP_XML_XSTRING2STRING

Read only

Former Member
0 Likes
4,444

Hi Rahul,

Use FM HR_KR_XSTRING_TO_STRING .

For more info click [here|; .

BR

Dep

Edited by: DeepakNandikanti on Aug 25, 2011 12:21 PM

Read only

Former Member
0 Likes
4,444

FM : HR_KR_XSTRING_TO_STRING

another solution is :

DATA: lr_conv TYPE REF TO cl_abap_conv_in_ce,

lr_xstring TYPE xstring,

lr_string TYPE string.

lr_xstring = data.

CALL METHOD cl_abap_conv_in_ce=>create

EXPORTING

input = lr_xstring

encoding = 'UTF-8'

replacement = '?'

ignore_cerr = abap_true

RECEIVING

conv = lr_conv.

CALL METHOD lr_conv->read

IMPORTING

data = lr_string.

Read only

0 Likes
4,444

Hi ,

You can try below code also :

DATA: pdf_form_data TYPE xstring.

l_pdfobj->get_data( IMPORTING formdata = pdf_form_data ).

  • Call method to convert xstring to string.

DATA: converter TYPE REF TO cl_abap_conv_in_ce,

formxml TYPE string.

converter = cl_abap_conv_in_ce=>create( input = pdf_form_data ).

converter->read( IMPORTING data = formxml ).