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: 

Table maintenance

Former Member
0 Kudos

Hi all,

I have a strange problem. I have a custom table called ztfin_ftpr and there is a field called ZKPRS which is a currency field. Length is 11 and 4 decimal places.

When I view the contents of the table future prce zkprs in a row is displayed as 0.6200 but when I go to sm30 and display it is displayed as 62.00. I tried to adjust the table from se14 but the contents do not reflect the same. Can anyone explain what could be the reason behind this ?

<u><b>Reference table is T001 and reference field is waers.</b></u>

Regards,

Varun.

Message was edited by: varun sonu

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Is there any associated Currecny type for this currency field. that might be due to currency settings.

Regards

vijay

19 REPLIES 19

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I guess it would depend on what currency key is tied to your field. I assume that one is tied to your field?

Regards,

Rich Heilman

former_member188685
Active Contributor
0 Kudos

Is there any associated Currecny type for this currency field. that might be due to currency settings.

Regards

vijay

0 Kudos

Hi,

<b>Reference table is T001 and reference field is waers</b>.

Regards,

Varun.

0 Kudos

that is the reason it is behaving like that. when you enter in SM30 it takes like that only ,But when you see the table contents it will show differently using the Currency key from T001.

Regards

vijay

0 Kudos

Hi,

<b>Srinivas , What isthis conversion to external format ?</b>

Also if it takes the waers foramt , its length is 5 and 0 decimals. In that case it should be like 16 or something else why is it 16.00

Can you explain me more clearly like how this is effecting my value ? Is there any way to resolve that ?

Regards,

Varun.

Message was edited by: varun sonu

Message was edited by: varun sonu

0 Kudos

When you define a CURR, or DATS, or QUAN or a TIMS field, system stores the value in one format and converts it into external format when it comes to display. If you go down into the database table (say in oracle), you will find that a currency field of 4 decimals is always stored with 4 decimals. But when comes through the application layer for display, system uses the currency key reference field to determine the number of decimals to show. If no currency key is known, then it uses default 2 decimals. So let us say you store a value of $20.02 in a currency field of 4 decimals and also have a value of USD in the currency key reference field, then system will store the value in the database as .2002. When it is brought up for display, you will see it as 20.02 because, for USD, the number of decimals is 2 as per configuration. The same value for JPY(Yen) will show as 2002 as there are no decimals in Japan currency. Since the number of decimal places for each currency are different, but the field that stores the values is the same, SAP came up with this internal/external logic.

Srinivas

0 Kudos

Hi,

I very well understood what is this internal/external logic. Thanks a lot srinivas for your detailed description. One doubt which is not yet cleared is when I retrieve data from the table for operations which is used ? internal one or external one ?

Regards,

Varun.

0 Kudos

When you retrieve data from the database in a program, you will get data in internal format. That is why you will see date values coming as YYYYMMDD in your select statements.

0 Kudos

Hi,

<b>when comes through the application layer for display, system uses the currency key reference field to determine the number of decimals to show</b>

So when it is displaying in the table maintenance it should show as a whle number like 16 or 1600 some thing like that. Beause t001-waers has length 5 and no decimal places. But it is not the case.Can you please explain me this ?

So you mean to say the reference field filed has nothing to do in connection with calculations, all it matters is how it is displayed. Is that right ?

Regards,

Varun.

0 Kudos

It is not the reference field definition that matters, it is the value of the reference field that is used. So if you have a value of 'USD' for the reference field, then the system determines that the currency field should have two decimals, but if the value of the reference field is 'JPY', then the system determines the number of decimals to be 0.

0 Kudos

Hi srinivas,

<b>for USD, the number of decimals is 2 as per configuration.</b>

Can you please tell me where can we check this configuration ?

Regards,

varun.

0 Kudos

You can go to the table TCURX and check the number of decimals for each currency.

0 Kudos

You will configure them in IMG. Here is the path


SAP Customizing Implementation Guide
-->General Settings
   -->Currencies
      -->Set decimal places for currencies

0 Kudos

Hi Srinivas,

I cannot find an entry USD in the table TCURX.So I think as you said it would take default 2 decimals. SO now if I configure in such a way that usd 4 decimale will it appear as .1600 ?

That is fine when I am trying to use the value in the callculations will the correct one be used or is it again going to base upon the reference field ?

Also srinivas I think I am bothering you a lot asking you many quoestions.Can you give me the link where I can find all info regarding this.

Regards,

Varun.

Message was edited by: varun sonu

0 Kudos

TCURX will be maintained for all those currencies for which you want to maintain different decimals than the standard 2 decimal places. That is why you will not see USD in there. <b>Do not configure it for your purpose as that will have so many implications all over the system.</b>

As I mentioned before, why can't you just define it as a DEC field? As long as you are using currency field, you have to take care of the currency key(reference field) as well. If you are not dealing with multiple currencies on your Z table, why not simply define the field as a normal DEC field?

0 Kudos

Here is the <a href="http://help.sap.com/saphelp_47x200/helpdata/en/4f/991f82446d11d189700000e8322d00/frameset.htm">documentation</a>

0 Kudos

Hi Srinnivas,

Thank you very much srinivas for your patience and constant help.

Regards,

Varun.

0 Kudos

Hello Srinivas,

I have the problem that I enter 1000 CLP (0 decimals) in the SM30 layout. After I press enter the layout shows me 100.000 CLP(plus the 2 decimals of the table field). In the table I find after saving the data 1000,00 CLP.

Could you tell me what happend.

Best regards

Jürgen

Former Member
0 Kudos

This is how a currency field behaves. The conversion to external format happens when you try to update it through SM30. If you want the field to behave the same way everywhere, make it a DEC field instead of CURR field and remove the currency key reference to T001-WAERS.