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

smartforms decimal formats

Former Member
0 Likes
7,198

Hello experts,

When a smartform is out, the number with decimal places is display in this way, '459.89,00'. The format I want is '459,89.00'. How can I control the output format of decimal places?

1 ACCEPTED SOLUTION
Read only

satyabrata_sahoo3
Contributor
0 Likes
3,885

Navigate, System->User Profile-> Own Data or Transaction code - SU3 . Change Default decimal notation to 1,234,567.89.  It will work.

But for permanent solution and for all country specific user you can use 'SET COUNTRY <Country Key> ' before the decimal amount printed on the form.

Ref:

http://help.sap.com/abapdocu_70/en/ABAPSET_COUNTRY.htm

-SS-

6 REPLIES 6
Read only

Former Member
0 Likes
3,885

Hi,

1.Goto SU3.

2.Defaults tab.

3. Change the decimals notation

Hope it helps. Please do let us know if you are still facing the issue.

Regards

Purnand

Read only

0 Likes
3,885

Hi Purnand,

It works and thank you. I also want to know the universal setting of smartforms independent of users. Because it wastes time to go to SU3 for each end user. Thanx.

Best regards,

ts

Read only

Former Member
0 Likes
3,885

Hi,

Please try the follwoing code.it formats the output in user format:-

  

   FORM change_user_format CHANGING p_value.
  DATA: lv_amount(14)    TYPE p DECIMALS 3
          ,l_user_decimal  TYPE usr01-dcpfm
          ,lv_str(15)      TYPE c
          ,lv_str1(15)     TYPE c
          ,lv_str_unit(15) TYPE c
          ,lv_frac         TYPE p DECIMALS 3
          ,lv_count        TYPE i
          .

  SPLIT p_value AT space INTO lv_str lv_str_unit.
  SELECT SINGLE dcpfm         "Decimal notaion
  FROM   usr01                "User master record (runtime data)
  INTO   l_user_decimal
  WHERE  bname EQ sy-uname.

  CASE l_user_decimal.
    WHEN ' '" Decimal point is comma

        TRANSLATE lv_str USING '. '.
      TRANSLATE lv_str USING ',.'.
    WHEN 'X'" Decimal point is period: N,NNN.NN
      TRANSLATE lv_str USING ', '.
    WHEN 'Y'" Decimal p
      TRANSLATE lv_str USING ',.'.
  ENDCASE.
  CONDENSE lv_str NO-GAPS.
  TRY.
      lv_amount = lv_str.
    CATCH cx_sy_conversion_no_number.
      EXIT.
  ENDTRY.
  lv_frac = frac( lv_amount ).
  IF lv_frac > 0.
    WRITE lv_amount TO lv_str DECIMALS 1.
  ELSE.
    WRITE lv_amount TO lv_str DECIMALS 0.
  ENDIF.
  CONCATENATE lv_str lv_str_unit INTO p_value SEPARATED BY space.

ENDFORM.                    "change_user_format

Hope it helps,

BR,

Nitin

Read only

satyabrata_sahoo3
Contributor
0 Likes
3,886

Navigate, System->User Profile-> Own Data or Transaction code - SU3 . Change Default decimal notation to 1,234,567.89.  It will work.

But for permanent solution and for all country specific user you can use 'SET COUNTRY <Country Key> ' before the decimal amount printed on the form.

Ref:

http://help.sap.com/abapdocu_70/en/ABAPSET_COUNTRY.htm

-SS-

Read only

0 Likes
3,885

Hi SS,

I have the same issue and I tried to use SET COUNTRY <Country Key> statement in the driver program before calling the smartform's FM and also in the initialization of the smartform.

But it doesn’t seems to work for me, It’s still picking the format from user profile irrespective of the country.

Please assist me on this.

Thanks,

Anand

Read only

0 Likes
3,885