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

Function Module for adding Leading Zero's to a specific field

Former Member
0 Likes
5,456

Hi,

Can anyone please provide a Function that will do the following:

1. Take the value of the field

2. Take the field type

3. Output the value of the field with leading zero's.

Anything similar would be very helpful.

Thank You & Best Regards,

John

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
4,327

Sure use the function CONVERSION_EXIT_ALPHA_INPUT, this will add leading zeros to a character based field of any length.



data: lv_c(10) type c value '123'.

call function 'CONVERSION_EXIT_ALPHA_INPUT'
          exporting 
                  input = lv_c
          importing
                 output = lv_c.
write:/ lv_c.

Regards,

Rich Heilman

Read only

0 Likes
4,327

Great, that helped a lot! Thanks

Read only

former_member156446
Active Contributor
0 Likes
4,327

CONVERSION_EXIT_ALPHA_INPUT will serve ur purpose..

data:

f1 type char10.

f1 = 789.

passing f1 to CONVERSION_EXIT_ALPHA_INPUT will give you output as 0000000789.

Read only

sandro202242
Explorer
0 Likes
4,327
data: lv_c(10) type c value '123'.
unpack lv_c TO lv_c.