on 06-20-2008 11:45 AM
Hi Friends,
We are getting the following Abap dump
CONVT_CODEPAGE exception CX_SY_CONVERSION_CODEPAGE
I have went thorugh various notes but still no help notes are 1057289 and 547308
DUMP:-
At the conversion of a text from codepage '4102' to codepage '1100':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'SAPLZPPEU_FUNCTIONS' had to be terminated as the
conversion
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE',
caught in
procedure "CREATE_FILE" "(FORM)", nor was it propagated by a RAISING cl
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Can some one help.
thanks
kris
Hi Kris,
I have had the same problem.
In my case the error occurs during a file tranfer to a local file or to a server (transfer DATA-REC to FILE).
First it wasn't easy to find the "wrong" sign which entail the CX_SY_CONVERSION_CODEPAGE.
The idea was to create a table which contains the unknown signs and define a sign which repair these sign.
To avoid the dump, you can enbed the the transfer comand in try u2026 endtry.
This table named ZSD_SIGNS.
Discription:
MANDT MANDT CLNT 3 0 Mandant
OLD_SIGN ZOLD_SIGN CHAR 1 0 umzusetzendes Zeichen
TO_USE ZTO_USE NUMC 1 0 Einsatz für
NEW_SIGN ZNEW_SIGN CHAR 5 0 ersetzende(s) Zeichen
LENG_NEW_SIGN DDLENG NUMC 6 0 Länge (Anzahl der Zeichen)
NOTICE Z_NOTICE CHAR 40 0 Bemerkung zur Code Page Ersatz Character
BUFPRG Z_BUFPRG CHAR 20 0 Laufende Programm Name
BUFFLD Z_BUFFLD CHAR 15 0 Buffer Feld Name beim Transfer
BUFPOS Z_BUFPOS NUMC 6 0 Character positions ins Buffer
BUFKEY Z_BUFKEY CHAR 30 0 Schlussel Wert wenn der Charakter gefunden war
DATUM DATUM DATS 8 0 Datum
UZEIT UZEIT TIMS 6 0 Tageszeit
UNAME UNAME CHAR 12 0 Benutzername
BATCH Z_BATCH CHAR 1 0 Chatakter gefunden beim Batchablauf
CUR_CODPAGE Z_CURR_CODPAGE NUMC 4 0
OUT_CODPAGE Z_OUT_CODPAGE NUMC 4 0
Source in the current program:
u2026
WA_SIGNS type ZSD_SIGNS, " umzusetzende Zeichen
IT_SIGNS type table of ZSD_SIGNS,
u2026
select * from ZSD_SIGNS
into table IT_SIGNS
where TO_USE < 2.
u2026
Befor transfer:
loop at IT_SIGNS into WA_SIGNS.
replace all occurrences
of WA_SIGNS-OLD_SIGN
in DATA -> internal table
with WA_SIGNS-NEW_SIGN(WA_SIGNS-LENG_NEW_SIGN).
endloop.
- note: if you want to change one old sign into more then one new sign (example u2026 to u2026) you must process the replacement field by field and change the where condition in the select statement to where TO_USE = 0 or TO_USE > 1!
u2022 Download
open dataset FILE for output in legacy text mode code page CP IGNORING CONVERSION ERRORS.
if SY-SUBRC = 0.
TRY.
transfer DATA-REC to FILE.
*----
-
Should ignore errors in code conversions
CATCH CX_SY_CONVERSION_CODEPAGE.
write: / 'CODEPAGE-ERROR in DATA-REC ', DATA-REC.
CONCATENATE sy-host
likp-vbeln
INTO v_key
SEPARATED BY space.
PERFORM FIND_CODEPAGE_CHAR
USING ZEILE p_file 'ZEILE' v_key.
CLEANUP.
ENDTRY.
endif.
CLOSE DATASET p_file. " Close file before
u2026
*----
*
FORM LOG_CODEPAGE_ERROR *
*----
*
Clean up code page error
Find character without codepage convertion *
*----
*
FORM FIND_CODEPAGE_CHAR USING p_buffer type C " Buffer for TRANSFER
p_pfad type C " Transfer file name
p_feld TYPE C " Field name for Log
p_key type C. " Key in programm
TYPE-POOLS dset.
DATA: dset TYPE STRING,
attr TYPE dset_attributes,
excep TYPE REF TO CX_SY_CONVERSION_CODEPAGE,
lv_pos TYPE I,
lv_test(1).
Find output atributes
MOVE p_pfad TO dset.
GET DATASET dset ATTRIBUTES attr.
Optimize Clean up code page process
loop at IT_SIGNS into WA_SIGNS.
replace all occurrences
of WA_SIGNS-OLD_SIGN
in p_buffer
with WA_SIGNS-NEW_SIGN(WA_SIGNS-LENG_NEW_SIGN).
endloop.
*}Optimize Clean up code page process
Report error.
while lv_pos < strlen( p_buffer ).
move p_buffer+lv_pos(1) to lv_test.
lv_pos = lv_pos + 1.
if lv_pos = strlen( p_buffer ).
TRY.
TRANSFER lv_test TO p_pfad.
*----
-
Should ignore errors in code conversions
CATCH CX_SY_CONVERSION_CODEPAGE INTO excep.
PERFORM LOG_CODEPAGE_TO_SIGN
USING lv_test lv_pos p_feld p_key
attr-changeable-code_page.
MOVE '#' TO lv_test.
TRANSFER lv_test TO p_pfad. " Reserve place after error
CLEANUP.
ENDTRY.
else.
TRY.
TRANSFER lv_test TO p_pfad length 1
no end of line.
*----
-
Should ignore errors in code conversions
CATCH CX_SY_CONVERSION_CODEPAGE INTO excep.
PERFORM LOG_CODEPAGE_TO_SIGN
USING lv_test lv_pos p_feld p_key
attr-changeable-code_page.
MOVE '#' TO lv_test.
TRANSFER lv_test TO p_pfad " Reserve place after error
length 1 no end of line.
CLEANUP.
ENDTRY.
endif.
endwhile.
ENDFORM. "LOG_CODEPAGE_ERROR.
*----
*
FORM LOG_CODEPAGE_TO_SIGN *
*----
*
Update ZDS_SIGN table *
*----
*
FORM LOG_CODEPAGE_TO_SIGN
USING p_char type C " Character on error
p_pos type I " Position in fiels
p_field type C " Feld name
p_key type C " Key in programm
p_codpg TYPE CPCODEPAGE.
DATA: lv_codepage(4).
Get the current codepage number.
call 'CUR_LCL' id 'CODEPAGE' field lv_codepage.
write: /'Unicode conversion error -->',
'Current Code Page:', lv_codepage,
'Output Codpage:', p_codpg,
'Field:', p_field,
'Pos:', p_pos,
'Char:', p_char,
'Key:', p_key.
Remember wrong sign into internal table
CLEAR wa_signs.
MOVE p_char TO wa_signs-old_sign.
MOVE '#' TO wa_signs-new_sign.
MOVE 0 TO wa_signs-to_use.
MOVE 1 TO wa_signs-leng_new_sign.
APPEND wa_signs to IT_SIGNS.
Remember wrong sign into SD database
MOVE 'Please activate the field new_sign' TO wa_signs-Notice.
MOVE syst-cprog TO wa_signs-bufprg.
MOVE p_field TO wa_signs-buffld.
MOVE p_pos TO wa_signs-bufpos.
MOVE p_key TO wa_signs-bufkey.
MOVE syst-datum TO wa_signs-datum.
MOVE syst-uzeit TO wa_signs-uzeit.
MOVE syst-uname TO wa_signs-uname.
MOVE syst-batch TO wa_signs-batch.
MOVE lv_codepage TO wa_signs-cur_codpage.
MOVE p_codpg TO wa_signs-out_codpage.
CLEAR ZSD_SIGNS.
INSERT ZSD_SIGNS FROM wa_signs.
IF sy-subrc NE 0.
write: / 'Error by inser table ZSD_SIGN. --> ', 'Char:', p_char.
ENDIF.
COMMIT WORK.
ENDFORM. " LOG_CODEPAGE_TO_SIGN.
Now you can look in the table ZSD_SIGNS and define the correct sign for these new record (SE16)!
I hope, it will help you!
Regards Ralf
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is this a remotely called function?
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.