Difference between “‘” and “`” in ABAP

0
375

A basic difference: still I find that most of the programmer hardly uses string literal. String literal is generally a forgotten case.

A character sequence within single quote characters (‘) is a char literal, while within (`) is a string literal. That is especially important for trailing spaces: a string literal preserves the trailing space while a char literal ignores them.

This can be best understood by the following example:

DATA v_char TYPE c LENGTH 32.
v_char = 'This is a'.
CONCATENATE v_char 'text   ' INTO v_char SEPARATED BY space.
*" v_char would be "This is a text"
CONCATENATE v_char `text   ` INTO v_char SEPARATED BY space.
*" v_char would be "This is a text   "

LEAVE A REPLY