2007 Feb 20 11:06 AM
Hi all,
I have to make a unicode check for all our old reports. There I got a problem with
the following statement:
TRANSLATE TFILE USING TRANS.
Message in UnicodeCheck:
"TRANS" must be a character-type data object (data type C, N, D, T or STRING).
The both variables are defined as follows:
DATA: BEGIN OF TRANS OCCURS 0,
X TYPE X VALUE '00',
C_00 TYPE C VALUE ' ',
SOH TYPE X VALUE '01',
C_01 TYPE C VALUE ' ',
STX TYPE X VALUE '02',
C_02 TYPE C VALUE ' ',
ETX TYPE X VALUE '03',
C_03 TYPE C VALUE ' ',
EOT TYPE X VALUE '04',
C_04 TYPE C VALUE ' ',
ENQ TYPE X VALUE '05',
C_05 TYPE C VALUE ' ',
ACK TYPE X VALUE '06',
C_06 TYPE C VALUE ' ',
[...]
END OF TRANS.
BEGIN OF TFILE OCCURS 0,
REC(2500) TYPE C,
END OF TFILE.
I think the developer wanted to remove all control characters.
Has any body an idea how can do this in an unicode program?
Regards,
Sven
Hi all,
I have to make a unicode check for all our old reports. There I got a problem with
the following statement:
TRANSLATE TFILE USING TRANS.
Message in UnicodeCheck:
"TRANS" must be a character-type data object (data type C, N, D, T or STRING).
The both variables are defined as follows:
DATA: BEGIN OF TRANS OCCURS 0,
X TYPE X VALUE '00',
C_00 TYPE C VALUE ' ',
SOH TYPE X VALUE '01',
C_01 TYPE C VALUE ' ',
STX TYPE X VALUE '02',
C_02 TYPE C VALUE ' ',
ETX TYPE X VALUE '03',
C_03 TYPE C VALUE ' ',
EOT TYPE X VALUE '04',
C_04 TYPE C VALUE ' ',
ENQ TYPE X VALUE '05',
C_05 TYPE C VALUE ' ',
ACK TYPE X VALUE '06',
C_06 TYPE C VALUE ' ',
[...]
END OF TRANS.
BEGIN OF TFILE OCCURS 0,
REC(2500) TYPE C,
END OF TFILE.
I think the developer wanted to remove all control characters.
Has any body an idea how can do this in an unicode program?
Regards,
Sven
2007 Feb 20 11:13 AM
Hi .
Add the code
TRANSLATE TFILE USING TRANS in byte mode.
CHECK TFILE AND TRANS ARE COMPATIBLE .
Please reward if useful.
2007 Feb 20 11:35 AM
Thanks for your reply. But the statement
TRANSLATE TFILE USING TRANS <b>in byte mode</b>.
is not possible and returns an syntax error.
Regards,
Sven
2007 Feb 20 11:28 AM
Hi,
Dont use hexadecimal type 'X' in the internal table variables declaration , use only character types
2007 Feb 20 11:45 AM
But can I be sure, that all control characters like CR or LF will be converted, when I define thme as char instead of hex?
In SAP Standard reports it is used the class cl_abap_conv_in_ce to convert the contoll characters. Maybe some methods of this class can resolve my problem.
2007 Feb 20 11:40 AM
Hi,
The internal table trans should be character type data object so u can have only data types c,n,d,t and string in your internal table but not hexa decimal.
The fields of internal table should be character type (The ABAP data types C, N, D, T, and STRING)
TRANSLATE ... TO UPPER/LOWER CASE
TRANSLATE ... USING
The arguments of these instructions must be single fields of type C, N, D, T or STRING or structures of character-type only. There is a syntax or runtime error if arguments of a different type are passed. A subset of this function is provided with the addition IN BYTE MODE for processing byte strings that is, operands of type X or XSTRING.
Regards,
Sruthi
2007 Feb 20 11:41 AM
hi,
u need to change Hexadecimals to the corresponding Character types..
goto SE24 and check the attributes in the class CL_ABAP_CHAR_UTILITIES that are can be used.
for ex:
X TYPE X VALUE '08' : shud be changed to CL_ABAP_CHAR_UTILITIES=>BACKSPACE
X TYPE X VALUE '09' : shud be changed to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |