Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

difference between type n and type i

Former Member
0 Kudos

Hi can anyone tell me the difference between numc(type n),

type c and type i.

Thanks

4 REPLIES 4

Former Member
0 Kudos

Type Value Area Initial Value

c Any alphanumeric character " " for every position

i -2.147.483.648 to +2.147.483.647 0

n Any alphanumeric characters, however, valid values are

Notes

The system class CL_ABAP_EXCEPTIONAL_VALUES contains methods that return the minimum and maximum value for a data object (as of release 6.10).

As the decimal places of a floating point number of type f are represented internally as dual fractions, there is not an exact equivalent for every number that can be represented in the decimal system. This can lead to rounding errors in assignments and intermediate results of calculations. These errors can be avoided by using a two-step rounding procedure.

For data objects of data type p, the program attribute fixed point arithmetic must be set so that the decimal separator is taken into account. Otherwise, the content is handled as if there is no decimal separator, in all operations except for displaying a list.

Example

According to the formula in the table, the value area of a packed number with length 2 and two decimal places is (-10(2x2 -1) +1) / (102) bis (+10(2x2 -1) -1) / (102) and therefore =-9.99 to +9.99 in steps of 0.01. A value within this range, for example, 1.428, is rounded up to 1.43.

DATA: pack(2) TYPE p DECIMALS 2,

result TYPE REF TO data.

FIELD-SYMBOLS <result> TYPE ANY.

result = cl_abap_exceptional_values=>get_min_value( pack ).

IF result IS NOT INITIAL.

ASSIGN result->* TO <result>.

WRITE <result>.

ENDIF.

result = cl_abap_exceptional_values=>get_max_value( pack ).

IF result IS NOT INITIAL.

ASSIGN result->* TO <result>.

WRITE <result>.

ENDIF.

Former Member
0 Kudos

CHAR C array of c_ubyte left-aligned string filled with spaces string

NUMC N array of c_ubyte right-aligned zero-filled string containg digits only integer

INT4 I c_int integer integer

Former Member
0 Kudos

Type Description DL Initial value

C Character 1 Space

N Numeric text 1 '00...0'

D Date YYYYMMDD 8 '00000000'

T Time HHMMSS 6 '000000'

X Byte (heXadecimal) 1 X'00'

I Integer 4 0

P Packed number 8 0

F Floating point number 8 '0.0'

Sample Code:

DATA: ws_data TYPE char10.

ws_data = 'SAMPLE'.

WRITE:/ ws_data.

DATA: ws_data1 TYPE i.

ws_data1 = 10.

WRITE:/ ws_data1.

DATA: ws_data2 TYPE n LENGTH 2.

ws_data2 = 31.

WRITE:/ ws_data2.

Regards,

Prakash.