Skip to Content
avatar image
Former Member

Remove Decimals in Smartform

Hi Gurus/ Experts.

I have a trouble with my Smartform, especially with my numbers field. For example i will use field NETWR.

in my smartform the decimal is like this 123.321.231,000 how to remove the 000 please help me gurus / experts, and how to remove ,000 in quan field ? reward is available.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Jul 23, 2013 at 01:01 PM

    Hi Ri Zaldy,

    the reason for your problem is that your field is of type CURR.

    So it has a reference field, which already determines the number

    of digits after the decimal point. So usually it doesn't

    make sence to use the formatting option (.0), too.

    If you want to change the number of digits in your Smartform

    nevertheless, you should define a new number field (which is

    not of type CURR or QUAN) in your form, put ...-NETWR into it (e.g. via an ABAP node) and print the new field with formatting option (.0).

    Best Regards,

    Hedvig

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi Basti, i think you are not lucky today.. Because how is the way i can give you the Correct Answer that we talk in message ? hahaaha. I want give it to you, but the moderator not post my thread yet.

  • Jul 24, 2013 at 06:13 AM

    Hi,

    You can show the currency or Quantity field without decimals using below format

    Zero decimals: &<Variable>(.0)&.

    For various formating options you can refer below WIKI Link.

    http://wiki.sdn.sap.com/wiki/display/CodeExchange/Output+formatting+techniques+in+scripts+and+smartforms

    I hope this helps you

    - Harshad

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi harshad,

      Thank you, really thank you for your help. But I have to try that, and It didn't work. do you have any solution ?

  • avatar image
    Former Member
    Jul 22, 2013 at 01:25 PM

    Hi

    Set the option in command in your element text as this

    &NETWR(.0)&

    I hope this helps you

    Regards

    Eduardo

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 22, 2013 at 01:29 PM

    Hi

    &field(R10.2)&

    &NETWR(R10.2)&

    This will print of total length of 10 with 2 decimal places..

    &NETWR(R10.x)&  where x is the number of decimal place

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Venkateswaran Krishnamurthy

      Hello again Ven

      ok I see what you mean. Just make this one  clear, if my field is &WA_EKPO-NETWR& and I want to make it without decimals. In the reference field must I write like this

      Field Name                                        Reference Field                         Data Type

      &WA_EKPO-NETWR(R10.0)&          &WA_EKPO-NETWR(R10.0)     Curr

      do you mean like this ?

  • avatar image
    Former Member
    Jul 22, 2013 at 01:37 PM

    Hi Ri Zaldy,

    Try to check in debug mode how the netwr values.if the value is showing what you mentioned i think go to SU01---> click on the default values--> in decimal notification check the format(necessary then try to  change the format).

    Regards,

    Gurunath

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 24, 2013 at 06:29 AM

    Hi Zaldy,

    Please try below one..

    Defined three global parameters like

    data: lv_actvalue type string,

             lv_result     type string,

             lv_dec        type string.

    lv_actvalue = wa_ekko-netwr.

    split lv_actvalue at '.' into lv_result lv_dec.

    Now use lv_result for output field.

    Otherwise change your user settings in SU01.

    Thanks,

    Satya.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Zaldy,

      1. In smart forms --> Types Tab ---> take your table types declaration part netwr type as char10.

      2. Code initialization part---> after select query ---> netwr value pass to lv_actvalue ---> split to lv_actvaue into lv_result and lv_dec.

      3.  remaining all values and lv_result value append to your table.(i.e., as per types declaration ).

      Thanks,

      Satya.