‎2004 Oct 25 5:47 PM
Hi all!
i want to map an integer value into a char2 field. the char 2 field must have a leading zero. => INT value 1 should become CHAR2 '01'.
how do you do that? thanks in advance.
christoph
‎2004 Oct 25 6:13 PM
Hi Cristoph
First assign integer value to the character variable. Then use the statement <b>"OVERLAY"</b>.
<u><b>e.g.</b></u>
lv_char = lv_int .
OVERLAY lv_char WITH '00' .*--Serdar
‎2004 Oct 25 6:02 PM
Is it okay, if you use NUMC ?
data: lv_intvalue type i,
lv_numcvalue(2) type n.
lv_intvalue = 1.
lv_numcvalue = lv_intvalue.
write: lv_numcvalue.
alternatively you can use FM, <b>CONVERSION_EXIT_ALPHA_INPUT</b>
Regards,
Subramanian V.
‎2004 Oct 25 6:13 PM
Hi Cristoph
First assign integer value to the character variable. Then use the statement <b>"OVERLAY"</b>.
<u><b>e.g.</b></u>
lv_char = lv_int .
OVERLAY lv_char WITH '00' .*--Serdar
‎2004 Oct 26 11:35 AM
Personally I much prefer the use of NUMC type variable and the CONVERSION_EXIT_ALPHA_INPUT FM, it's much cleaner and makes proper use of data types, the second solution (right-justification of field value and overlay) will work - but it's really a workaround rather than a true solution.
Particularly if the variable has to be used elsewhere appropriat use of correct data types is a better way forward.
‎2004 Oct 28 10:39 AM
‎2004 Nov 22 5:16 PM
One may use the UNPACK statement.
Best Regards
Klaus
REPORT KZI_TEST_01.
data:
my_i type i value 2,
my_n type n length 2,
my_c type c length 2.
my_n = my_I.
unpack my_I to my_C.
write: / my_N, my_C.