Application Development and Automation 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: 
Read only

Run time Error

Former Member
0 Likes
843

Hi Folks,

When i write the program as below and if i check the floating point arithematic in the program attributes the system is throwing dump.

data : x type p length 3 decimals 2 .

x = 12356.

write : x.

What could be the reason behind that ???

Thanks,

Sriram .T

7 REPLIES 7
Read only

Former Member
0 Likes
811

declare x like this

data : x type p decimals 2 .

here you have specified length 3 but passing a large value so overflow was occuring.

regards

shiba dutta

Read only

Former Member
0 Likes
811

Hi,

Try like,

data : x type p length <b>5</b> decimals 2 .

x = 12356.

write : x.

The X length is exceeded the limit. So Only you got Runtime Error.

Check this link for Data Types.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e2335c111d1829f0000e829fbfe/frameset.htm

Thanks.

Reward If Helpful.

Read only

0 Likes
811

This is ok but, when i unckeck the folating pont arithematic field in the program attributes the program is working fine...

Thanks,

Sriram.

Read only

Former Member
0 Likes
811

Hi,

you have defined x as nnn,nn and will move nnnnn to it, that's

the problem.

set x with 123 or define it like length 5 decimals 2

Regards, Dieter

Read only

Former Member
0 Likes
811

Hi..

Packed numbers (ABAP/4 type P, Dictionary types CURR, DEC or QUAN) will be treated as integers when they are used in assignments, comparisons and calculations, irrespective of the number of decimal places defined when the checkbox is NOT ticked.

Intermediate results in arithmetic calculations will also be rounded to the next whole number. The number of decimal places defined is only taken into account when you output the answer using the WRITE statement.

Hence the short dump "A calculation field is defined too small."

Regards,

Arun

Message was edited by:

Arun Nair

Read only

Former Member
0 Likes
811

pls go through this it may help you

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb333d358411d1829f0000e829fbfe/content.htm">http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb333d358411d1829f0000e829fbfe/content.htm</a>

regards

shiba dutta

Read only

Former Member
0 Likes
811

Herewith is the CONCEPT underlying:

In type P fields, the system reserves one digit for the plus or minus sign, so a P field with length 3 can contain a maximum of 5 digits including decimals.

The situation is:

x = 12356 although the decimals point was not shown, the original value should be x = 12356.00 so there is a total of 7 digits. Therefore, runtime error BCD_FIELD_OVERFLOW occur.

As what was written:

Data : x(3) type p decimals 2 .

x = 12356. ===should be===> x = 123.56.

write : x.