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

DECIMALS

Former Member
0 Likes
768

Hi to all.

after i changed the INT4 to CHAR i lost the decimals for the field KILOMETER...

for example field KILOMETER shows me the figures 65.000 now after changed into CHAR now it showing me 65000...

how to solve..

raju

6 REPLIES 6
Read only

Former Member
0 Likes
708

Hi Raju, can you elaborate more? Are you trying to display the kilometer?

If you are trying to get the character format, do the following,

If F1 is your kilometre field, F2 is character field and unit is stored in F3,

Write F1 to F2 UNIT F3.

This will ensure that your decimal field is converted to character format without losing the associated decimals..

Read only

0 Likes
708

Raju,

try that sample:

parameters km type bseg-menge default '65.015'.
data ints type i.
data decs type bseg-menge.

start-of-selection.

ints = trunc( km ). "calculate integer
decs  = frac( km ). "calculate decimals

write: ints, decs.

regards Andreas

Read only

Former Member
0 Likes
708

Hi Raju,

Please try this, it is working for me.

data : dl_quan(20),

dl_kilomt(2) decimals 3.

CLEAR dl_quan.

MOVE dl_kilomt TO dl_quan.

Thanks & Regards,

Siri.

Read only

Former Member
0 Likes
708

Hi,

Use the FM

C14W_NUMBER_CHAR_CONVERSION for conversion to char field.

Lokesh

Pls. reward appropriate points.

Read only

Former Member
0 Likes
708

Hi,

Firstly int4 is a standard data type which can be viewed in SE11 in under the Data type option. If one goes to the domain level and see the characteristics it is an integer type of 4 bytes and 0(zero) decimal places or no decimal places. So even if one tries to assign a packed of a floating point number to it, it is the non-decimal part is taken and the decimal part is ignored.

So even if the int4 data type value is assigned to a character type it cannot show us the decimal values.

Regards,

Sharath

Read only

Former Member
0 Likes
708

hi raju,

did u change the domain from INT4 to char or

in the program u had assigned the value of int4 to char

if u assign inthe program it should work fine

i had tried this code

REPORT YCHATEST .

data: kilo(20).

parameters: kil type p decimals 4 default '65.0000'.

kilo = kil.

write : kilo.