cancel
Showing results for 
Search instead for 
Did you mean: 

Remove decimal point if there are only zeros after decimal in NETWR field.

rmz01
Explorer
0 Kudos
1,150

I have a smartform of PO in which I have NETWR field (Net Value, Total amount).

I want to remove zeros after decimal point if there are all zeros. Else display the value as it is.
Like if Net Value = 34566.00 then remove '.00' and display value as 34,566.

And if Net Value = 34566.07 then display as it is '34,566.07'.
Tried 'SHIFT <variable> right deleting trailing '0'."
Also used 'FTR_CORR_SWIFT_DELETE_ENDZERO' but the problem with this FM is that it give Character value.
Any help?

Accepted Solutions (0)

Answers (4)

Answers (4)

rmz01
Explorer
0 Kudos

Thankyou all! Solved it by myself. Added the code in smartform

DATA: GV_NETWR TYPE P DECIMALS 2,

CHAR_NETWR TYPE CHAR15.

DATA: LV1 TYPE C LENGTH 15.
DATA: LV2 TYPE C LENGTH 5.

"""NETWR
CLEAR: LV1, LV2.
GV_NETWR = WA_ITEM-NETWR.
WRITE GV_NETWR TO CHAR_NETWR.
CONDENSE CHAR_NETWR NO-GAPS.

CALL FUNCTION 'FTR_CORR_SWIFT_DELETE_ENDZERO'
CHANGING
C_VALUE = CHAR_NETWR.
SPLIT CHAR_NETWR AT '.' INTO LV1 LV2.
IF LV2 IS INITIAL.
CHAR_NETWR = LV1.
ELSE.
CONCATENATE LV1 LV2 INTO CHAR_NETWR SEPARATED BY '.'.
ENDIF.

BijayKumarBarik
Active Contributor
0 Kudos

You can discuss with ABAPer and do as to view in PO print in case for your scenario but nothing wrong to show as 34566.00 in PO in print as value is clear for all viewer/s.

former_member197616
Active Contributor
0 Kudos

hI,

i think you may write a code for the smart form with a condition So that it will populate as desired into the form for display or for print .

Regards,

former_member197616
Active Contributor
0 Kudos

hI,

i think you may write a code for the smart form with a condition So that it will populate as desired into the form for display or for print .

Regards,