‎2008 Jan 24 5:30 AM
Hi All,
there is a variable with length 2,
if variable having single charcter value like '1' need to make the variable value '02'
how to check the variable length and add the zero if variable having only one character.
please help me
regards
krishna
‎2008 Jan 24 5:43 AM
Hi Krishna
Use convert_exit_alpah_input FM to add zeros..
else
use lv_len = strln(variable).
lv_len will have the number 1 or 2 in ur case.. based on it you can add zeros.
‎2008 Jan 24 5:38 AM
Hi Krishna,
insted u can declare that variable of type n. If you have 1 means it will display as 01.
or.
since that variable is of type c, by using strlength we can find out the length of the variable.
regards,
DVNS
‎2008 Jan 24 5:43 AM
Hi Krishna
Use convert_exit_alpah_input FM to add zeros..
else
use lv_len = strln(variable).
lv_len will have the number 1 or 2 in ur case.. based on it you can add zeros.
‎2008 Jan 24 5:58 AM
Hi,
try the following code..
data : var type i,
var2(3) type n.
var = 2.
if var < 10.
var2 = var.
endif.
write /: var, var2.
var2 will ouput with leading zeros...
Regards,
Viji
‎2008 Jan 24 6:00 AM
Hi,
use FM convert_exit_alpah_input . don't care about length.FM will take care.
L.Velu
‎2008 Jan 24 6:02 AM
Hi,
Assign the value to a numeric field. It will automatically takes care of zeros.
Ex: x type char02,
y(2) type n.
x = '1'.
y = x.
Write: / y.
‎2008 Jan 24 6:02 AM