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

decimals - smartforms

Former Member
0 Likes
771

Hi,

I have a statement:

gs_unitprice = grkwert / <fs>-kwmeng.

result: gs_unitprice = 2,40708

gs_unitprice is defined as CURR field, 13 long, 5 decimals

Now, we want to only print the number with 4 decimals WITHOUT rouding the number.

So now my smartform prints: 2,4071 but they don't want this.

They want that my smartform prints 2,4070.

I've tried a lot of things, like making a type of field with 13 long, 4 decimals and move my field to that, but with the move it also rounds it up to 71 ...

Thanks a lot!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
713

Hi,

how about if you do this:

split gs_unitprice at ',' into myinteger mydecimals.

mydecimals = mydecimals+0(4)

concatenate myinteger ',' mydecimals into gs_unitprice.

With concatenate perhaps you need a field of type C or String.

5 REPLIES 5
Read only

Former Member
0 Likes
713

define a variable for 13 with decimals 4 and use the ciel function.

lnew = ciel( lold ).

Regards

Anurag

Read only

Former Member
0 Likes
713

Use the function ROUND with input = gs_unitprice

an decimals as 4.

CALL FUNCTION 'ROUND'

EXPORTING

DECIMALS = '4'

INPUT = gs_unitprice

IMPORTING

OUTPUT = gs_unitprice

EXCEPTIONS

INPUT_INVALID = 1

OVERFLOW = 2

TYPE_INVALID = 3

OTHERS = 4.

Regards,

Ravi

Read only

Former Member
0 Likes
714

Hi,

how about if you do this:

split gs_unitprice at ',' into myinteger mydecimals.

mydecimals = mydecimals+0(4)

concatenate myinteger ',' mydecimals into gs_unitprice.

With concatenate perhaps you need a field of type C or String.

Read only

Former Member
0 Likes
713

Hi,

I thim\nk the simplest would be to take the value in the character format. Split the character at the '.'. Take the 4 characters of the split portion and concatenate it with the first half.

the syntax for splitting is given in above reply. U can refer that.

Hope this solves ur problem.

regards,

Ankit.

Read only

Former Member
0 Likes
713

Hi !

Thanks a lot for your reply!

It works by splitting the stuff!