2008 Jun 16 12:40 PM
Hi all,
I want to add leading zeros for a number which is of type character.
For example
Data : w_lan type char12.
w_lan = 4030.00
i want this to be w_lan = 000004030.00
The function modules CONVERSION_EXIT_ALPHA_OUTPUT and CONVERSION_EXIT_ALPHA_INPUT wont work in this case. Suggest some other way .
Regards,
Radha.
2008 Jun 16 12:46 PM
Hiiii....
calculate the string length and loop it and concatenate 0 and the number untill u get the desired status .....
l = strlen(w_lan).
v = 0.
while l < 10.
concatenate v to l into target.
endwhile.
now the value will be stored in the target.
reagrds .
chandu reddy.
2008 Jun 16 12:42 PM
declare ......
co_zeros type char5 value '00000'.
concatenate co_zeros wf_lan into wf_lan.
Reward points...if its useful...
Regards
Rudra
2008 Jun 16 12:43 PM
hi,
Pass it to numeric variable of same length
Data : w_lan type char12.
w_lan = '4030.00'.
data : v_numc(5) type n.
CONCATENATE v_numc w_lan into w_lan.
write w_lan.
2008 Jun 16 12:43 PM
dear friend,
problem can be solve like this:
take one variable assign the value like this : v_zero = '0000'.
now concatinate this v_zero to our desire variable,
and now pass the total to a new variable v_new.
your problem will solve.
rewards are expecting
vivek
2008 Jun 16 12:44 PM
hiii
without using CONVERSION_EXIT_ALPHA_INPUT FM you will not achieve this.that CONVERSION_EXIT_ALPHA_INPUT can be use here but for that you need to convert w_lan type char12. to w_lan1(12) type n.then use CONVERSION_EXIT_ALPHA_INPUT FM & then you can convert this value in to w_len.it will defenetly solve your problem.
Data : w_lan type char12.
Data : w_lan1(12) type n.
w_lan = 4030.00.
w_lan1 = w_lan.
here use CONVERSION_EXIT_ALPHA_INPUT FM.
reward if useful
thx
twinkal
2008 Jun 16 12:45 PM
Hi ,
In the field catalog of that field.
Give
fld_cat-lzero = 'X'.
Reward if useful.
Regards,
Talwinder
2008 Jun 16 12:45 PM
Friends every time it is not '0000' , in some cases 3 and some cases 5
2008 Jun 16 12:56 PM
write the logic as :
Data : w_lan type char12.
data : w_num(12) type n.
w_lan = '4030.00'.
w_num = w_lan. <-- move to numeric field
w_num = w_num / 100.
w_lan = w_num. <-- again move to char field.
write 😕 w_lan.
2008 Jun 16 12:46 PM
Hiiii....
calculate the string length and loop it and concatenate 0 and the number untill u get the desired status .....
l = strlen(w_lan).
v = 0.
while l < 10.
concatenate v to l into target.
endwhile.
now the value will be stored in the target.
reagrds .
chandu reddy.