‎2009 Nov 05 11:11 AM
Hi all,
I have a problem with the conversion xstring to string.
I have a CSV file in upload, I use this method:
data lr_conv type ref to cl_abap_conv_in_ce.
clear lr_conv.
lr_conv = cl_abap_conv_in_ce=>create( ).
lr_conv->convert( exporting input = l_xstring importing data = l_string ).
but I have an error when I execute this:
lr_conv->convert( exporting input = l_xstring importing data = l_string ).
the error is: Character set conversion is not possible.
How can I do for to solve?
Tks a lot.
‎2009 Nov 05 11:45 AM
hi ,
u may do it like this :
data: lr_conv type ref to CL_ABAP_CONV_IN_CE,
lr_xstring type xstring,
lr_string type string.
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.
refer the SAP online help
http://help.sap.com/saphelp_nw70/helpdata/en/ba/78d3c747b24546ab1c1499a054d8a5/content.htm
‎2009 Nov 05 11:16 AM
Hi,
You have to do it this way -
DATA lv_cvw_data TYPE xstring.
DATA s_cont TYPE string.
DATA lref_convt TYPE REF TO cl_abap_conv_in_ce.
DATA lv_string TYPE string.
lref_convt = cl_abap_conv_in_ce=>create( input = lv_cvw_data ).
lref_convt->read( IMPORTING data = s_cont ).
lref_convt->convert( EXPORTING input = lv_cvw_data IMPORTING data = lv_string ).Regards,
Lekha.
Edited by: Lekha on Nov 5, 2009 4:48 PM
‎2009 Nov 05 11:35 AM
I have the same error at the line:
lref_convt->read( IMPORTING data = s_cont ).
???
‎2009 Nov 05 11:42 AM
hi ,
u may do it like this :
data: lr_conv type ref to CL_ABAP_CONV_IN_CE,
lr_xstring type xstring,
lr_string type string.
CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE
EXPORTING
INPUT = lr_xstring
ENCODING = 'UTF-8'
REPLACEMENT = '?'
IGNORE_CERR = ABAP_TRUE
RECEIVING
CONV = lr_CONV.
TRY.
CALL METHOD lr_CONV->READ
IMPORTING
DATA = loc_string.
CATCH CX_SY_CONVERSION_CODEPAGE.
*-- Should ignore errors in code conversions
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
*-- Should ignore errors in code conversions
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_PARAMETER_INVALID_RANGE.
ENDTRY.
refer the SAP online help
http://help.sap.com/saphelp_nw70/helpdata/en/ba/78d3c747b24546ab1c1499a054d8a5/content.htm
‎2009 Nov 05 11:45 AM
hi ,
u may do it like this :
data: lr_conv type ref to CL_ABAP_CONV_IN_CE,
lr_xstring type xstring,
lr_string type string.
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.
refer the SAP online help
http://help.sap.com/saphelp_nw70/helpdata/en/ba/78d3c747b24546ab1c1499a054d8a5/content.htm
‎2009 Nov 05 1:25 PM