cancel
Showing results for 
Search instead for 
Did you mean: 

HOW to remove the decimal points for particaular field

Former Member
0 Kudos

hi friends,

Iam printing the quntity in decimal mode like 2.000.

but i want to print this as only 2.

How can i remove the the decimal in smart form..

Iam printing amount as 1234.00000.

But i have to print two zeros after decimal point..how can i remove zeros .

appricioate for u r answers..

regards,

sampath kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

try FM FTR_CORR_SWIFT_DELETE_ENDZERO

Answers (7)

Answers (7)

Former Member
0 Kudos

You may use the option

field(.0) for printing the quantity

field(.2) for printing the amount..

Go through SAP help given below..

<b>Number of Decimal Places

A program symbol of one of the data types DEC, QUAN, and FLTP can contain decimal place data. Use the option below to override the Dictionary definition for the number of decimal places for the formatting of this symbol value.

Syntax

&symbol(.N)&

The EKPO-MENGE field contains the value 1234.56. The Dictionary definition specifies 3 decimal places and an output length of 17.

&EKPO-MENGE& -> 1,234.560

&EKPO-MENGE(.1) -> 1,234.6

&EKPO-MENGE&(.4) -> 1,234.5600

&EKPO-MENGE&(.0) -> 1,235</b>

Former Member
0 Kudos

hi samapathkumar,

u just create one local variable,

ex: data: l_value type p.

then move your field to this local variable (l_value), then this local variable we can show in the output.

regards,

seshu.

Former Member
0 Kudos

HI,

Check this...

data: first(10) type c value '1234.0000',

sec type p decimals 2.

sec = first.

write sec.

Regards

SAB

former_member196280
Active Contributor
0 Kudos

Ex: Try this

Data : amt type i.

amount = 1234.00000.

amt = amount * 100000. " here 100000 is decimal places

  • So now amt equals to 123400000

amt = amt / 100000. " So amt = 1234.

I guess it will solve your problem.

Reward points to all useful answers.

Regards,

SaiRam

Former Member
0 Kudos

Hi,

You the following logic to get the value converted to 'N' number of decimal places :-

Field-symbols : <fs_number> TYPE p.

l_number = 1234.00000.

l_number = l_number * ( 10 ** N ).

ASSIGN l_number TO <fs_number> DECIMALS N.

WRITE <fs_number> TO l_final_number.

Award points if usefull.

Best regards,

Harsh

Simha_
Employee
Employee
0 Kudos

Hi,

Declare the variable with packed type of decimals 2.

Cheers,

Simha.

Reward all the helpful answers..

Former Member
0 Kudos

move the decimal value to integer.

Former Member
0 Kudos

Hi friends,

i tried this before only but its not working..

if iam using the write wa_quanty to new_qty.(its not working because iam moving the decimal value to integer.. here iam getting the error as write only for C,N,D,T types).

if iam using move wa_quanty TO new_qty. iam getting the valueas as wrong like

wa_quanty value is 1.0000 but iam getting new_qty the value 10000.

this is for smart form..please give the right answers..

regards,

sampath