Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Assignments →  Assignment Rules →  Conversion Rules for Elementary Data Objects →  Character-Like Source Fields 

Source field type string

Other versions: 7.31 | 7.40 | 7.54

Numeric Target Fields

Target Conversion
i, (b, s) Content is handled in the same way as a sourcefield of type c If the source field has a length of 0, the target field is assigned the value 0.
p Content is handled in the same way as a sourcefield of type c If the source field has a length of 0, the target field is assigned the value 0.
decfloat16, decfloat34 Content is handled in the same way as a sourcefield of type c If the source field has a length of 0, the target field is assigned the value 0.
f Content is handled in the same way as a sourcefield of type c If the source field has a length of 0, the target field is assigned the value 0.


Note

  • The CL_ABAP_DECFLOAT class contains the methods READ_DECFLOAT34 and READ_DECFLOAT16, to convert character strings into floating point numbers. The exceptions of these methods are more significant than those of a normal assignment. Furthermore, the methods return a return value that reveals information about the roundings carried out.

Character-Like Target Fields

Target Conversion
c The content is treated in the same way as a sourcefield of type c, with the difference that trailing spaces are transferred. If the length of the source field is 0, the target field is filled with blank characters.
string No conversion takes place. After the assignment, the internal reference of the target field pointsto the same string as the source field. A new string is only created in the memory if a change request for the content of the source field or target field is submitted.
n Content is handled in the same way as a sourcefield of type c If the length of the source field is 0, the target field is filled with the character "0".
d The content is treated in the same way as a sourcefield of type c, with the difference that trailing spaces are transferred. If the length of the source field is 0, the target field is filled with the character "0".
t Content is handled in the same way as a sourcefield of type c If the length of the source field is 0, the target field is filled with the character "0" and the trailing spaces are transferred.


Notes

  • In ABAP, the trailing blanks are taken into account for source fields of type string but not for data objects of type c.

  • If you truncate on the right when assigning character strings containing non-Unicode double-byte characters, such a character can be split down the middle, which generally results in an invalid character at the right edge. To prevent this, you can use the method CL_SCP_LINEBREAK_UTIL=>STRING_SPLIT_AT_POSITION.

Byte-Like Target Fields

Target Conversion
x Content is handled in the same way as a sourcefield of type c If the length of the source field is 0, the target field is filled with the hexadecimal 0.
xstring Content is handled in the same way as a sourcefield of type c If the length of the source field is 0, the length of the target field is also 0 after the assignment.