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: 

Number of Decimal Places

Adi_Bathineni
Participant
0 Kudos
1,681

Hi Guru's,

I've a requirement to display the 9 digits after the Decimal Point in some of my reports.

For example, suppose the value is 1234.24, it should display as 1234.243561234.

Is there any FM is available for do that??

Or should i change the Domain in the Standard SAP??

Or is there any RULE i can change in VOFM??

Please guide me on this.

Thanks in Advance.

Adi.

8 REPLIES 8

former_member181995
Active Contributor
0 Kudos
241
Or should i change the Domain in the Standard SAP??

Stop!No No Never do that.

Domain is Lower level of hierarchy at database level.it would impact your all standard objects where it domain is being used.

So look for either standard domain which gives you 9 decimal places or create Custom domain at data dictionary and use this domain in your report.

former_member156446
Active Contributor
0 Kudos
241

Hi there

If you want to show 9 decimals in the report .. change the attributes of the field in the structure you are sending data to the FM or the Class or method

data: lv_data type p decimal 9.

change to the sap standards DE or domain is modification for ever.. dont even think unless you rule out all the options available to test..and verify.

0 Kudos
241

>

> data: lv_data type p decimal 9.

But this will store amount only upto 999999.999999999 which is really doesn't make any sense,and not sufficient(unless your turnover of business upto only some thousand Dollars ).

REPORT:test.
data: test TYPE p DECIMALS 9 VALUE '999999.999999999'.
test = test + 1 .
WRITE:test.

Result Dump.

if in any case amount exceeds you will get Dump(As Just discussed today,hope you remember),so better to get rid of this situation you should search for alternate standard domain if available, else go for Custom domain.

0 Kudos
241

Hi,

Thanks for your suggestions.

But as per my requirement the value must be greather than 999999.999999999.

I need to display the value for ex:

12345678.999999999

Please suggest me the suitable solution.

Thanks in advance.

Adi.

0 Kudos
241

>

> But as per my requirement the value must be greather than 999999.999999999.

I know,That's why i was not Convinced with Joy's suggestion.

REPORT:test.
data: test TYPE PSA_AMT_LIST  VALUE '12345678.999999999'.
test = test + 1 .
WRITE:test.

Use Data element PSA_AMT_LIST

former_member156446
Active Contributor
0 Kudos
241

Hi there..

[... DECIMALS n|http://www.abapprogramming.net/2008/06/sap-abap-syntax-for-data-part-four.html]

Effect

Only makes sense with field type P . When you perform calculations and on output, the field has n decimal decimal places, where n is a number between 0 and 14.

In the case of newly generated programs, you normally activate fixed point arithmetic in the attributes. If it is not set, the DECIMALS specification is taken into account on output, but not when performing calculations. This means that the programmer must take care of any decimal point calculations by multiplying or dividing by powers of ten.

Fixed point arithmetic should always be active when you are performing calculations, since this enables intermediate results (for division) to be calculated as accurately as possible (in this case, to 31 decimal places).

To decide whether you should use the fixed point type P or the floating point type F , see "ABAP/4 number types ".

Adi_Bathineni
Participant
241

Thanks Guys for your help.

I've created a domain and data element with the required data type.

The problem is resolved.

Former Member
0 Kudos
241

Adi - rather than just marking your old posts as solved, you might also click the radio buttons next to the answers that helped you.

Rob