SAP CONVERSION TYPE N

Get Example source ABAP code based on a different SAP table
  


ARTICLE

Source Field Type n
The conversion rules are designed in such a way that when data objects of type n are assigned to character-like data objects they behave as character-like data objects. Valid data for data objects of type n is in the form of pure character strings. When assigning valid data to numeric data objects, the numeric value of the character string is assigned to the target object. The conversion rules, however, also allow assignment of numeric text fields that contain invalid data. The latter is not recommended.
ITOC

Numeric Target Fields TargetConversion i,
int8, (b, s)Content is handled in the same way as a source field of type c pContent is handled in the same way as a source field of type c decfloat16, decfloat34Content is handled in the same way as a source field of type c fContent is handled in the same way as a source field of type c

Note
ABAP Code Snippet
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.
ABAP Code Snippet

Character-Like Target Fields TargetConversion cContent is handled in the same way as a source field of type c stringContent is handled in the same way as a source field of type c nThe characters in the source field are inserted in the target field, right-aligned. Trailing blanks are copied. If the target field is longer than the characters passed, the field is padded with '0' characters from the left. If the target field is shorter, the characters are cut off from the left. dContent is handled in the same way as a source field of type c tContent is handled in the same way as a source field of type c

Byte-Like Target Fields TargetConversion xThe content of the source field is first converted to the data type i (see above), and then to the type x (see the conversion table for source field type i,
int8, (b, s)). xstringThe content of the source field is first converted to the data type i (see above), and then to the type x (see the conversion table for source field type i,
int8, (b, s)).