09-30-2008 5:28 PM
How to fill a char variable with 0's to the right?
For example:
v = 'abc'.
And if the length of data element is 8 i would like :
v = 'abc00000'
Thanks
09-30-2008 6:13 PM
DATA: lenght TYPE i.
DATA: diff TYPE i.
lenght = strlen( v ).
diff = 8 - lenght.
DO diff TIMES.
CONCATENATE v '0' INTO v.
ENDDO.
Regards,
Valter Oliveira.
09-30-2008 5:34 PM
Hi,
Try to use the SHIFT LEFT and add the zeroes.
Check the ABAPDOCU on the same.
Regards
Lekha
09-30-2008 6:11 PM
Try this code:
data: V_CHAR(8) type C,
IN_VAR type I.
constants:C_LEN type N value '8',
C_ZERO type N value '0'.
**
V_CHAR = 'abc'.
IN_VAR = strlen( V_CHAR ).
while IN_VAR <> C_LEN.
V_CHAR+IN_VAR(1) = C_ZERO.
IN_VAR = IN_VAR + 1.
endwhile.
Award points if this helps.
09-30-2008 5:35 PM
use the following statement
concatenate v '00000000' into v.
Cheers
KD
09-30-2008 5:39 PM
09-30-2008 5:47 PM
For example if the length of data element is 8 then concatenate V with 8 zeros.
if the lengh is not constant then build the zero string and concatenate with V .
Cheers,
KD
09-30-2008 5:47 PM
09-30-2008 6:00 PM
09-30-2008 6:13 PM
DATA: lenght TYPE i.
DATA: diff TYPE i.
lenght = strlen( v ).
diff = 8 - lenght.
DO diff TIMES.
CONCATENATE v '0' INTO v.
ENDDO.
Regards,
Valter Oliveira.