Former Member

### HOW to remove the decimal points for particaular field

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 .

regards,

sampath kumar

10|10000 characters needed characters exceeded

Former Member
May 22, 2007 at 01:29 PM
11

try FM FTR_CORR_SWIFT_DELETE_ENDZERO

10|10000 characters needed characters exceeded
• Former Member
May 23, 2007 at 05:15 AM

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.

10|10000 characters needed characters exceeded
• May 22, 2007 at 01:25 PM

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

10|10000 characters needed characters exceeded
• Former Member
May 21, 2007 at 12:01 PM

move the decimal value to integer.

10|10000 characters needed characters exceeded
• Former Member

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.

regards,

sampath

• Former Member
May 22, 2007 at 10:00 AM

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

10|10000 characters needed characters exceeded
• May 21, 2007 at 12:02 PM

Hi,

Declare the variable with packed type of decimals 2.

Cheers,

Simha.

10|10000 characters needed characters exceeded
• Former Member
May 22, 2007 at 01:42 PM

HI,

Check this...

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

sec type p decimals 2.

sec = first.

write sec.

Regards

SAB

10|10000 characters needed characters exceeded
• Former Member
May 23, 2007 at 09:07 AM

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>