‎2014 May 16 1:23 AM
Hello, I have a question. I have one variable called lv_tst. i have declared it like this:
lv_tst(3) TYPE C,
Now, sometimes this variable may have only one digit like 1 through 9 and other times it may have 10. What I am looking to do is when
lv_tst has a single digit then i want to
Concatenate '00' to lv_tst into another variable.
but when lv_tst has 2 digits such as 10 or 11 or anything uptil 99 then:
Concatenate '0' to lv_tst into another variable.
but i don't know what is the syntax to find our how many digits have occupied in lv_tst.
Please help.
Thanks.
‎2014 May 16 3:10 AM
Hello Venkat,
Please use the FM CONVERSION_EXIT_ALPHA_INPUT to add leading zeros.
data : lv_tst(3).
lv_tst = '2'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = lv_tst
IMPORTING
OUTPUT = lv_tst
Write lv_tst.
O/P : 002.
Thanks
‎2014 May 16 1:58 AM
‎2014 May 16 3:10 AM
Hello Venkat,
Please use the FM CONVERSION_EXIT_ALPHA_INPUT to add leading zeros.
data : lv_tst(3).
lv_tst = '2'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = lv_tst
IMPORTING
OUTPUT = lv_tst
Write lv_tst.
O/P : 002.
Thanks
‎2014 May 16 4:30 AM
hi venkat,
There are Function module for your scnerio
data: lv_t TYPE char3.
lv_t = 1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_t
IMPORTING
OUTPUT = lv_t
.
WRITE lv_t.
lv_t = 13.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_t
IMPORTING
OUTPUT = lv_t
.
WRITE lv_t.
Regards,
Sivaganesh