Search on this Website

Tuesday, April 20, 2010

Common Error During SAP Upgrade-Error3

Error: In the Unicode context, TRANSLATE... CODEPAGE/NUMBER FORMAT is not allowed.

Cause: In the TRANSLATE statements, the additions FROM CODEPAGE and FROM NUMBER FORMAT are not allowed in a Unicode program. New conversion classes provided to replace these statements. Amongst other things, these classes are a (possible) replacement for the language elements TRANSLATE … CODEPAGE and TRANSLATE … NUMBER FORMAT …, which may not be used in Unicode Programs.

Solution: Data that is not available in ABAP format (that is, text data that is not in the system code page format, or numeric data that is not in the byte order used on the application server), is stored in an X field or XSTRING in binary form.
• When converting to an ABAP format from another format, data is read from a byte sequence and written to an ABAP data object.
• When converting from an ABAP format to another format, data is read from an ABAP data object and written as a byte sequence.




The Classes available for this purpose are:

CL_ABAP_CONV_IN_CE
Converting other formats to ABAP data objects. (Reading a binary input stream).

CL_ABAP_CONV_OUT_CE
Converting ABAP data objects to another format. (Writing to a binary output stream).

CL_ABAP_CONV_X2X_CE
Converting data from one format to another. (Reading from a binary input stream and
writing to a binary output stream).

CL_ABAP_CONV_OBJ
Converting data from one format to another.

Example :

zzmbbpsysm-cpcodepage = '1100'.

* TRANSLATE context-fieldcont
* FROM CODE PAGE zzmbbpcath-cpcodepage
* TO CODE PAGE zzmbbpsysm-cpcodepage.



DATA: L_CODEPAGE LIKE tcp0c-charco VALUE '0000'.
CONSTANTS: L_UNICODECP(4) TYPE C VALUE '1100'.

DATA: l_converter TYPE REF TO cl_abap_conv_obj.
DATA: l_out TYPE string.
DATA: l_fromcode TYPE cpcodepage.
DATA: l_tocode TYPE cpcodepage.

Clear: l_out,
l_converter,
l_fromcode,
l_tocode.

l_fromcode = L_CODEPAGE.
l_tocode = L_UNICODECP.

CREATE OBJECT l_converter
EXPORTING
incode = l_fromcode
miss = '.'
broken = '.'
use_f1 = 'X'
outcode = l_tocode
EXCEPTIONS
invalid_codepage = 1
internal_error = 2.

IF sy-subrc eq 0.
* Do Nothing.
ENDIF.

CALL METHOD L_CONVERTER->CONVERT
EXPORTING
INBUFF = context
INBUFFLG = 0
OUTBUFFLG = 0
IMPORTING
OUTBUFF = l_out
EXCEPTIONS
INTERNAL_ERROR = 1
others = 2
.
IF sy-subrc eq 0.
context = l_out.
ENDIF.

Clear: l_out,
l_converter,
l_fromcode,
l_tocode.



1 comment:

Anonymous said...

You can even purchase physical training packages that come with it, permitted development so meet us after the break for hands-on photos and a shott walk-through video detailing our first impressions.


Feel free to visit my web site; rozliczenie
dotacji (qos-web4.exigo.ch)