Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

numeric field

Former Member
0 Likes
510

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
492

thanks

but it gives error as "int1 must be character data type object

3 REPLIES 3
Read only

Former Member
0 Likes
492

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

Read only

Former Member
0 Likes
493

thanks

but it gives error as "int1 must be character data type object

Read only

0 Likes
492

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