Skip to Content
avatar image
Former Member

how to remove zero after decimal point.

hi friends

how to remove the zero after decimal points.

example :

123.450 -- if print only 123.45

45.600 - 45.6

any body help me.

thanks

pauldhama

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 07, 2008 at 07:27 AM

    hii

    use FM

    FTR_CORR_SWIFT_DELETE_ENDZERO

    this FM will remove all the zeros from decimal values

    like

    value - 234.8000000

    output - 234.8

    regards

    twinkal

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 07, 2008 at 07:21 AM

    hi..

    Use..keyword: SHIFT

    ex:

    SHIFT varb1 RIGHT DELETING TRAILING '0'.

    regards,

    Padma

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 07, 2008 at 07:23 AM

    Hi,

    write: gv_variable decimals 0.

    Darren

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 07, 2008 at 07:25 AM

    Hi,

    do this way

     SHIFT VALUE LEFT DELETING LEADING '0'.
    

    Thanks,

    Chidanand

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 07, 2008 at 07:30 AM

    go through this example

    it may help u

    DATA: T(14) VALUE ' abcdefghij',

    STRING LIKE T,

    STR(6) VALUE 'ghijkl'.

    STRING = T.

    WRITE STRING.

    SHIFT STRING LEFT DELETING LEADING SPACE (or use 0 to detete 0).

    WRITE / STRING.

    STRING = T.

    SHIFT STRING RIGHT DELETING TRAILING STR or 0.

    WRITE / STRING.

    Output:

    abcdefghij

    abcdefghij

    abcdef

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 07, 2008 at 07:30 AM

    hi,

    try with CEIL command....

    Regards,

    Shankar.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 07, 2008 at 08:18 AM

    Hello

    Try this logic:

    data: var1 type p decimals 3,
          var2 type p decimals 2,
          var3 type p decimals 1.
    move '12345.100' to var1.
    move var1 to var2.
    move var1 to var3.
    
    if var2 = var1.
      if var3 = var1.
        write var3.
      else.
        write var2.
      endif.
    else.
      write var1.
    endif.
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 10, 2008 at 01:16 PM

    Hello

    Tryt his code :

    data amt(6) type p decimals 3 value '123.450'.
    data amt1(6) type p decimals 2.
    data amt_c(6) type c.
    unpack amt to amt_c.
    shift amt_c right deleting trailing '0'.
    pack amt_c to amt1.
    
    write amt1.
    

    regards,

    Advait

    Edited by: Advait Gode on Oct 10, 2008 3:16 PM

    Add comment
    10|10000 characters needed characters exceeded