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 add leading zeros.

Former Member
0 Kudos

hi,

How to add leading zeros to a particular value.

There is any syntax, Plz send me.

Points will be awarded.

Regards,

Jayasimha

8 REPLIES 8

Former Member

you can use FM

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = value

IMPORTING

OUTPUT = value.

This will add leading zeros

FUNCTION MODULES

http://www.erpgenie.com/abap/functions.htm

http://www.sapdevelopment.co.uk/fmodules/fmssap.htm

http://www.erpgenie.com/abap/index.htm

http://www.geocities.com/victorav15/sapr3/abapfun.html

Rewards if useful................

Minal

Message was edited by:

Minal Nampalliwar

former_member387317
Active Contributor
0 Kudos

Use the function.

data: tknum type vttk-tknum value '99156'.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = tknum

importing

output = tknum.

Thanks & Regards

ilesh 24x7

Former Member
0 Kudos

use the FM CONVERSION_EXIT_ALPHA_INPUT

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = var1

importing

output = var1.

Please reward points if helpful.

Former Member
0 Kudos

data: txt(10) type c.

txt = ' 123'.

overlay txt with '0000000000'.

write txt.

Former Member
0 Kudos

Hi Jayasimha,

Use conversion_exit_alpha_input which adds Leading zero's to your particular value.

Former Member
0 Kudos

FM is CONVERSION_EXIT_ALPHA_INPUT

Regards

Former Member
0 Kudos

hi jayasimha,

following FM will help you :

CONVERSION_EXIT_ALPHA_INPUT converts any number into a string fill with zeroes, with the number at the extreme right

Example:

input = 123

output = 0000000000000...000000000000123

CONVERSION_EXIT_ALPHA_OUTPUT converts any number with zeroes right into a simple integer

Example:

input = 00000000000123

output = 123

plz reward if useful..

Former Member
0 Kudos

hi,

u can do it many ways.

1. use fm CONVERSION_EXIT_ALPHA_INPUT and pass the variable to it n reference variable.

2. declare dat variable as Numeric then by default it will add zeros for u.

ex: data: pmatnr(8) type n.

if u give value as 8 the o/p would be like this 00000008.

if helpful reward some points.

with regards,

Suresh Aluri.