Now SAP systems are basically only supports unicode, only the earlier version of SAP (ERP before 6.0 SR2) supports Unicode and non-Unicode character set (also known as Nonunicode). After ERP 6.0 SR3 only support Unicode character sets.
Unicode character set used by the SAP system accounted for 12 bytes; Unicode is not accounted for 9 bytes. Two characters differ materially for string processing program. In any case, the method DYNAMIC_OUTPUT_LENGTH use in class DYNAMIC_OUTPUT_LENGTH able to get the correct length (in English or Chinese characters).
Check if the SAP system is unicdoe: menu -system-status
Test code:
1
2
3
4
5
6
7
8
9
10
|
REPORT ZTEST_UNICODE_LENGTH.
DATA: l_len type i,
l_str type string.
l
_str = '测试汉字长度'.
l
_len = CL_ABAP_LIST_UTILITIES=>DYNAMIC_OUTPUT_LENGTH( l_str ).
write: `Length1 is`, l_len.
l
_str = 'Test'.
l
_len = CL_ABAP_LIST_UTILITIES=>DYNAMIC_OUTPUT_LENGTH( l_str ).
write:/ `Length2 is`, l_len.
|
run:
the above.