Ansicht
Dokumentation

ABAPMOVE_CONVERSIONS - MOVE CONVERSIONS

ABAPMOVE_CONVERSIONS - MOVE CONVERSIONS

ABAP Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

Type Conversions Used by the MOVE Statement

Siehe Type Conversions in Unicode Programs.

Conversion table (f -> g) based on the types of f and g. Data type I is not listed separately. It is handled like type P without decimal places.

C -> C
Target is filled from left to right. If the target field is longer than the source field, it is filled with blanks from the right. If the target field is shorter, the contents are truncated at the right.
C -> STRING
The length of the source field is defined by
STRLEN( f ) ); only this number of characters is copied into the target field. Spaces at the end of the source field are not copied.
C -> D
The field f should contain an 8-character date in the form YYYYMMDD.
C -> F
The string in f must be a valid representation of a type F field (See DATA).
C -> N
Only the digits in the source field are copied. The field is right-justified and filled with trailing zeros. If the target field is too short, the overflowing digits to the left are truncated.
C -> T
The source field should be a 6-figure time in the form HHMMSS.
C -> P
The source field must contain the representation of a decimal number - that is, a sequence of digits with an optional sign that contains no more than one decimal point; the source field can include spaces on either side. If g is too short, an overflow may occur possibly causing the program to abort.
C -> X
The source field should contain a sequence of hexidecimal digits (that is, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). The number to be converted is considered to hexidecimal, not decimal. For example:
C'15' -> X'15'.
Target is filled from left to right; to the right, the contents are either truncated or zeros are added.
Example.: C'AB' -> X'AB00'.
f is only read to the first space
Examples:
C'ABC' -> X'ABC0', C'ABC0' -> X'ABC0'
C'ABC D' -> X'ABC0', C' AB' -> X'0000'
C -> XSTRING
Similar to the above, except that zeros are not added to the target field, since the length is implicitly the number of valid characters.
The only exception to this rule is when the source field contains an uneven number of valid characters, in which case a zero is added.
Example.: C'ABC_D' -> X-String'ABC0'
D -> C
Filled from left to right without conversion
D -> STRING
like D -> C and then C -> STRING
D -> D
Filled without conversion
D -> F
like D -> P and then P -> F
D -> N
wie D -> C
D -> P
see P -> D (reversed)
D -> T
not supported - causes an error message
D -> X
see X -> D (reversed)
D -> XSTRING
as above, only the significant bytes are copied
F -> C
f is converted to the E format and transported to g. For example: F'-3.142' -> C'-3.14200000000000E+00'
If the mantissa is not equal to 0, it is normalizd so that it lies between one and ten. The exponent contains 2 characters; or 3 if it is greater than 99 or less than -99. It is always signed.
If g is too short, the mantissa is rounded..
For example.: F'3.152' -> C' 3.2E+00'.
g should be at least 6 characters long; otherwise it is filled with stars.
F -> STRING
Similar to the above, except a maximum exactness (number of decimal places) is specified. The string cannot contain spaces on either side. This means that not all strings have the same length - for example, due to a missing sign or different exponents.
Examples:
F'12.3'        -> `1.2300000000000000E+01`
F'1.23E111'    -> `1.2300000000000000E+111`
F'-0.123E-111' -> `-1.2300000000000000E-112`
F -> D
see F -> N
F -> F
Copied without conversion
F -> N
Source field is rounded as for F -> P then treated like a P type field
F -> P
f is rounded, for example. F'-3.512' -> P'-4'.
F -> T
see F -> N
F -> X
see F -> N
F -> XSTRING
As for F -> X, except that leading Nullbytes are not copied.
N -> C
f is treated like a C type field; leading zeros remain
N -> STRING
As above, Length of N determines length of trrget field
N -> D
As for N -> C and then C -> D
N -> F
As for N -> P and then P -> F
N -> N
Filled from right to left, to the left truncated or filled with leading zeros.
N -> P
f is packed, with positive sign and copied to g. If g is too short, an overflow error may cause the program to abort.
N -> T
As for N -> C and then C -> T
N -> X
As for N -> P and then P -> X
N -> XSTRING
As for N -> X, except that leading Null-Bytes are not copied
P -> C
f is copied with sign and, if necessary, a decimal point
For example: P'-1234567' -> C'12345.67-'
Notes:
1) A character is reserved for the sign. If the number is positive, the sign is a space.
2) Leading zeros are converted to spaces.
3) If g is too short, the sign is removed from positive numbers; if gis still too short, the contents are truncated to the left (indicated with a * character).
Examples (the source field is 2 digits long, the target 3):
P'123' -> C'123', P'-123' -> C'*3-'
4) If you do not want to reserve a character for the sign, use WRITE TO with the NO-SIGN addition.
5) If you want the leading zeros to appear in the character field, use UNPACK.
P -> STRING
As above, except that leading spaces are truncated. A character for the sign is reserved explicitly (see above, 1) - that is:
P'1.23' -> `1.23 `, P'-1.23' -> `1.23-`
If a positive number (also for type I) is assigned to a string, the string has a blank at its last position which, in contrast to character fields of type C, is considered during processing with the statement CONCATENATE, for example.
P -> D
The value in the source field is considered to be an absolute date (number of days since 01.01.0001) and copied to the target in the form YYYYMMDD. The system automatically switches from the Julian to the Gregorian calendar on the 15.10.1582. 0 and negative values are copied as 00000000.
P -> F
Content of f is copied to g using floating point arithmetic.
P -> N
Copied from left to right without a sign; filled with leading zeros to the left.
P -> P
If g is too short, an overflow error may occur, possibly causing the program to abort.
P -> T
The value in f considered to be an absolute time (that is, as the number of seconds since midnight) is copied to g in the form HHMMSS.
P -> X
A packed field is converted to type I. The resulting four bytes are placed in the target field right-aligned and in big-endian format. If g is too short, the system truncates left. If the target field is longer than 4, the left is filled with Hex-Null.
Negative numbers are repreesented by the two's-complement (= bit-by-bit complement +1).
P -> XSTRING
Like P -> X, except that leading Null-bytes are not copied.
T -> C
Like D -> C
T -> STRING
Like D -> STRING
T -> D
Not supported: causes an error message
T -> F
like T -> P and then P -> F
T -> N
like T -> C
T -> P
see P -> T (reversed)
T -> T
Copied without being converted
T -> X
see X -> T (reversed)
T -> XSTRING
as above, only significant bytes copied
X -> C
f is converted to a hexadecimal character string , the result is copied from into g from left to right, and then truncated, or filled with spaces
For example:: X'0F' -> C'0F'
X -> STRING
as above, except that g is not filled with spaces (length of the string is twice the length of the X type field)
X -> D
The value in f is treated as an absolute date (that is, the number of days since 01.01.0001) and copied to g in the form YYYYMMDD. (Similar to P->D).
X -> F
like X -> P and than P -> F
X -> N
like X -> P and than P -> N
X -> P
f is treated as a hexidecimal number and copied to g in packed decimal form.

For example: X'0F' -> P'15'
If f is longer than four characters, only the last 4 bytes are copied. If g is too short, an overflow error may occur.
X -> T
The value in f is interpreted as an absolute time (number of seconds since midnight) and copied to g in the form HHMMSS (similar to P->T).
X -> X
Copied from left to right then filled with X'00'or truncated
X -> XSTRING
f is copied full-length; that is, XSTRING and the X type field are of exactly the same length; zeros on the right are not truncated (in constrast to C -> STRING)
STRING -> ?
f is first copied to a character field (type C) of the same length as the current length of the character string. Then the contents are converted according to the type of g (see C ->?).
XSTRING -> ?
f is first copied to a hexidecimal field (type X) f the same length as the current length of the hexidecimal string. Then the contents are converted according to the type of g (see X ->?).






ABAP Short Reference   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 12052 Date: 20240420 Time: 102511     sap01-206 ( 141 ms )