11-26-2007 12:34 PM
Hi,
can some body tell me how to append leading zeroes to a character field
11-26-2007 12:54 PM
Hi Perez C,
thanks for reply but can u tell me if i can use replace stmt to replace the spaces with zeroes, since here i need to declare a constant zero of abt 30 zeroes..
11-26-2007 12:35 PM
Hi,
Use FM CONVERSION_EXIT_ALPHA_OUTPUT on the field.
Reward Points if this helps,
Regards,
Satish
11-26-2007 12:38 PM
hi satish thanks for the reply ,
but this f m does not append zeroes if the first character is a alphabet.
11-26-2007 12:45 PM
hi Rajitha,
try this:
data:
chaR(10) type c value '0000000000',
cha(10) type c value 'a123456',
len type i,
len1 type i.
len = strlen( cha ).
len1 = 10 - len. "10 is max length
move cha to CHAR+len1(len).
write:
'CHAR', num.
Hope it helps.
Lokesh
Message was edited by:
Lokesh Aggarwal
11-26-2007 12:46 PM
Hi Rajitha,
try this code..
DATA : matnr LIKE mara-matnr . "character type with 18 length
DATA : dummy LIKE mara-matnr VALUE '000000000000000000'. "18 zeros.
WRITE '1234' TO matnr RIGHT-JUSTIFIED.
OVERLAY matnr WITH dummy.
WRITE 😕 matnr.
Message was edited by:
Perez C
11-26-2007 12:54 PM
Hi Perez C,
thanks for reply but can u tell me if i can use replace stmt to replace the spaces with zeroes, since here i need to declare a constant zero of abt 30 zeroes..
11-26-2007 12:57 PM
11-26-2007 1:10 PM
DATA:
w_char TYPE matnr.
WRITE 'ABC' TO w_char RIGHT-JUSTIFIED.
TRANSLATE w_char USING ' 0'.
WRITE:w_char.
11-26-2007 12:57 PM
hi try this code.
data: STRL TYPE I VALUE 0.
STRL = STRLEN( input ).
data: in(10) type c.
in = input.
strl = 10 - strl.
Do strl TIMES.
CALL FUNCTION 'STRING_CONCATENATE'
EXPORTING
STRING1 = '0'
STRING2 = in
IMPORTING
STRING = in.
ENDDO.
output = in.
regards,
sohi.
11-26-2007 1:43 PM