0

# [Smartform] explanation of round mechanism

Oct 02, 2017 at 06:31 AM

39

Hi Experts,

A Smartform in my ABAP system uses a specific method to round decimals. This method is unknown to me an I cannot find any explanation about the technique. Could someone explain it to me (or point me in the right direction)?

A variable of type WKGXXX (is a CURR field with 2 decimal places) is written in a text block. The line ends with "(<C.0)"? What does this mean? I've ran a testcase when the variable was filled with 105.7149999, but the result of the Smartform shows 105752.

```&VARIABLE(<C.0)&
```

Sandra Rossi Oct 02, 2017 at 07:27 AM
0
• &field(<)& : Displays the sign to the left of the number
• &field(.<nat.number>)& : Limits output of decimal places to <nat.number>
• &field(C)& : The system takes the field value as a sequence of words separated by blanks. Option C shifts these words to the left and leaves one blank in-between as a separator. Any leading blanks are omitted. This effect corresponds to that of the ABAP statement CONDENSE.
Show 1 Share

Aha, thanks Sandra. I did not find this page in my previous searches.

Sandra Rossi Oct 02, 2017 at 07:46 AM
0

105.7149999 looks like the decimal value of a float variable, so I guess the actual value is 105.715.

I guess you know it's 105.7149999 using the debugger or by input via SE37 test, i.e. this number is the actual value of the variable.

But when you output an amount in a smart form, the decimal point is dynamically re-determined. SAP looks for the currency code attached to it (either in the DDIC or in the smart form) and determines the real number of digits after the decimal point. If it's 2 digits (as with US dollar, Euro, and many currencies), then the result of the Smartform should be 1057.15.

As you say it's 105752, there must be some more calculations before the output. If it had been 105715, then I would have answered it's a currency code with 0 digits after the decimal point.

Share