Application Development and Automation 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: 
Read only

Insert Leading Zeroes

Former Member
0 Likes
775

How Do Everyone!

I have a currency amount say 144.66 and I want to insert leading zeroes.

I want to convert it to say 000000144.66

I have used the FM CONVERSION_EXIT_ALPHA_INPUT but because

there is a decimal point in the number it is not quite working.

Any ideas anyone??

Cheers

Andy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
749

Hi,

Please try this.


DATA: P TYPE P DECIMALS 2 VALUE '144.66'.
DATA: N(12) TYPE C.
                                                                        
N = P.
SHIFT N RIGHT.
TRANSLATE N USING ' 0'.
                                                                        
WRITE:/ N.

Regards,

Ferry Lianto

Hi,

Please try this.


DATA: P TYPE P DECIMALS 2 VALUE '144.66'.
DATA: N(12) TYPE C.
                                                                        
N = P.
SHIFT N RIGHT.
TRANSLATE N USING ' 0'.
                                                                        
WRITE:/ N.

Regards,

Ferry Lianto

6 REPLIES 6
Read only

Former Member
0 Likes
749

Hi,

Try using the UNPACK statement..

Thanks,

Naren

Read only

0 Likes
749

You could move it to a type C field and use

overlay <field> with '0000000000'.

Read only

Former Member
0 Likes
749

Hi,

Try this..

data: p_1 type p decimals 2.

data: p_2(16).

p_1 = '144.66'.

p_2 = p_1.

translate p_2 using ' 0'.

write: / p_2.

Thanks,

Naren

Read only

Former Member
0 Likes
750

Hi,

Please try this.


DATA: P TYPE P DECIMALS 2 VALUE '144.66'.
DATA: N(12) TYPE C.
                                                                        
N = P.
SHIFT N RIGHT.
TRANSLATE N USING ' 0'.
                                                                        
WRITE:/ N.

Regards,

Ferry Lianto

Read only

0 Likes
749

try this...

data: v_test(16) type p decimals 2,

v_test1(19).

v_test = '000000144.66'.

write v_test.

v_test1 = v_test.

overlay v_test1 with '000000'.

condense v_test1 no-gaps.

write:/ v_Test1.

award points if it helps.

Read only

Former Member
0 Likes
749

Hi Use

Function Module:

CONVERSION_EXIT_ALPHA_INPUT