Skip to Content
avatar image
Former Member

Suppressing zeroes after decimal

Hi

I need to suppress the zeroes after the decimal places in my form output if 00 appears after decimal.

eg 123.00 shd be displayed as 123 .

123.23 shd be dispalyed as 123.23.

Could anyone help me with this

TIA

Regards

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Feb 22, 2007 at 08:33 AM

    hi Ankur do this way

    data: wa_input  type i,      
          wa_output type i.
     
    wa_input = '1.000'.
     
    CALL FUNCTION 'ROUND'  
      EXPORTING    
        INPUT              = wa_input 
      IMPORTING   
        OUTPUT             = wa_output
      EXCEPTIONS
       INPUT_INVALID       = 1
       OVERFLOW            = 2
       TYPE_INVALID        = 3
       OTHERS              = 4.
     
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
     
    write:/ wa_output.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 22, 2007 at 08:35 AM

    hi Ankur,

    Check out this thread for a soultion

    https://forums.sdn.sap.com/click.jspa?searchID=1293636&messageID=2719031

    Regards,

    Santosh

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 22, 2007 at 08:36 AM

    Hi,

    Try this.

    DATA: float TYPE f VALUE '123.23',

    int TYPE i.

    int = float.

    IF int = float.

    WRITE: int.

    ELSE.

    WRITE: float.

    ENDIF.

    Regards,

    Sesh

    Regards,

    Sesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 22, 2007 at 08:38 AM
    REPORT ychatest.
    
    DATA : v_dec1 TYPE p DECIMALS 2 VALUE '123.00',
           v_char(15).
    
    v_char = v_dec1.
    SEARCH v_char FOR '...'.
    IF sy-subrc EQ 0.
      IF v_char+sy-fdpos(3) EQ '.00'.
      CLEAR v_char+sy-fdpos(3).
      ENDIF.
    ENDIF.
    
    CONDENSE v_char.
    WRITE : v_char.
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 22, 2007 at 08:43 AM

    hi,

    just move it to an integer variable.

    DATA: SPN(4) TYPE p DECIMALS 2 VALUE '124.00',
                T1PN(4) TYPE N.
    
    
    MOVE: SPN TO T1PN.

    Regards

    Anver

    Add comment
    10|10000 characters needed characters exceeded