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: 

Change decimals based on Value for SALV ALV

prasanth_kasturi
Active Contributor
3,324

While Using REUSE function module, if the value of below parameters are set..

The Table output is Shown as below, if the quantity is decimal value it is shown as decimals but if a whole number, the decimal value is missing

If the Values are QFIELDNAME and QTABNAME values are cleared, by default 3 decimals are displayed as shown below

In the internal table definition, the field is defined as follows

If we need to achieve the same using SALV, how to proceed?

2 REPLIES 2

SimoneMilesi
Active Contributor
0 Kudos
683

Hi Prasanth,

i'm not sure it's feasible with CL_SALV, but you can give a look at these solutions about something similar even if not strictly related to yours

http://www.saplearners.com/add-cell-color-alv-using-cl_salv_table/

http://zevolving.com/2012/01/salv-table-17-apply-styles-to-cell/


Maybe you can use them like starting point to dig into CL_SALV labyrinth and find the solution.

DoanManhQuynh
Active Contributor
0 Kudos
683

You need to get ALV column and settings its reference field, something like:

data: lr_columns type ref to cl_salv_columns_table, lr_column type ref to cl_salv_column_table.
cl_salv_table=>factory(
 importing
 r_salv_table = gr_table
 changing
 t_table = gt_outtab ).
lr_columns = gr_table->get_columns( ).
lr_column ?= lr_columns->get_column( 'your column' ).
lr_column->set_decimals_column( 'your decimal column' ).

There are some more method you can use with other type like currency or get DDIC reference too, just chose which one fit with your req.