2006 Apr 15 2:30 PM
Hi Guys,
I have a problem with the subtotalling in ALV and i hope some of you might be able to help out. I need my ALV Grid to display the report like the following,
|A....|B....|C....|D...| <----Header/Title
-
|one.|50...|10..|.....| <----Line items
...... | ....... | 10.. | ..... |
...... | ....... | 20.. | ..... |
-
|sub.|50...|40..|10..| <----Subtotaled line
<b>.
.</b>
<b>.</b><i> Repeat for each control level</i>
<b>.
.</b>
Explanation:
1) Column A, B, C and D are the titles.
2) On the line items under column A is field 'ONE' which has been merged.
3) Column 'B' stores the amount 50 which also has been merged.
4) Column 'C' stores values that needs to be subtotaled.
5) Column 'D' is empty and only displays data when the subtotalled line appears.
<b>6) On the subtotaled line i want the word 'Subtotal' to display under column 'A'.
7) Column 'B' on the subtotal line should have amount 50 displayed.
😎 Subtotal line in Column 'C' should have all its value added up.
9) Subtotal line in Column 'D' would display the amount of subtotal line in column 'B' minus subtotal line in Column 'C'. Formula is B - C = D.</b>
<i>*Ignore the dots in the roughly drawn report above, they represent spaces*</i>
All of this needs to be done in ALV Grid and im using the FM 'REUSE_ALV_GRID_DISPLAY'.
HELP, THIS IS URGENT!!! I promise to reward useful answers.
2006 Apr 15 2:48 PM
Matthew,
Please find a sample program which does exactly the same.
http://www.geocities.com/mpioud/Z_DEMO_ALV_SORT.html
Basically you need to set the SORT criteria in IT_SORT table.
Of course you will have activate the SUBOTAL_TEXT event and write the TEXT in the event.
Regards,
Ravi
Please mark the helpful answers
Message was edited by: Ravikumar Allampallam
Hi Guys,
I have a problem with the subtotalling in ALV and i hope some of you might be able to help out. I need my ALV Grid to display the report like the following,
|A....|B....|C....|D...| <----Header/Title
-
|one.|50...|10..|.....| <----Line items
...... | ....... | 10.. | ..... |
...... | ....... | 20.. | ..... |
-
|sub.|50...|40..|10..| <----Subtotaled line
<b>.
.</b>
<b>.</b><i> Repeat for each control level</i>
<b>.
.</b>
Explanation:
1) Column A, B, C and D are the titles.
2) On the line items under column A is field 'ONE' which has been merged.
3) Column 'B' stores the amount 50 which also has been merged.
4) Column 'C' stores values that needs to be subtotaled.
5) Column 'D' is empty and only displays data when the subtotalled line appears.
<b>6) On the subtotaled line i want the word 'Subtotal' to display under column 'A'.
7) Column 'B' on the subtotal line should have amount 50 displayed.
😎 Subtotal line in Column 'C' should have all its value added up.
9) Subtotal line in Column 'D' would display the amount of subtotal line in column 'B' minus subtotal line in Column 'C'. Formula is B - C = D.</b>
<i>*Ignore the dots in the roughly drawn report above, they represent spaces*</i>
All of this needs to be done in ALV Grid and im using the FM 'REUSE_ALV_GRID_DISPLAY'.
HELP, THIS IS URGENT!!! I promise to reward useful answers.
2006 Apr 15 2:48 PM
Matthew,
Please find a sample program which does exactly the same.
http://www.geocities.com/mpioud/Z_DEMO_ALV_SORT.html
Basically you need to set the SORT criteria in IT_SORT table.
Of course you will have activate the SUBOTAL_TEXT event and write the TEXT in the event.
Regards,
Ravi
Please mark the helpful answers
Message was edited by: Ravikumar Allampallam
2006 Apr 15 5:04 PM
Hi Ravi,
I know i have to sort but the problem with sort is that it merges everything and i can't get the result i want in Column B whereby each line item is 50 and the subtotal result that i want to display is also 50 and not the total of all the line items.
In Column D, i just want the results of (Column B - Column C) and the line items of that Column to remain blank
2006 Apr 15 6:51 PM
Hi,
If you want to switch of merging in the layout there will be a field called CELL_MERGE, clear that field and pass the layout to REUSE function, that will STOP merging of the data.
If you sub total that its going to sum up the contents and all you can change is the TEXT for that SUBTOTAL, I don't think you can change the contents of the SUBTOTAL line.
What you want to achieve for COLUMN is not possible.
The only option I can think of is, calculate these values manually and insert that as a row in the table at the approriate place. BUT YOU NEED TO MAKE SURE THAT YOU REMOVE THE SORT / TOTAL OPTIONS FROM THE TOOLBAR, OTHER WISE IF THE USER USE THEM, THE RESULTS WILL BE WRONG AS YOU ALREADY HAVE AN EXTRA TOTAL LINE IN THERE.
<b> You probably can color that line differently so that it stands out.</b>
Regards,
Ravi
Note : Please mark the helpful answers
Message was edited by: Ravikumar Allampallam
2006 Apr 16 5:08 AM
Hi Ravi,
That was what i did initially... Inserted another line through manual calculation and totalling and later coloring that line to make it stand out.
Looks like what i wanted can't be done after all, oh well... life goes on. Thanks again Ravi, points has been rewarded for your effort.
2006 Apr 17 5:02 AM
Hi Matt,
1. Subtotal line in Column 'D' would display the amount of subtotal line in column 'B' minus subtotal line in Column 'C'. Formula is B - C = D.
Such kind of formulas are not directly
permitted in alv.
2. For such requirements,
we need to have ONE EXTRA COLUMN,
in which we have to manually populate data,
using formula for each row,
and then alv will do subtotals on it.
regards,
amit m.