Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to delete 0

Former Member
0 Kudos

Hi Guru's,

i want to remove 0 . my amount is 14.0000 . how i convert this.

please suggest me.

thanks.

regards.

sam.

Edited by: sam saswade on Oct 13, 2008 7:48 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Move the value to character field and use REPLACE statement

Regards

Madhan

11 REPLIES 11

Former Member
0 Kudos

Hi

Move the value to character field and use REPLACE statement

Regards

Madhan

0 Kudos

but tell me how.

0 Kudos

hiiii

i think for this u can use shift command to remove zero like

SHIFT STRING BY 3 PLACES RIGHT

regards

vikalp

Former Member
0 Kudos

data: X type I value '14.0000'.

X = '14.000'.

write: X.

X value will be 14.

Edited by: Mahalakshmi Padmanaban on Oct 13, 2008 7:57 AM

madan_ullasa
Contributor
0 Kudos

Hi,

Just assign that to an integer...

eg.. w_integer type i,

w_pack type p decimals 4.

w_pack = '10.1234'.

w_integer = w_pack.

Rgrds,

Madan....

Former Member
0 Kudos

Hi Boss,

Use Coversion Exits for this

Conversion_exit_alpha_input

Conversion_exit_alpha_output

Use this function module pass the require parameters .I think

it may help you.

With Regards,

Narasimha Rao.

Former Member
0 Kudos

Move amount to interger field.

Regards,

Aparna

Former Member
0 Kudos
data: amount(10) type c value '14.0000'.

replace all occurrences of '0' in amount with space.
replace '.' with space into amount.
condense amount no-gaps.

write amount.

0 Kudos

Hi Srividya

replace all occurrences of '0' in amount with space.

we should not do this

what if the value is 10004.000.

It will become 14.

Regards

Madhan

Former Member
0 Kudos

Hi,

We can use ' ROUND' Function Module.

data input type p decimals 4 value '14.0000'.

data output type i.

CALL FUNCTION 'ROUND'

EXPORTING

DECIMALS = 0

input = input

SIGN = '+'

IMPORTING

OUTPUT = output

  • EXCEPTIONS

  • INPUT_INVALID = 1

  • OVERFLOW = 2

  • TYPE_INVALID = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

thanx.

Former Member
0 Kudos

Hi Sam,

In case you want to store value without decimals as string.

data : pack(13) type p decimals 4,

xyz(13).

WRITE pack NO-GROUPING DECIMALS 0 to xyz.

or

In case you want to store value without decimals as TYPE P.

data: pack(13) type p decimals 4.

FIELD-SYMBOLS <pack> TYPE p.

ASSIGN pack TO <pack> CASTING DECIMALS 0.

Regards

Hussain