2015 Oct 01 5:12 AM
Hi,Experts.
Good morning.
i want to display an empty row in my alv grid display output to calculate the subtotal , grand total.
How can i display the format according to that.
Any one can please tell, i attached sample output,please verify it.
Thanks& Regards,
Sagar.K.
2015 Oct 01 5:30 AM
hi sagar,
before calling Fm- 'reuse_alv_grid_display'.
add one extra row to your final itab. final means which itab has data to print in outputlist in alv grid,
eg:
before coming to this step add your total debit and credit and keep in seperate variables.
wa_final-debit = 'v_debit'. ---->'debit amount variable'.
wa_final-credit = v_credit'.---->'credit amount variable'.
append wa_final to it_final.
and hear v_gt = v_debit + v_credit.
clear wa_final.
wa_final-fieldname = 'grand total'. "this is just a text to print as grand total
wa_final-debit = 'v_gt'. -->grandtotal.
append wa_fianl to it_final.
now assign this it_final to function module.
2015 Oct 01 5:21 AM
In your field catalog u can use do_sum automatically the sum will be calculated.
In which column u need sum u just use the below code..
don't use for description column , only use for amount column.
wa_fieldcat-fieldname = 'LOCCURAM'.
wa_fieldcat-seltext_m = 'Price'.
*Calculate Total for Price
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
2015 Oct 01 5:25 AM
hi
Actually my requirement is exactly as i kept in sample output(like i have to write TOTAL=----------------
CLOSING BALANCING = ------------ )
2015 Oct 01 5:45 AM
Hi ,
Sort your internal table on party code
Loop your internal table and and add a row with calculation of Debit/credit and add row at end of party code
<work_area>-<Party code> = ''.
<work_area>-<old party code > = ''.
<work_area>-<Party name> = 'Total:'.
<work_area>-<Debit> = Calculation of Debit.
<work_area>-<Creadit>= Calculation of Creadit.
<work_area>-<Party code> = ''.
<work_area>-<old party code > = ''.
<work_area>-<Party name> = 'clsong Balance:'.
<work_area>-<Debit> = Calculation of Debit.
<work_area>-<Creadit>= Calculation of Creadit.
Append thisto Internal Table
OR share your code .
Thanks
Mahipalsinh
2015 Oct 01 5:30 AM
hi sagar,
before calling Fm- 'reuse_alv_grid_display'.
add one extra row to your final itab. final means which itab has data to print in outputlist in alv grid,
eg:
before coming to this step add your total debit and credit and keep in seperate variables.
wa_final-debit = 'v_debit'. ---->'debit amount variable'.
wa_final-credit = v_credit'.---->'credit amount variable'.
append wa_final to it_final.
and hear v_gt = v_debit + v_credit.
clear wa_final.
wa_final-fieldname = 'grand total'. "this is just a text to print as grand total
wa_final-debit = 'v_gt'. -->grandtotal.
append wa_fianl to it_final.
now assign this it_final to function module.
2015 Oct 01 5:44 AM
2015 Oct 01 5:33 AM
hi,
sagar kotyada try this one.
CalculateTotal and Closing balancing in program level and append into final internal table using control break statement.
2015 Oct 01 6:00 AM
Hi,
IMHO there is a flow in the design.
How the output will look if we have multiple party code ?
What will happen if the user sort the ALV ?
Using CL_GUI_ALV_GRID and CL_GUI_ALV_GRID->GET_SUBTOTALS
like here Modify grand total in ALV GRID | SCN
or here OO ALV modifed subtotals changes on layout change | SCN
Is IMHO better.
Regards .
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |