2006 Jul 30 5:16 AM
Hi,
Iam displaying an ALV report which includes Total and Subtotals.Iam giving Text for Total and Subtotals.
But in ALV report iam getting Totals text ,but Sub totals text is not diplaying.How do we achieve this?
Iam using the code,still iam not getting subtotal text.
it is a REUSE_ALV_LIST_DISPLAY.
X_SORT TYPE SLIS_SORTINFO_ALV,
*-- Structure for ALV Layout
DATA : IS_LAYOUT TYPE SLIS_LAYOUT_ALV.
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
*-To sort internal table based on Field Name
CLEAR X_SORT.
X_SORT-FIELDNAME = 'MATNR'.
X_SORT-SUBTOT = 'X'.
X_SORT-GROUP = 'X'.
X_SORT-SPOS = 1.
X_SORT-UP = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR IS_LAYOUT.
IS_LAYOUT-ZEBRA = 'X'.
IS_LAYOUT-NO_COLHEAD = 'X'.
IS_LAYOUT-SUBTOTALS_TEXT = 'Sub Totals'(009).
IS_LAYOUT-TOTALS_TEXT = 'Totals'(008).
Hi,
Iam displaying an ALV report which includes Total and Subtotals.Iam giving Text for Total and Subtotals.
But in ALV report iam getting Totals text ,but Sub totals text is not diplaying.How do we achieve this?
Iam using the code,still iam not getting subtotal text.
it is a REUSE_ALV_LIST_DISPLAY.
X_SORT TYPE SLIS_SORTINFO_ALV,
*-- Structure for ALV Layout
DATA : IS_LAYOUT TYPE SLIS_LAYOUT_ALV.
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
*-To sort internal table based on Field Name
CLEAR X_SORT.
X_SORT-FIELDNAME = 'MATNR'.
X_SORT-SUBTOT = 'X'.
X_SORT-GROUP = 'X'.
X_SORT-SPOS = 1.
X_SORT-UP = 'X'.
APPEND X_SORT TO IT_SORT.
CLEAR IS_LAYOUT.
IS_LAYOUT-ZEBRA = 'X'.
IS_LAYOUT-NO_COLHEAD = 'X'.
IS_LAYOUT-SUBTOTALS_TEXT = 'Sub Totals'(009).
IS_LAYOUT-TOTALS_TEXT = 'Totals'(008).
2006 Jul 30 10:46 AM
Hi Seshagiri
Use Sort Catalog.
Refer to the following:
STRUCTURE OF SORT CATALOG
The sort catalog contains the following fields for getting the current sort criteria of the list or setting these criteria dynamically or before the list is displayed for the first time.
FIELD NAME DESCRIPTION
SPOS Sort order if the list is sorted by multiple columns
FIELDNAME Field name in the internal output table
UP 'X' = Sorted in ascending order
DOWN 'X' = Sorted in descending order
SUBTOT 'X' = Subtotal at group level change
GROUP Once a column is sorted, it is subdivided into groups. This means there is one group for each value of the column (in the default setting, the ALV Grid Control merges cells that have the same value in the sort column). If the value in the sort colulmn changes, this is called a group level change.
You can use this field to determine the formatting of this value when the list is printed:
'* ' = Page break at group level change
'UL' = Underline at group level change
(The formatting options are fixed domain values of domain SLIS_CTRLS ).
There are two important points to tell about this topic. First one is that, there will be a short dump if any one of the fields given to be sorted is not in the content of the field catalog. Secondly, when you make ALV Grid to sort data, by default it vertically merges fields having the same content. To avoid from this for all of the columns, you can set no_merging field of the layout structure to X. If you want to disable merging for just some columns, set no_merging field of the field catalog row corresponding to that column.
TOTAL AND SUBTOTAL
This returns the current subtotals of the ALV Grid Control. Having created totals for at least one column, users can calculate at most nine subtotals. The list is sorted by the values of one or several columns (called the subtotals column). If a value is changed in the subtotals column, the subtotal is displayed (this is also referred to as control level change).
EXAMPLE CODE:
<b>FORM SORT_CATALOG USING GT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-DOWN = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.</b>
Award points if found useful.
Regards
Inder
2006 Jul 30 11:02 PM
Hi,
Go through the link,
http://help.sap.com/saphelp_47x200/helpdata/en/ee/c8e056d52611d2b468006094192fe3/frameset.htm
and make sure the text element given is activated.
Regards,
Azaz Ali.
2006 Jul 31 3:13 AM
The 'subtotal_text' (and also for TOTAL texts) will only appear when the FIRST column is wide enough to take it (set fieldcat-outputlen appropriately) and if the FIRST column of the ALV output is not ITSELF being subtotalled on. I suppose this is because the text is always going to appear in column 1.
You can force this either by moving the column you're interested to another spot or by introducing a column 1 which is usually empty but will contain the texts on total lines.
2006 Jul 31 4:46 AM
Hai
Whether do you get subtotal value ? If you get a value but not the text, increase the colwidth of the first column in the field catalog what you pass for the first column. Try it.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |