Dear Sumeet,
We have standard functionality of Print Preview, but to get the %age in the subtotal we have added some code. I am facing problem only with the %age. My code is given below. Please check it out.
DATA: lo_grid TYPE REF TO cl_gui_alv_grid.
* get the global reference
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lo_grid.
* get the subtotal
DATA: it_00 TYPE REF TO data.
CALL METHOD lo_grid->get_subtotals
IMPORTING
ep_collect00 = it_00.
* change the data
FIELD-SYMBOLS: <ft_tab> TYPE ANY TABLE,
<fs_tab> TYPE any,
<ff_prof> TYPE any,
<ff_diff> TYPE any,
<ff_perc> TYPE any.
ASSIGN it_00->* TO <ft_tab>.
LOOP AT <ft_tab> ASSIGNING <fs_tab>.
ASSIGN COMPONENT 'PROFIT_LOSS' OF STRUCTURE <fs_tab> TO <ff_prof>.
ASSIGN COMPONENT 'NETWR' OF STRUCTURE <fs_tab> TO <ff_diff>.
ASSIGN COMPONENT 'PERCENT' OF STRUCTURE <fs_tab> TO <ff_perc>.
<ff_perc> = ( <ff_prof> / <ff_diff> ) * 100.
ENDLOOP.
DATA ls_stable TYPE lvc_s_stbl.
ls_stable-row = 'X'.
ls_stable-col = 'X'.
CALL METHOD lo_grid->refresh_table_display
EXPORTING
i_soft_refresh = 'X'
is_stable = ls_stable.
Can you kindly share your part of code, so that we can have a look at it.
Thanks & Regards
Harish Kumar MK