09-18-2008 6:05 AM
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
09-18-2008 6:08 AM
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
09-18-2008 6:06 AM
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
09-18-2008 6:08 AM
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
09-18-2008 6:14 AM
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
09-18-2008 7:51 AM
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..