cancel
Showing results for 
Search instead for 
Did you mean: 

How to Cahnge decimal format

Former Member
0 Kudos

Hi,

I facing a formatting problem in total fields.

if the value is100000.25 it is printing this as <b>10.000,25</b>

I want to print this as 10,000.25.

Plz Note: any default setting of decimal in SU01 does not help this.

Points guaranteed.

Regd,.

Anid

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Anid,

Call a routine in the smartform passing the field name and value.

EG:

PERFORM GET_UNIT_PRICE IN PROGRAM ZSROINVOICE

USING &KOMVD-KWERT(T)&

USING &FKLMG(T)&

CHANGING &PRICE_P_U&

ENDPERFORM

FORM get_unit_price TABLES i_intpar STRUCTURE itcsy

i_outpar STRUCTURE itcsy.

DATA : ws_price TYPE p DECIMALS 2,

ws_fkimg TYPE p DECIMALS 2,

ws_netwr TYPE p DECIMALS 2,

ws_c_netwr(20) ,

ws_c_fkimg(20) ,

ws_c_price(15) .

REFRESH i_outpar.

CLEAR i_outpar.

READ TABLE i_intpar WITH KEY name = 'KOMVD-KWERT'.

CHECK sy-subrc EQ 0.

ws_c_netwr = i_intpar-value.

READ TABLE i_intpar WITH KEY name = 'FKLMG'.

CHECK sy-subrc EQ 0.

ws_c_fkimg = i_intpar-value.

TRANSLATE ws_c_netwr USING '. '.

TRANSLATE ws_c_netwr USING ',.'.

TRANSLATE ws_c_fkimg USING '. '.

TRANSLATE ws_c_fkimg USING ',.'.

CONDENSE ws_c_netwr NO-GAPS.

CONDENSE ws_c_fkimg NO-GAPS.

MOVE: ws_c_fkimg TO ws_fkimg,

ws_c_netwr TO ws_netwr.

IF NOT ws_fkimg IS INITIAL.

ws_price = ( ws_netwr / ws_fkimg ).

ENDIF.

WRITE ws_price TO ws_c_price.

i_outpar-name = 'PRICE_P_U'.

i_outpar-value = ws_c_price.

APPEND i_outpar.

CLEAR i_outpar.

ENDFORM.

This routine is used calculate the unit price based on totla amount and no of delivered pieces.

This will surely help u.

former_member196280
Active Contributor
0 Kudos

Try this,

variable type c.

Move your value into variable.

*SPLIT variable at DECIMAL.

REPLACE '.' WITH ',' INTO variable

CONCATENATE var1 '.' var2 into var3.

Reward points if useful.

Regards,

SaiRam

Former Member
0 Kudos

Hi,

ry this.

parameters : val(30) type c.

data : final(30) type c,

cnt type i,

v type c,

n type i.

cnt = strlen( val ).

do cnt times.

move val+n(1) to v.

if v ca '.0123456789'. "Bring in the values

move v to final+n(1).

endif.

n = n + 1.

enddo.

condense final no-gaps.

write:/ final

Regards

Former Member
0 Kudos

hi anid,

just go to T.code <b>su3</b> ,

there u can find <b>Defaults</b> tab,

under the decimal Notation u can change the format,

save.

regards,

seshu.

Former Member
0 Kudos

The decimal format can also be set by the SET COUNTRY command which uses the values stored in table T005X for the country.

Check to see what the settings are for the country of the Customer/Vendor you are processing.

Former Member
0 Kudos

HI,

You need to change this the Type to P so it will print the correct value, if this is not printing the correct value then Multiply the result value with 1000 then you will get the correct value

Regards

Sudheer