- SAP Community
- Groups
- Interest Groups
- Application Development
- Discussions
- Re: Regarding Literals

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.

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Regarding Literals

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

08-07-2007 7:03 AM

Hi,

I have a doubt regarding the default type that is associated with Numerical literals. When is the default type P and when is it I.

Thanks in advance.

Regards,

Sham.

- SAP Managed Tags:
- ABAP Development

1 ACCEPTED SOLUTION

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

08-07-2007 7:06 AM

Hi,

For P the literal value has to be in quotes like this '10.01'.

p = '10.01'.

For I it is normal.

i = 10.

P is for Floating point data where in you want to have DECIMALS as well.

I is for Integer type of DATA.

I size is 4 bytes Where as P size can be 1 to 16 bytes.

And P is generic you need to mention the length using ( ) or using LENGTH like this.

DATA: p_type(10) type P.

SAP Documentation for Numeric Literals if you have not seen this before.

<b>Numeric Literals</b>

Numeric literals consist of continuous sequences of numbers (0 to 9), which can be directly preceded by a plus or minus sign. Numeric literals between -2147483648 and 2147483647 have the predefined ABAP type i. Numeric literals outside of this interval have the predefined ABAP type p with a length of 8 bytes if they are not longer than 15 digits, and with a length of 16 bytes if they are not longer then 31 digits. Numeric literals with more than 31 digits are not possible.

In numeric literals, neither decimal separators nor scientific notation with mantissa and exponent are possible. To be able to represent numbers with fractional portion or numbers in scientific notation as a literal, you must use character literals. When using them at operand positions at which a numeric value is expected, they are converted accordingly. The same applies for numbers with more than 31 digits.

- SAP Managed Tags:
- ABAP Development

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

08-07-2007 7:06 AM

Hi,

For P the literal value has to be in quotes like this '10.01'.

p = '10.01'.

For I it is normal.

i = 10.

P is for Floating point data where in you want to have DECIMALS as well.

I is for Integer type of DATA.

I size is 4 bytes Where as P size can be 1 to 16 bytes.

And P is generic you need to mention the length using ( ) or using LENGTH like this.

DATA: p_type(10) type P.

SAP Documentation for Numeric Literals if you have not seen this before.

<b>Numeric Literals</b>

Numeric literals consist of continuous sequences of numbers (0 to 9), which can be directly preceded by a plus or minus sign. Numeric literals between -2147483648 and 2147483647 have the predefined ABAP type i. Numeric literals outside of this interval have the predefined ABAP type p with a length of 8 bytes if they are not longer than 15 digits, and with a length of 16 bytes if they are not longer then 31 digits. Numeric literals with more than 31 digits are not possible.

In numeric literals, neither decimal separators nor scientific notation with mantissa and exponent are possible. To be able to represent numbers with fractional portion or numbers in scientific notation as a literal, you must use character literals. When using them at operand positions at which a numeric value is expected, they are converted accordingly. The same applies for numbers with more than 31 digits.

- SAP Managed Tags:
- ABAP Development