‎2007 May 31 9:37 PM
Hi,
I am getting codepage conversion error while transfering data on to the App Server file.
<b>"At the conversion of a text from codepage '4103' to codepage '4110':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported"</b>
data: w_temp(3000).
TRANSFER w_temp TO p_file_o.
Please let me know, if anyone knows.
Thanks!
Puneet.
‎2007 Jun 01 2:27 AM
hi, you can try class cl_abap_conv_OUT_ce and cl_abap_conv_in_ce.
call them like this
CALL METHOD cl_abap_conv_OUT_ce=>create
EXPORTING
encoding = '4103' "UTF-8
endian =
replacement = '#'
input =
RECEIVING
conv = R_CONV_O
.
CALL METHOD cl_abap_conv_in_ce=>create
EXPORTING
encoding = '4110' "UTF-8
endian =
replacement = '#'
input =
RECEIVING
conv = R_CONV_I
.
CALL METHOD R_CONV_O->convert
......
CALL METHOD R_CONV_I->convert
......
just convert your codepage 4103 text into xstring, and convert it back into text of codepage 4110.
‎2007 Jun 01 5:31 PM
Hi,
Can you send me the complete code for this.
I am getting error "R_CONV_O is unknown". How does this has to be declared.
Will I be passing my w_temp (data structure) to any of these function modules as input.
Thanks!
Puneet.
‎2007 Jun 04 2:32 AM
hi, declaration like this:
data: R_CONV_O TYPE REF TO cl_abap_conv_OUT_ce.
data: R_CONV_I TYPE REF TO cl_abap_conv_in_ce.
use the instanted class R_CONV_O convert you 4101 codepage text into xstring,
then use instanted class R_CONV_I convert them back to 4103 codepage text.
‎2007 Jun 04 2:55 AM
Thanks for the reply.
I did the coding in following way. But still short dump is coming.
<b>"At the conversion of a text from codepage '4103' to codepage '4110':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported"</b>
DATA: r_conv_o TYPE REF TO cl_abap_conv_out_ce,
r_conv_i TYPE REF TO cl_abap_conv_in_ce,
w_temp2(4000),
w_temp1 TYPE xstring,
xw_temp TYPE xstring.
CALL METHOD cl_abap_conv_out_ce=>create
EXPORTING
encoding = '4103'
RECEIVING
conv = r_conv_o.
CALL METHOD cl_abap_conv_in_ce=>create
EXPORTING
encoding = '4110'
RECEIVING
conv = r_conv_i.
<b> w_temp is the INPUT string.</b>
CALL METHOD r_conv_o->convert
EXPORTING
data = w_temp
n = '-1'
IMPORTING
buffer = w_temp1.
len = g_int.
xw_temp = w_temp1.
I am getting short dump here below...
<b> CALL METHOD r_conv_i->convert
EXPORTING
input = xw_temp
n = '-1'
IMPORTING
data = w_temp2.
len = g_int.</b>
TRANSFER w_temp2 TO p_file_o.
Please let me know, if you have any idea.
Thanks a lot.
Thanks!
Puneet.
‎2007 Jun 06 2:37 PM
hi, puneet.
Sorry for the delay reply.
Actually I made some mistake in the former reply, not the two class, but this one <b>cl_abap_conv_x2x_ce</b> is be used to realize the codepage conversion.
You can check a SAP standard program, named RSCP_CONVERT_FILE, it is a report.
It is used to do codepage conversion with this class.
And you should input a Xstring stream into this class, and set the source Codepage code, and target one, and after some method calling, you will get a xstring buffer which is for the target Codepage.
code like this
data: l_content_in type xstring,
l_content_out type xstring,
l_file_list type table of string,
l_filename_in type string,
l_filename_out type string,
l_files type string,
l_file_table type filetable,
l_user_action type i,
l_gui_title type string,
l_button type smp_dyntxt,
l_dummylink type table of tline,
l_conv type ref to cl_abap_conv_x2x_ce,
l_encoding_in type abap_encoding,
l_encoding_out type abap_encoding,
l_text type string,
l_answer(1) type c,
l_overwrite_all(1) type c,
l_tcp00_wa_in type tcp00,
l_tcp00_wa_out type tcp00,
l_xtab type cpt_x255,
l_size type i,
l_rc type i,
l_exist type abap_bool.
.......
try.
call method cl_abap_conv_x2x_ce=>create
exporting
in_encoding = l_encoding_in
replacement = '#'
ignore_cerr = igncerr
out_encoding = l_encoding_out
input = l_content_in
receiving
conv = l_conv.
catch cx_parameter_invalid_type.
message x000(00).
catch cx_parameter_invalid_range .
message x000(00).
catch cx_sy_codepage_converter_init .
l_text = 'Error creating converter object for codepage pair: &1 &2'(001).
replace '&1' with cpin into l_text.
replace '&2' with cpout into l_text.
write :/ l_text.
exit.
endtry.
.....
try.
call method l_conv->reset
exporting
input = l_content_in.
catch cx_parameter_invalid_range .
message x000(00).
catch cx_sy_codepage_converter_init .
l_text = 'Error during stream input: &1'(005).
replace '&1' with l_filename_in into l_text.
write :/ l_text.
continue.
endtry.
.......
try.
call method l_conv->convert_c.
catch cx_sy_codepage_converter_init .
l_text = 'Error cx_sy_codepage_converter_init during conversion: &1'(006).
replace '&1' with l_filename_in into l_text.
write :/ l_text.
continue.
catch cx_sy_conversion_codepage .
l_text = 'Conversion error: &1'(007).
replace '&1' with l_filename_in into l_text.
write :/ l_text.
continue.
endtry.
.....
l_content_out = l_conv->get_out_buffer( ).