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: 

FM WHICH adds leading zeroes to a non numeric input

Former Member
0 Kudos

hi i need the<b> fm name</b> which will add leading zeroes to anu non numeric input

say

input is <b>ABC</b>

SO MY OUTPUT SHOULD BE

<b>000000000000ABC</b>

URGENT

NEED A FUNCTIOJN MODULE NAME

9 REPLIES 9

Former Member
0 Kudos

Hi,

try this,

data : temp(15) value 'ABC'.

CONCATENATE ' 000000000000' INTO temp.

Write : temp.

thanks.

Former Member
0 Kudos
check....

data:c1  type c,
       c2  type n,
       c3  type c.

c2 = c1.
c3 = c2.
write: c3

Former Member
0 Kudos

Hi,

I think you have to take it into Numeric Field -> Convert it using CONVERSION_EXIT_ALPHA_OUTPUT/INPUT -> Convert to Char.

Reward if useful!

Former Member
0 Kudos

Hi,

use the FM CONVERSION_EXIT_ALPHA_INPUT to get leading zeroes for the variable..

<b>Reward points</b>

Regards

Former Member
0 Kudos

hi,

i need a FUNCTION MODULE ONLYYYYYYYY

0 Kudos

Hi,

Try using FM CONVERSION_EXIT_ALPHA_INPUT

call function CONVERSION_EXIT_ALPHA_INPUT

exporting

<your variable>

importing

<your variable>.

Former Member
0 Kudos

i think no fn module is there for non numeric values to add zero do like this..


data : text(20) value 'ABC',
       len type i.

compute len = strlen( text ).
len = 20 - len.
do len times.
concatenate '0' text into text.
enddo.
write : / text.

regards

shiba dutta

kesavadas_thekkillath
Active Contributor
0 Kudos

data: str type n.

data: val type n.

str = 'ABC'.

val = strlen( str )

while val < 10.

concatenate '0' 'str' into str.

val = val + 1.

endwhile.

write: str.

i guess this may help u

rainer_hbenthal
Active Contributor
0 Kudos

shift txt right deleting trailing space.

overlay txt with '000000000000000000'.