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

Decimal Problem in fields

Former Member
0 Likes
5,112

Hi,

In Export invoice we are entering currency in USD.When we enter the value it accepts 3 decimal places.But it is stored as 2 decimal places in table.

Eg.2.059 USD in invoice screen

but in table 20.59 USD.

What is the problem?where we can rectify this error?

10 REPLIES 10
Read only

Former Member
0 Likes
1,869

Hi,

As it is a sap standard process screen. u check when u are saving the data in to the table i.e put a deberging by passing a command /H in the system command u will be in deberger mode press on save botton and their check the process of updating the values in to the table. First of all see the structure or work area using by the sap for the amount.

Regards,

Naresh

Read only

Former Member
0 Likes
1,869

Hi,

Check the data type of the field in the table, to which you pass this value. It may be of 2 decimal palces adn hence it would accept only 2 decimals...

Best Regards,

Ram.

Read only

Former Member
0 Likes
1,869

HI.

storing variable should be CHAR.

REgards.

Jay

Read only

Former Member
0 Likes
1,869

hi,

if in the table it is data type CURR,then defenitely it will store as 2 decimal places.it is accepting in the standard screen because the field will be customized like that(the currency key it will be referring may contain three decimal places or it may be type p with 3 decimals)..if the field is standard u cannot do anything..otherwise if it is z u can change the decimal fields..for standard table u can try appending one structure with field containing three decimal places and update this from the standard using user exit/badi

Edited by: soniya baboo on Jan 21, 2009 8:25 AM

Read only

Former Member
0 Likes
1,869

use lke dis...

write v_curr TO wa_curr CURRENCY 'USD'.

Read only

0 Likes
1,869

Hi...

u dont have to worry about it.If in the table if u select 1 record and select 'display button,u can see the amount in the correct decimal places....The table store the correct amopunt only.also if u r fetching the records from table,then also the correct value will come

Read only

Former Member
0 Likes
1,869

It will be stored with two decimal places. No issues with that. when you display this on your report, you have to specify the currency as USD and your issue will be resolved.

write: v_amount to v_amount currency 'USD'.

I am quoting from the help of the write statement below.


This addition defines currency-dependent decimal places for the output of data objects of data types i or p. For all other data types, except for f, the addition is ignored. For cur, a three-digit, character-type field is expected that contains a currency key from the column CURRKEY of the database table TCURX in uppercase letters. The system determines the number of decimal places from the column CURRDEC of the respective row in the database table TCURX. If the content of cur is not found in TCURX, two decimal places are used. The following applies for numeric data types: 

In the case of data types of type i, a decimal separator is inserted at the position determined by cur and the thousands separators are moved accordingly. 

In the case of data objects of type p, the decimal places defined in the definition of the data type are ignored completely. Irrespective of the actual value and without rounding actions, the decimal separators and the thousand separators are inserted at the positions in the numbers determined by cur. 

In the case of data objects of type f, the addition CURRENCY has the same effect as the addition DECIMALS (see below). Here, the number of decimal places is determined by cur. 

If the addition CURRENCY with length specification * or ** is used after AT, it is used first and the output length is determined from the result. 

Note 
The addition CURRENCY is appropriate for the display of data objects of type i or p without decimal places, whose contents are currency amounts in the smallest unit of the currency. 



Example 
The output of the WRITE statement is "123456,78". 

DATA int TYPE i VALUE 12345678. 
WRITE int NO-GROUPING CURRENCY 'EUR'. 

Read only

Former Member
0 Likes
1,869

Hello,

When the data is displayed on the screen for currency field which have a reference of a currency key field, the conversion takea place according to the currency key.

If you take for example Japanese Yen, which do not have decimals are stored in the database table ( KONV )with 2 decimals places , but while displaying on the screen the decimals are gone. So 100.00 in db is actually 10000 JPY on the screen.

This is standard behavior.

And yes when you want to output the value on the list or alv, you use the currency addition or give a reference field name for currency in the fieldcatalog respsectively.

regards,

Advait

Read only

Former Member
0 Likes
1,869

Hi,

all the currecies will be present int he table tcurx if the currecies you mentioned is present in that

table you have to divide by 100 .

Thanks & Regards,

Sateesh.

Read only

Former Member
0 Likes
1,869

Hi.

Please check your currency configuration and change method that's it.

Hope it help.

Sayan.