问题
My favorite search engine (ecosia) could not find the canonical docs from upstream (SAP) about the meaning of uc_length
vs nuc_length
.
What is the difference between both?
I get these parameters with a modified version of clientPrintDescription.py
回答1:
I can't be sure what they do in the Python script, but based on my ABAP/SAP knowledge, I can easily say that:
- nuc_length: length of the parameter in a non-Unicode ABAP-based system, in number of bytes
- uc_length: length of the parameter in a Unicode ABAP-based system, in number of bytes
A non-Unicode ABAP-based system uses one byte to encode each character, while a Unicode ABAP-based system uses two bytes to encode each character. From ABAP 7.50, all systems are Unicode.
In Unicode ABAP-based system, strings of characters and text fields can store Unicode characters from U+0000 to U+FFFF. Note that characters U+D800 to U+DFFF are considered like actual characters by the ABAP runtime environment (dixit ABAP documentation: "The ABAP programming language supports a subset covered by UCS-2 and not the full UTF-16 set.")
Note that structured parameters are made of several fields which can mix characters and non-characters, the "uc_length" will double the number of bytes only of the character fields. There are also some dummy bytes between fields because of "alignment".
In your example, a text field of 80 bytes in a Unicode system corresponds to 40 characters.
来源:https://stackoverflow.com/questions/58199184/sap-rfc-nuc-length-vs-uc-length