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

No Decimals

Former Member
0 Likes
1,625

hello masters,

is there any option to remove decimals from alv report output. (in my report i am using collect ,but there are some fields that no need decimals thats what i want to remove it.)

Thanks & Regards

Atul

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,536

DECIMALS_OUT is relevant if no currency field is assigned to the field and CURRENCY is not set, else it should work.

Regards,

Raymond

12 REPLIES 12
Read only

Former Member
0 Likes
1,536

Hi,

While building your fieldcat, put option of decimals_out = 0.

hope it helps,

regards,

Read only

0 Likes
1,536

dear Thien,

i tried this LS_CAT-DECIMALS_OUT = 0. earlier but it was not working

Read only

0 Likes
1,536

Hello


LS_CAT-DECIMALS_OUT = '0'. " <- with single quotes

Read only

0 Likes
1,536

i'm using dinamic internal table with currency field. if any possibility then pls revert me.

thnx

Atul

Read only

0 Likes
1,536

Dear Dzed,

i tried with this also LS_CAT-DECIMALS_OUT = '0'. " <- with single quotes

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,537

DECIMALS_OUT is relevant if no currency field is assigned to the field and CURRENCY is not set, else it should work.

Regards,

Raymond

Read only

0 Likes
1,536

dear Raymond,

I'm using currency field. so in curr field there is no option to remove decimals.

Read only

0 Likes
1,536

Internally the currency field give the externa format, so you could only remove decimal if you change the datatype for 'DEC' or similar type (but the ALV wont now give you a subtotal per currency code)

Regards,

Raymond

Read only

0 Likes
1,536

Hi Atul,

Normally, we will refer the currency to get the correct decimal places. For eg: INR - 2 decimal, JPY - 0 decimal...

So it is not possible to hide the decimal places by referring the currency.

Also, if we are not referrering the currency, wrong value may come. For instance, in the SAP table the value will be stored as 12.00 but the actual value should be 1200 JPY.

So do as below,

Get the decimal place from the table 'TCURX' for your currency.

Create a P type variable with 2 decimals, let g_x.

Then g_x = value * 10^(2 - n), where n is the decimal place.

then write the value TO A CHAR FIELD as,

write g_x to g_c no decimals.

the assign the same to the alv internal table. Please remove the currency reference.

It shall work. Please try.

Regards,

Selva K.

Read only

Former Member
0 Likes
1,536

Hi,

Define one varibale type as CHAR and pass the currency field to thet variable.

pass theis varibale to ALV report.

Decimals will not appaer in teh output report.

Regards,

Pravin

Read only

Former Member
0 Likes
1,536

Hi,

Declare one more field TYPE I and move that value to the new field or use FM ROUND

Regards,

Selva

Read only

Former Member
0 Likes
1,536

Self answered, by taking datatype fieldcatlog

is DEC.

e.g.: ls_cat-datatype = 'DEC'.