‎2007 Jul 24 12:32 PM
I have one variable of type character size 35, whose value can be 7 or 8 digit number, if it is 7 digit i want to append 3 zeros to it and if it is 8 digit i want to append 2 zeros eg.
if value is 7123456 i want 0007123456 and if it is 71234567 i want 0071234567
if m using FM 'CONVERSION_EXIT_ALPHA_INPUT' it is appending 28 zeros.
Thanks
‎2007 Jul 24 12:36 PM
Hi
Follow this procedure.
<b>Data: Var(35) value '1234567',
temp(10) type N.
temp = var. "Now the value is stored with Leading Zeroes
Var = Temp.
write: var.</b>
Reward if Helpful.
‎2007 Jul 24 12:36 PM
Hi
Follow this procedure.
<b>Data: Var(35) value '1234567',
temp(10) type N.
temp = var. "Now the value is stored with Leading Zeroes
Var = Temp.
write: var.</b>
Reward if Helpful.
‎2007 Jul 24 12:37 PM
hi,
do this way ...
describle field lv_var length len.
if len = '7'.
concatenate '000' lv_var into lv_var.
elseif len = '8'.
concatenate '00' lv_var into lv_var.
endif.
‎2007 Jul 24 12:37 PM
Hi,
DO like this
DATA: num10(10) type n.
num10 = your number.
Regards,
Sesh
‎2007 Jul 24 12:40 PM
Hello,
Check this code. It's working :
DATA: gv_var TYPE char35.
DATA: gv_len TYPE i.
DATA: gv_corrector TYPE i.
gv_var = '7123456'.
gv_len = STRLEN( gv_var ).
WRITE:/ gv_var.
gv_corrector = 10 - gv_len.
DO gv_corrector TIMES.
CONCATENATE '0' gv_var INTO gv_var.
ENDDO.
WRITE:/ '**************************'.
WRITE:/ gv_var.
Regards,
Deepu.K
‎2007 Jul 24 12:46 PM
Hi,
Try decalring the output variable with type character and length 10.
data : p_input(35) type c.
data : p_output(10) type c.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = p_input
IMPORTING
OUTPUT = p_output.
Reward points if it was useful.
Regards,
Hema.
‎2007 Jul 24 12:52 PM
data: test(35).
test = '1234567'.
val = strlen ( test ).
while val < 10.
concatenate '0' 'test' into test.
val = val + 1.
endwhile.
reward if usefull
‎2007 Jul 24 1:21 PM
hi lucky,
declare a variable like
data: temp(8).
pack ur_variable.to temp.
unpack temp .
ur_variable = temp.
check this...
Regards,
Naveen Natarajan