on 05-02-2007 11:30 AM
Hi,
I need to convert an integer to a 10 digit character.Could you help me to know how I could do it?
e.g. if the integer is 6000034, the converted value must be 0006000034.
I need to have the leading zereos.
Thanks,
Sandeep.
And nowadays you simply write:
text = |{ CONV string( num ) WIDTH = 10 ALPHA = IN }|.
or
TYPES numc TYPE n LENGTH 10.
text = CONV numc( num ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
data : int type i value '6000034'.
data : temp(10) type i.
unpack int to temp.
now temp will hold value - 0006000034
reward points if helpful.
Regards,
Hemant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi sandeep.
try this ..u will definately get output as u want.
DATA: CHAR TYPE i.
DATA: OUTPUT(10).
data: op(10) type c.
CHAR = 6000034.
op = char.
WRITE: op TO OUTPUT.
TRANSLATE OUTPUT USING '. '.
CONDENSE OUTPUT NO-GAPS.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = OUTPUT
IMPORTING
OUTPUT = OUTPUT.
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
good
use CONVERSION_EXIT_ALPHA_INPUT converts any number into a string fill with zeroes, with the number at the extreme right
Example:
input = 123
output = 0000000000000...000000000000123
thanks
mrutyun^
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
REPORT ychatest.
DATA : v_num TYPE i VALUE 6000034,
v_char(10).
v_char = v_num.
WRITE v_char TO v_char RIGHT-JUSTIFIED.
TRANSLATE v_char USING ' 0'.
WRITE v_char.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sandeep,
try this.
data: v_int type i value '6000034.
data: v_char(10) type c.
v_char = v_int.
unpack v_char to v_char.
write v_char.
Reward if it helps.
Regards,
Hemant.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this CONVERSION_EXIT_ALPHA_OUTPUT
Regards,
Jayant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sandeep,
the following code snippet solves ur problem.
data : abc type i value 6000034,
abc1(10) type c.
abc1 = abc.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = abc1
IMPORTING
OUTPUT = abc1
.
abc1 has ur required output.
please reward if helpful.
regards,
Ravi G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Use this sample.
DATA: CHAR TYPE I.
DATA: OUTPUT(10).
CHAR = 6000034.
WRITE: CHAR TO OUTPUT.
TRANSLATE OUTPUT USING '. '.
CONDENSE OUTPUT NO-GAPS.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = OUTPUT
IMPORTING
OUTPUT = OUTPUT.
WRITE: OUTPUT.
REgards,
VAsanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
use unpack int1 to int2.
Regards
Nilesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
var = 6000034.
data: v_var(10) type n.
unpack var to v_var.
move v_var to v_char.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
data v_var(10) type N.
Move 6000034 to v_var.
you can also use the fun modules
CONVERSION_EXIT_ALPHA_INPUT
CONVERSION_EXIT_ALPHA_OUTPUT
Reward points if useful
Regards
Anji
Message was edited by:
Anji Reddy Vangala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.