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

Displaying 3 decimal places?

Former Member
0 Likes
11,305

Hi,

I have a bespoke program which picks up lines from bsis and displays them on a screen, the user then selects a few lines and the program posts them using program RFBIBL00.

Currently this program is working perfectly but I have a few countries which work with 3 decimal places instead of 2 and the program isn't picking this up.

I've found that table TCURX holds currencies which have 3 decimal places but I want to know how I change all my internal tables and screen fields to suddenly have 3 decimal places instead of 2? My internal tables and screen fields are all based on fields from BSIS and I have ALV grids and individual screen fields. Do I need to duplicate all of the amount fields, one set to have 2 decimal places and the other to have 3?

Any suggestions welcome.

Gill

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
7,589

Hi,

Best would be to have all variables with 3 decimal places. That would serve for all scenarions.

Since you are not making any changes in the amounts you need not do any rounding anywhere.

10 REPLIES 10
Read only

Former Member
0 Likes
7,589

If it is only the display that you are concerned about - carry out a P to C conversion and use string concatenation and then a C to P conversion if required

Read only

Former Member
0 Likes
7,589

Hi,

You can have your curr fields in the internal table with 3 char.

Use FM ROUND to round off for the countries which have 2 -decimal digits.

Hope it helps,

Raj

Read only

Former Member
0 Likes
7,589

hi

just try to pass your value to var,it will take care of it.

data: var type p decimals 3.

hope this helps

regards

Aakash Banga

Read only

Former Member
0 Likes
7,590

Hi,

Best would be to have all variables with 3 decimal places. That would serve for all scenarions.

Since you are not making any changes in the amounts you need not do any rounding anywhere.

Read only

0 Likes
7,589

I would prefer to just have one set of variables, but my users don't want to see 3 decimal places if the currency they are dealing with only has 2. How can I use the same variables but display 2 and 3 decimal places at runtime?

Read only

0 Likes
7,589

At the time of display you can very well limit the noumber of decimal places.

Have 3 decimal places variables that should work internally and at the time of display depending on country you could display 2 or 3 decimals.

decimals_out(6) type c, " decimals in write statement For ALV output.

There is option in case of WRITE statement too.

Read only

0 Likes
7,589

OK, I've figured this out.

If you define your screen fields (on the screen not in your data declarations) as CURR not DEC as mine were then you can put in a field as a reference. I defined a new field (not a screen one) which held the currency for the screen. If I define all my currency amount fields with 3 decimal places but refer them all to the currency field then they appear as 2 or 3 decimals places depending on the currency.

Thanks for all your suggestions, they got me thinking on the right track.

Read only

0 Likes
7,589

Good at least the solution is there.

Read only

Former Member
0 Likes
7,589

OK, I think I have 2 issues:

1. Displaying 2 and 3 decimal places using the same fields.

2. Processing 2 and 3 decimal places using those fields.

Do I need to define 2 sets of fields, one with 2 decimal places and one with 3? Or can I change the display and the processing at runtime?

My program needs to work with 2 and 3 decimal places, although not at the same time on the same screen (hopefully!).

Read only

Former Member
0 Likes
7,589

Hi Gill,

Yes you would have to declare 2 variables with 2 & 3 decimal places respectively.

Best regards,

Prashant