‎2008 Apr 11 1:37 PM
Hi there,
I hav a really simple question but the ideas I have for implementing it, aren't really good in my opinion, so I ask you. I hope you can help me
I have a character field, that should be converted into another character field with a fixed size (of three characters). No I want to have the folowwing conversion:
Input: '1'
Output: '001'
Input: '15'
Output: '015'
Input: ''777'
Output: ''777'
So I want to fill the character fields with leading zeros... The field is not in the data dictionary so that I think that I can't use the ALPHA-function modules for conversion.
Can you help me? Thanks a lot
Kind regards
Markus
Edited by: Alvaro Tejada Galindo on Apr 11, 2008 1:31 PM
‎2008 Apr 11 2:04 PM
Hi,
try this code
data : v_num(3) type c value '1'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = v_num
IMPORTING
OUTPUT = v_num.
write : v_num.
Regards,
kavitha.
‎2008 Apr 11 1:39 PM
hi,
declare it as N type and pass it ..
data : v_char(2) type c value '11',
v_numc(3) type n.
v_numc = v_char.
write : v_numc.
‎2008 Apr 11 1:40 PM
‎2008 Apr 11 1:40 PM
‎2008 Apr 11 1:41 PM
‎2008 Apr 11 1:44 PM
use numeric type it helps.
pass the character variable to numeric
reagerds
prasanth
‎2008 Apr 11 1:44 PM
‎2008 Apr 11 1:53 PM
Hi,
1.Calculate string length and store in seperate variable(var1).
2.if var1 = 1.
concatenate '00' '1' into var2.
elseif var1 = 2.
concatenate '0' '15' into var2.
else.
var2 = '777'.
<REMOVED BY MODERATOR>
Thanks,
Chandu
Edited by: Alvaro Tejada Galindo on Apr 11, 2008 1:32 PM
‎2008 Apr 11 2:04 PM
Hi,
try this code
data : v_num(3) type c value '1'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = v_num
IMPORTING
OUTPUT = v_num.
write : v_num.
Regards,
kavitha.