2010-03-10 8 views
1

J'ai besoin de concaténer différentes lignes dans une chaîne. Pour ce faire, j'ai besoin de caractères hexadécimaux CR + LF.ABAP WebAS Page de codes active

Le problème est que, lorsque j'utilise un environnement 8 bits/char, je dois juste faire quelque chose comme ceci:

constants : c_lf type x value '10'. 

constants : c_cr type x value '13'. 

data : g_html type string. 

concatenate '<html>' c_cr c_lf into g_html. 

mais, quand je suis dans un environnement 16 bits/char , la variable X ne représente pas la représentation hexadécimale correcte pour CR et LF.

Alors, je devrais utiliser quelque chose comme ceci:

constants : c_lf(2) type x value '0010'. 

constants : c_cr(2) type x value '0013'. 

data : g_html type string. 

concatenate '<html>' c_cr c_lf into g_html. 

Donc, il n'y a aucune façon de savoir la quantité d'octets/char utilisé par ABAP WebAS?

Merci!

Répondre

2

La fonction TR_GET_IS_UNICODE_SYSTEM indique si le système utilise unicode ou non. Il appelle la classe CL_ABAP_CHAR_UTILITIES pour obtenir l'attribut CHARSIZE (morsure/char) (en passant, cette classe contient un attribut public CR_LF ...)

Cordialement
Guillaume