cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic decimal places

Former Member
0 Kudos

Hi All,

I have one our form, that decimal fields and numeric fields are defined Locale: Danish(Denmark). it shows all the amounts with 2 decimal places. like 62.83.

Now I want to change it, agree with the currency, in this case the currency is HUF and the result must be 6.283.

I already changed the field Locale to default Locale, but the result is the same 62.83 instead of 6.283.

My Form properties - Defaults - Default Form Locale has Viewer's system locale.

Any help is Welcome.

Best regards,

Ana

Accepted Solutions (1)

Accepted Solutions (1)

OttoGold
Active Contributor
0 Kudos

Note the existence of the patterns. Display pattern should help you here.

Otto

Former Member
0 Kudos

Pattern put alwayse the same number of decimals, but I want that is changed agree with the currency.

In this case HUF not has decimal places, I don't want to see.

Do you know to do it??

Thanks for your time.

Ana

OttoGold
Active Contributor
0 Kudos

I told you something not that elegant but working in the first post already. For every field create for example two versions. One for HUF, change . or , ..pick how many decimals etc. and use scripting to show one field and hide the other one or vice versa. If you don´t like this approach, you can always send string from backend into a text field.

You have two "workarounds" which work for sure....

Otto

Former Member
0 Kudos

Thank you for the soluction with 2 fields, and show or not if it is HUF or not.

But I'd like one global solution for all currencies, because the SAP standard form just has one field for all currencies.

When I created my form, I defined DK with language and now the field stills with DK settings, I already remove it in XML tab, but is alwayse the same result.

Any ideas?

Ana

OttoGold
Active Contributor
0 Kudos

Do you need the form to be interactive or not?

If not, I would use the strings approach. Use text fields instead of any numeric fields, you will need no patterns etc. Create a function module which will get the numbers and the language (and some customizing if you want to) and inside the FM use cases for all the situations/ languages and format the numbers into the strings.

At least that is what I would do. I have no better answer.

Otto

Former Member
0 Kudos

Hi Otto,

do you know any FM that do it?

Thanks in advance.

Ana

Answers (2)

Answers (2)

OttoGold
Active Contributor
0 Kudos

I have no idea what flexibility you need. For some cases a simple write should suffice. It is very likely you will have to do this manually for some cases... Otto

Former Member
0 Kudos

Hi Otto,

Thank you by the ideas, it helps to get the solution.

My amount fields are defined in Global definition tab from interface but not in Currency/qtty field.

Now it works, shows the amount agree with the currency defined.

Thanks

Ana

OttoGold
Active Contributor
0 Kudos

Try:

- change the language of the form in the printing program (not sure if helps for the locale)

- try to change the locale in the form, do not use default, pick a country from the list that matches your needs

- move the functionality to backend, format the numbers there and send it as a string to the form fields

- create multiple versions of a single field, where every field will have different static locale (denmark, germany etc.) and hide all the fields except the one that fits in (you will use some JS coding to check the value of some field from backend etc.).

Regards Otto

Former Member
0 Kudos

Hi Otto,

I have changed the locale for different languages, but the amount fields alwayse shows with 2 decimal places. Some puts like 6'500,00 instead of 650.000.

Some idea for solve it?

Thanks for all comments.

Ana