‎2008 Apr 23 10:49 AM
i have a following scenario
Total Field lengh 18 consititues of : 1 place for sign (+ or -)
14 places for integer part
3 places decimal part
There will not be physical Decimal point i.e. '.' in the Value.
e.g. Amount 13,54,350.55 will be converted as +00000001354350550
how to achieve this ??
kindly help
‎2008 Apr 23 11:25 AM
thanks
but it gives error as "int1 must be character data type object
‎2008 Apr 23 11:01 AM
hi you can do it like this :
first remove comman from amount ( if u have )
data: amount1(20) type c. ( length = length of amount)
write : amount to amount1 no-grouping.
now folloe this.
e.g. Amount 13,54,350.55 will be converted as +00000001354350550
data: char(18), int1 type i, int2 type i.
split amount1 at '.' into int1 int2 .
char+1(14) = int1.
char+15(3) = int2.
reward if useful
‎2008 Apr 23 11:25 AM
thanks
but it gives error as "int1 must be character data type object
‎2008 Apr 23 12:00 PM
hi use this code:
REPORT ZTEST23 .
*first remove comman from amount ( if u have )
data: amount1(18) type c, amount type NETWR.
" ( length = length of amount)
amount = '1354350.55'.
write : amount .
write : amount to amount1 no-grouping.
*now folloe this.
*e.g. Amount 13,54,350.55 will be converted as +00000001354350550
data: char(18) type n, int1(14), int2(3) type n.
split amount1 at '.' into int1 int2 .
shift int1 right deleting trailing space.
shift int2 left deleting leading space.
char+1(14) = int1.
char+15(3) = int2.
shift char left by 1 places.
if amount < 0.
concatenate '-' char into char.
else.
concatenate '+' char into char.
endif.
write: char.
reward if useful