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

ABAP

Former Member
0 Likes
683

Hi,

I have this requirement.Suppose I have a number say 375 I need to have concatenate 8 zeroes in front so that the total number of digits is equal to 11.If the number is say 75,then I need to have 9 zeroes so that the total digits is still 11.The zeroes have to be at the front of 75.Can anyone tell how to do this using ABAP statements

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
647

Hi,

Use like this...

DATA : lv_fieldval type numc11.

lv_filedval = <Your input field value>.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = lv_fieldval

importing

output = lv_fieldval.

Hope it will helps

4 REPLIES 4
Read only

Former Member
0 Likes
647

use FM.

CONVERSION_EXIT_ALPHA_INPUT

DATA : test_field(11).

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = '375'

importing

output = test_field.

write:/ test_field.

o/p : 00000000375

Read only

Former Member
0 Likes
648

Hi,

Use like this...

DATA : lv_fieldval type numc11.

lv_filedval = <Your input field value>.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = lv_fieldval

importing

output = lv_fieldval.

Hope it will helps

Read only

Former Member
0 Likes
647

Hai,

we have a function module for that, the name is 'CONVERSION_EXIT_ALPHA_INPUT'

to use this declare a variable of required length and asign the value required and pass this to the given FM.

Eg:

DATA v(10) type c vlalue '123'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING input = v

IMPORTING output = v.

here u get the value 0000000123 into variable V.

i think this meets ur requirement.

Regards

Srinivas

Read only

0 Likes
647

hello,

Pls find below the differences betweeen the two most frquently used coversion exit.

REPORT ZTEST1 .

*removing the leading zeros in the character string.

data : d_char1(5) type c value '00013'.

data : d_char2(2) type c.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

INPUT = d_char1

IMPORTING

OUTPUT = d_char2.

write : d_char2.

.

*adding the leading zeros in the character string.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = d_char2

IMPORTING

OUTPUT = d_char1.

write 😕 d_char1.

The output wud lok like as

13

00013

Thanks,

Senthil..