2012 Jan 30 11:19 AM
dear all
I want to convert String from UTF8 to CP1256 encoding technique before inserting them in the data base is there a function module or other thing to make this conversion.
2012 Jan 30 11:37 AM
Hi,
In FM GUI_UPLOAD SAP use class cl_abap_conv_out_ce (you can find it in include LSFESF03).
1. cl_abap_conv_out_ce=>create
2. cl_abap_conv_out_ce->write
3. cl_abap_conv_out_ce->get_buffer
I didn't try it, but maybe it will cover your case.
Best Regards
Marcin Cholewczuk
Hi,
In FM GUI_UPLOAD SAP use class cl_abap_conv_out_ce (you can find it in include LSFESF03).
1. cl_abap_conv_out_ce=>create
2. cl_abap_conv_out_ce->write
3. cl_abap_conv_out_ce->get_buffer
I didn't try it, but maybe it will cover your case.
Best Regards
Marcin Cholewczuk
2012 Jan 30 11:37 AM
Hi,
In FM GUI_UPLOAD SAP use class cl_abap_conv_out_ce (you can find it in include LSFESF03).
1. cl_abap_conv_out_ce=>create
2. cl_abap_conv_out_ce->write
3. cl_abap_conv_out_ce->get_buffer
I didn't try it, but maybe it will cover your case.
Best Regards
Marcin Cholewczuk
2012 Jan 30 1:57 PM
could you please write sample code to me which i can create object and access the method
because i didn't work with object oriented .
i write :
data: conv type REF TO cl_abap_conv_in_ce.
CREATE OBJECT conv.
conv = cl_abap_conv_in_ce=>create(
encoding = 'UTF-8' ).
conv->convert(
EXPORTING input = lxs_content
IMPORTING data = l_contline ).
itreturn error
2012 Feb 01 9:12 AM
i would like to convert for example
Arabic text "بسم الله " to the flowing text ---> ط¨ط³ظu2026 ط§ظu201Eظu201Eظu2021 i think this encoding is CP1256
please i want a sample code to do this .
thank you
2012 Feb 01 9:46 AM
Hi,
Can it be used - TRANSLATE string FROM CODE PAGE cp1 TO CODE PAGE cp2 ?
Cheers,
Thomas
2012 Feb 01 9:58 AM
Hi,
Please find the bellow link for your solution.
http://wiki.sdn.sap.com/wiki/display/ABAP/Characterencodingconversion
http://tcltk.co.kr/files/tdom3.pdf
And check the bellow code which give some idea about your requirement.
Convert XString to String
data: loc_conv type ref to CL_ABAP_CONV_IN_CE,
loc_xstring type xstring,
loc_string type string.
CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE
EXPORTING
INPUT = loc_xstring
ENCODING = 'UTF-8'
REPLACEMENT = '?'
IGNORE_CERR = ABAP_TRUE
RECEIVING
CONV = loc_CONV.
TRY.
CALL METHOD loc_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.
Regards,
Goutam Kolluru.
2012 Feb 01 12:10 PM
Hi
You can open a file using OPEN DATASET encoding with code page 1401
Best regards
2012 Feb 04 5:56 PM
i use this function ( SCP_TRANSLATE_CHARS ) to make convertion from
Arabic text "بسم الله " to the flowing text ---> ط¨ط³ظu2026 ط§ظu201Eظu201Eظu2021
i use it as
CALL FUNCTION 'SCP_TRANSLATE_CHARS'
EXPORTING
INBUFF = 'بسم الله'
INBUFFLG = 0
INCODE = '4110'
OUTBUFFLG = 0
OUTCODE = '8704'
CSUBST = 'X'
SUBSTC_HASH = ' '
SUBSTC_DOT = ' '
SUBSTC_SPACE = ' '
SUBSTC = '00035'
IMPORTING
INUSED =
OUTBUFF = text
OUTOVERFLOW =
OUTUSED =
SUBSTED =
INPUT_ENDS_IN_CHAR =
ERRMSG =
EXCEPTIONS
INVALID_CODEPAGE = 1
INTERNAL_ERROR = 2
CANNOT_CONVERT = 3
FIELDS_BAD_TYPE = 4
OTHERS = 5
write : text.
but it doesn't return the output that i need as mentioned above can any one tell me how to get my need output .
2012 Feb 04 10:47 PM
Hi,
It won't work because when you pass value like this SAP treats it as Unicode (little endian). Prepare file in notepad and choose UTF-8 and use its inside as input for this function.
Best Regards
Marcin Cholewczuk
2012 Feb 19 6:02 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |