|
Publicité ' | |||||||||||||||||||||||
|
|
#1 |
|
Invité de passage
![]() Inscription : avril 2008 Messages : 3 ![]() |
Bonjour,
Je réalise des modifications de programmes suite au passage en UNICODE de SAP. J'ai un souci concernant l'instructions READ DATASET. J'ouvre un fichier avec l'instruction OPEN DATASET p_ifile FOR INPUT IN TEXT MODE ENCODING DEFAULT pour que le fichier soit traité en UNICODE mais lorsque je réalise le READ DATASET p_ifile INTO wt_fichier j'ai un DUMP (voir annexe au fon du message ) lorsque la ligne du fichier traité comporte un caractère spécial tel qu'un accent. J'ai également constaté que lorsque je remplace l'OPEN par : OPEN DATASET p_ifile FOR INPUT IN TEXT MODE ENCODING NON-UNICODE. ou OPEN DATASET p_ifile IN LEGACY TEXT MODE FOR INPUT. Le READ fonctionne "correctement" (avec des caractères francais or à termes il est prévu d'utiliser différents alphabet) . Pouvez vous me dire si il y a une solution pour éviter le DUMP lors du READ tout en utilisant l'OPEN DATASET p_ifile FOR INPUT IN TEXT MODE ENCODING DEFAULT ou suis obligé d'utiliser un des 2 autres OPEN et lequel me conseillez vous. Merci de votre aide. Rémi Annexe : Erreur d'exécution CONVT_CODEPAGE Exception CX_SY_CONVERSION_CODEPAGE Date et heure 07.04.2008 15:15:24 Désignation A character set conversion is not possible. Causes At the conversion of a text from codepage '4110' to codepage '4103': - 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 'ZTESTMD4' had to be terminated as the conversion would have produced incorrect data. The number of characters that could not be displayed (and therefore not be converted), is 1. If this number is 0, the second error case, as mentioned above, has occurred. Solutions Please make a note of the actions and input which caused the error. - To resolve the problem, contact your SAP system administrator. With transaction ST22 for the ABAP dump analysis, you can analyze and administrate termination messages, or store them for a longer time period. If you were requested by the application to enter a codepage, the termination may be avoided after the restart of the application if you enter a different codepage. If characters could not be converted: Please use transaction SCP to analyse the codepages used by you. Search for characters you wanted to convert, which are not entered in the table. (If you changed a codepage, you can use transaction SP12 to invalidate the character set buffer (CCC). You find further help tools to codepages in transaction SNLS. |
|
|
00
|
|
|
#2 |
|
Invité régulier
![]() Inscription : mars 2008 Messages : 8 ![]() |
J'ai vu quelque part qu'il y avait moyen de faire l'open de cette façon :
OPEN DATASET ... IGNORING CONVERSION ERRORS mais n'étant pas dans le cas, je n'ai pas pu tester. Ceci dit, remonter tout ça vers l'admin BC, comme suggéré dans le dump, est une bonne idée. Ce genre de souci est de son ressort normalement, ou au moins il devrait vous fournir du support en l'occurence. |
|
|
00
|
|
|
#3 |
|
Membre habitué
![]() |
Bonjour,
Avez regardé sur votre sap logon, si le serveur était bien configuré? Je m'explique, dans le sap logon : => allez dans les propriétés du serveur (clic droit + propriété) => cliquer sur el bouton "Autres..." => Regarder l'option de téléchargement des fichier. Cdt, Sh@m@n |
|
|
00
|
|
|
#4 |
|
Invité de passage
![]() Inscription : avril 2008 Messages : 3 ![]() |
Salut,
Merci pour vos réponses Dominiaux et Sh@m@n En utilisant IGNORING CONVERSION ERRORS je n'ai plus de DUMP par contre lorsque je réalise en READ sur le fichier j'ai parfois des caratères bizarres qui apparaisent (ex: $, #,...) en fin et même au milieu du fichier. Comment puis je faire pour ne pas avoir ce problème? |
|
|
00
|
|
|
#5 |
|
Membre confirmé
![]() Inscription : octobre 2007 Messages : 209 ![]() |
pour que ton instruction fonctionne correctement, il faut que ton fichier soit de type Unicode ce qui n'est a priori pas le cas
tu peux essayer de convertir ton fichier via le notepad |
|
|
00
|
|
|
#6 |
|
Invité de passage
![]() Inscription : avril 2008 Messages : 3 ![]() |
J'ai effectué des tests avec différent type de fichier créé avec notepad (Unicode, UTF-8, ANSI et Unicode big endian) et à chaque fois j'avais le problème.
Le seul cas ou le OPEN DATASET p_ifile FOR INPUT IN TEXT MODE ENCODING DEFAULT. fonctionne correctement c'est lorsque on créé le fichier depuis SAP avec un OPEN ... OUTPUT. J ai résolu mon problème en remplacant l' OPEN DATASET par : TRY. *détermine l'encodage du fichier. Il faut intercepter les exceptions car la *méthode peut générer un DUMP (elle utilise un OPEN DATASET classique CALL METHOD cl_abap_file_utilities=>check_utf8 EXPORTING file_name = l_file IMPORTING bom = l_bom encoding = l_enc. CASE l_enc. * Selon le type d'encodage du fichier on réalise un OPEN différent WHEN cl_abap_file_utilities=>encoding_utf8. CASE l_bom. WHEN cl_abap_file_utilities=>no_bom. OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING UTF-8 IGNORING CONVERSION ERRORS WITH SMART LINEFEED. WHEN cl_abap_file_utilities=>bom_utf8. OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING UTF-8 IGNORING CONVERSION ERRORS WITH SMART LINEFEED SKIPPING BYTE-ORDER MARK. WHEN OTHERS. "bom_utf16_be or bom_utf16_be ENDCASE. * Autre encodage dont l'ASCII-ANSI. WHEN OTHERS. OPEN DATASET l_file FOR INPUT IN LEGACY TEXT MODE IGNORING CONVERSION ERRORS WITH SMART LINEFEED. ENDCASE. *** Lecture fichier DO. READ DATASET l_file INTO w_line. IF sy-subrc NE 0. EXIT. ENDIF. ENDDO. *** Fermeture fichier CLOSE DATASET l_file. *** CATCH cx_sy_file_open . CATCH cx_sy_file_authority . CATCH cx_sy_file_io . ENDTRY. Merci pour votre aide en espérant que ce code pourra servir à d'autres personnes. |
|
|
00
|
Copyright © 2000-2012 - www.developpez.com