关于ABAP中的Literal

下面是从我的开发环境中的帮助文件中找出的:

Text field literals are character strings included in single inverted commas (). They have the data type c in the length of the included characters, including trailing blanks. There is no empty text field literals: The text field literal is identical to the text field literal ‘ ‘ of length 1.

注意我标记为红色的地方,和最后一句话的意思无法统一。按照我的理解,前面应该漏了doesn’t.

还是help.sap.com上的说明比较清楚(注意黑体部分):

Character literals are sequences of alphanumeric characters in the source code of an ABAP program enclosed in single quotation marks or backquotes.

Character literals enclosed in quotation marks have the predefined ABAP type C and are described as text field literals.

Literals enclosed in backquotes have the ABAP type STRING and are described as string literals. The field length is defined by the number of characters. With text field literals trailing blanks are ignored while in string literals they are taken into account.

Character literals can be up to 255 characters long. A text field literal is always at least one character long (entering ‘ is the equivalent of ‘). A string literal can also be empty (entering ` is the empty string with length zero ´).

If you want to enter a character literal in the ABAP Editor that is longer than a single editor line,
ABAP syntax


allows you to enter several character literals and link them using the & character. If a character literal contains a quotation mark or backquote, you must repeat it to enable the system to recognize the contents as a character literal and not as the end of the literal.

总结一句:表示一个空格的字符,请使用` `。

Comments are closed.