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: 

decimals upto 2 in alv report

Former Member
0 Kudos

Hi to all abapers,

I have to show only upto 2 decimals in the field of an alv report but it is of type p and decimals 4.I dont want to change its type to 2 decimals due to some calculations.So can we show upto 2 decimals in the report?

Thanks in Advance,

Salish

9 REPLIES 9

Former Member
0 Kudos

try this it may work

fieldcat-decimals_out = '2'.

for that field..

regards

shiba dutta

0 Kudos

Hi,

Sorry there is no field like decimals_out but there is a field decimals_o i tried that

as w_field-decimals_o = '2' but its not working.

Thanks for the response.

Regards.

Former Member

Former Member
0 Kudos

Hi Salisha ,

Are u implementing the ALV using Objects or FM.

If it is FM then in the catalog as shiba said there is a field called decimals_out , and if it is objects there is one called DECIMALS .

Try using them.

Regards

Arun

0 Kudos

Hi,

Thanks for the reply. I tried with decimals also but still its not coming.

Do it have any other options.

Thanks and Regards,

Salish.

0 Kudos

Could you please poste your code here so that we can have a look at it.

Regards,

Arun

0 Kudos

Hi,

Here is the code

<b>Here act_pckeff is of type p decimals 4 and i want it upto 2 decimals in the output.</b>

PERFORM fldcat USING i_fieldcat 'ACT_PCKEFF' 'DEC' 'Actual Efficiency "Packed"' ''."13

FORM fldcat USING p_ifieldcat TYPE lvc_t_fcat

value(p_name)

value(p_type)

value(p_desc)

value(p_key).

DATA: w_fldcat TYPE LINE OF lvc_t_fcat.

CLEAR w_fldcat.

w_fldcat-fieldname = p_name.

w_fldcat-datatype = p_type.

w_fldcat-reptext = p_desc.

w_fldcat-key = p_key.

IF w_fldcat-fieldname = 'AUFNR'.

w_fldcat-no_zero = 'X'.

ENDIF.

IF p_type = 'CURR' OR p_type = 'QUAN'..

w_fldcat-do_sum = 'X'.

ENDIF.

<b>IF p_name = 'ACT_PCKEFF'.

w_fldcat-decimals = 2.

w_fldcat-do_sum = 'C'.

ENDIF</b>.

APPEND w_fldcat TO p_ifieldcat.

ENDFORM. " fldcat

Regards,

Salish.

0 Kudos

Hi,

Just try this.

IF p_name = 'ACT_PCKEFF'.

w_fldcat-decimals_o = 2.

w_fldcat-DECMLFIELD = 'ACT_PCKEFF'.

ENDIF.

0 Kudos

Hi,

I tried the above code, but a runtime error is coming as <b>WRITE_ROUND_TOO_SMALL</b>

i dont know y this error is coming Can anyboby tell me what is the error?

Regards,

Salish