‎2007 Sep 21 7:51 AM
Hi All,
My issue is i have to convert one float type value into %. Means i m dividing two values of int4 type and the result i sstoring in one float data type variable.
I want to display the result value is with %.
Ex:DATA: n1 TYPE i,
n2 TYPE i,
r1 TYPE f.
n1 = 8.
n2 = 9.
r1 = ( n1 / n2 ) * 100.
write:/ r1.
the result is 8.88 .
But my requirement is to display this 8.88 as 8.88%..
plz help me in this matteer, this is support issue i have to resolve today only..
Thanx in advance,
jagadish.T
‎2007 Sep 21 7:54 AM
Hi
use
concatinate r1 and '%' into r2.
write : r2.
reward if helpful
vivekanand
‎2007 Sep 21 8:06 AM
DATA: n1 TYPE i,
n2 TYPE i,
r1 TYPE f.
data:zch(10) type c.
n1 = 8.
n2 = 9.
r1 = ( n1 / n2 ) * 100.
move r1 to zch.
concatenate zch '%' into zch.
write:/ zch.
plz reward points if dis helps
‎2007 Sep 21 8:10 AM
Hi,
For that you have first move 8.88(output) to a character field (which newly declare in program) and then concatenate that field with '%' sign.
Remember concatenate only work for character field.
*Reward if helpful
Regards
Gagan
‎2007 Sep 21 8:18 AM
hi,
try this code:
DATA: n1 TYPE i,
zvar type string,
zc type string,
zlen type i,
n2 TYPE i,
r1 TYPE f.
n1 = 8.
n2 = 9.
r1 = ( n1 / n2 ) * 100.
move r1 to zvar.
zlen = strlen( zvar ).
zc = zvar+0(3).
concatenate zc '%' into zc.
write zc.
output: 8.8%.
do reward points if it helps.
rgds.