Application Development 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: 

Concatenating: Real Number to whole number

Former Member
0 Kudos

Team,

I have a field in CRM SMOKNA1-UMSA1 which has dollar and cents. I want only the dollars moved to another field aSales. The field aSales can only handle upto 14 digits.

How can I capture/concatenate dollar part of SMOKNA1-UMSA1 and save it in aSales?

Thanks

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
data: tmp type string.
data: whole(14) type c
data: dec(5) type c.

tmp = SMOKNA1-UMSA1.

split tmp at '.' into whole and dec.

Write:/ whole.

Regards,

Rich Heilman

4 REPLIES 4

Former Member
0 Kudos

use split statement.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
data: tmp type string.
data: whole(14) type c
data: dec(5) type c.

tmp = SMOKNA1-UMSA1.

split tmp at '.' into whole and dec.

Write:/ whole.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi.....

Use the function <b>TRUNC</b> it will give the Integer part of argument..

Ex:

if num1 = 10.23 then TRUNC(10.23) will give the output as 10.

you can also use <b>FLOOR</b> - it will give the Largest integer value not larger than the argument.

Ex:

if num1 = 10.23 then FLOOR (10.23) will give the output as 10.

Reward points if useful......

Suresh......

Former Member
0 Kudos

Hi....

FLOOR( -10.35 ) will give u -11 and FLOOR( -10.35 ) will give u -10 .

Just understand the following code and decide weather to use <b>TRUNC or FLOOR</b> based on your requirement.

DATA: NUM1 TYPE P DECIMALS 2 VALUE '10.35',

NUM2 TYPE I,

NUM3 TYPE I.

NUM2 = TRUNC( NUM1 ).

NUM3 = FLOOR( NUM1 ).

WRITE:/ 'Number is' , NUM1.

WRITE:/ 'TRUNC = ', NUM2.

WRITE:/ 'FLLOR = ', NUM3.

NUM1 = '-10.35'.

NUM2 = TRUNC( NUM1 ).

NUM3 = FLOOR( NUM1 ).

WRITE:/ 'Number is' , NUM1.

WRITE:/ 'TRUNC = ', NUM2.

WRITE:/ 'FLLOR = ', NUM3.

Reward points if useful.....

Suresh.......