2006 Nov 17 11:12 AM
Hi All,
I am using ALV GRID's Sort catalog.
I want to display the subtotals which are greater than 10,000.
Is there any way in doing this.
Please guide me.
Thanks.
Albert
2006 Nov 17 11:18 AM
Hi albert,
Check this,
Step 1
Define an internal table of type SLIS_T_EVENT, and a work area of type SLIS_ALV_EVENT.
DATA: T_EVENT TYPE SLIS_T_EVENT,
W_EVENT TYPE SLIS_ALV_EVENT.
Step 2
Append AFTER-LINE-OUTPUT event to the internal table T_EVENT.
CLEAR W_EVENT.
W_EVENT-FORM = SLIS_EV_AFTER_LINE_OUTPUT.
W_EVENT-NAME = SLIS_EV_AFTER_LINE_OUTPUT.
APPEND W_EVENT TO T_EVENT.
Step 3
The totals are displayed in the output in the form AFTER_LINE_OUTPUT, which corresponds to the event AFTER_LINE_OUTPUT. The sub routine uses the parameter P_RS_LINEINFO, which contains settings for totals lines. The actual totals output is displayed using the WRITE ad FORMAT statements.
FORM AFTER_LINE_OUTPUT
USING P_RS_LINEINFO TYPE SLIS_LINEINFO.
Declaration Of Local Variables
DATA: L_SUCCESS TYPE WRBTR, "Total For Successful Entries
L_ERROR TYPE WRBTR, "Total For Unsuccessful Entries
L_COUNT TYPE I. "No. Of lines in table T_OUTPUT
Getting The No Of Lines In The Table T_OUTPUT
DESCRIBE TABLE T_OUTPUT LINES L_COUNT.
Displaying the totals after the last record of the Internal
Table T_OUTPUT
IF P_RS_LINEINFO-TABINDEX = L_COUNT.
Loop At The Internal Table T_OUTPUT
LOOP AT T_OUTPUT INTO W_OUTPUT.
IF W_OUTPUT-SFLAG = C_CHECKED.
Calculate Total For Unsuccessful Entries
L_ERROR = L_ERROR + W_OUTPUT-WRBTR.
ELSE.
Calculate Total For Successful Entries
L_SUCCESS = L_SUCCESS + W_OUTPUT-WRBTR.
ENDIF.
Clear The Work Area W_OUTPUT
CLEAR W_OUTPUT.
ENDLOOP.
Set The Format For The Total Line Display
ULINE AT (P_RS_LINEINFO-LINSZ). "Dynamic Line Size
FORMAT INTENSIFIED COLOR COL_TOTAL ON. "Setting the color
"For the total row
"As Yellow
WRITE : / SY-VLINE, "Vertical Line
TEXT-017, "Caption For Total
"Sum of Successful
"Entries
33 L_SUCCESS, "Total Of Successful
"Entries
C_USD. "Currency Type USD
POSITION P_RS_LINEINFO-LINSZ. "Dynamic Line Size
WRITE : SY-VLINE. "Vertical Line
ULINE AT (P_RS_LINEINFO-LINSZ). "Dynamic Line Size
WRITE : / SY-VLINE , "Vertical Line
TEXT-018, "Caption For Total
"Sum of Successful
"Entries
33 L_ERROR, "Total Of Unsuccessful
"Entries
C_USD. "Currency Type USD
POSITION P_RS_LINEINFO-LINSZ. "Dynamic Line Size
WRITE : SY-VLINE. "Vertical Line
FORMAT COLOR OFF. "Color Setting Off
ENDIF.
ENDFORM. "AFTER_LINE_OUTPUT
Step 4
The table T_EVENT is passed to the function 'REUSE_ALV_LIST_DISPLAY' while displaying the ALV Report.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = L_REPID "Program Name
IS_LAYOUT = W_LAYOUT "Layout of the Report
IT_FIELDCAT = T_FIELDCAT "Field Catalog for Report
IT_EVENTS = T_EVENT "For setting the events
TABLES
T_OUTTAB = T_OUTPUT "Report data Internal Table
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
Hi All,
I am using ALV GRID's Sort catalog.
I want to display the subtotals which are greater than 10,000.
Is there any way in doing this.
Please guide me.
Thanks.
Albert
2006 Nov 17 11:18 AM
Hi albert,
Check this,
Step 1
Define an internal table of type SLIS_T_EVENT, and a work area of type SLIS_ALV_EVENT.
DATA: T_EVENT TYPE SLIS_T_EVENT,
W_EVENT TYPE SLIS_ALV_EVENT.
Step 2
Append AFTER-LINE-OUTPUT event to the internal table T_EVENT.
CLEAR W_EVENT.
W_EVENT-FORM = SLIS_EV_AFTER_LINE_OUTPUT.
W_EVENT-NAME = SLIS_EV_AFTER_LINE_OUTPUT.
APPEND W_EVENT TO T_EVENT.
Step 3
The totals are displayed in the output in the form AFTER_LINE_OUTPUT, which corresponds to the event AFTER_LINE_OUTPUT. The sub routine uses the parameter P_RS_LINEINFO, which contains settings for totals lines. The actual totals output is displayed using the WRITE ad FORMAT statements.
FORM AFTER_LINE_OUTPUT
USING P_RS_LINEINFO TYPE SLIS_LINEINFO.
Declaration Of Local Variables
DATA: L_SUCCESS TYPE WRBTR, "Total For Successful Entries
L_ERROR TYPE WRBTR, "Total For Unsuccessful Entries
L_COUNT TYPE I. "No. Of lines in table T_OUTPUT
Getting The No Of Lines In The Table T_OUTPUT
DESCRIBE TABLE T_OUTPUT LINES L_COUNT.
Displaying the totals after the last record of the Internal
Table T_OUTPUT
IF P_RS_LINEINFO-TABINDEX = L_COUNT.
Loop At The Internal Table T_OUTPUT
LOOP AT T_OUTPUT INTO W_OUTPUT.
IF W_OUTPUT-SFLAG = C_CHECKED.
Calculate Total For Unsuccessful Entries
L_ERROR = L_ERROR + W_OUTPUT-WRBTR.
ELSE.
Calculate Total For Successful Entries
L_SUCCESS = L_SUCCESS + W_OUTPUT-WRBTR.
ENDIF.
Clear The Work Area W_OUTPUT
CLEAR W_OUTPUT.
ENDLOOP.
Set The Format For The Total Line Display
ULINE AT (P_RS_LINEINFO-LINSZ). "Dynamic Line Size
FORMAT INTENSIFIED COLOR COL_TOTAL ON. "Setting the color
"For the total row
"As Yellow
WRITE : / SY-VLINE, "Vertical Line
TEXT-017, "Caption For Total
"Sum of Successful
"Entries
33 L_SUCCESS, "Total Of Successful
"Entries
C_USD. "Currency Type USD
POSITION P_RS_LINEINFO-LINSZ. "Dynamic Line Size
WRITE : SY-VLINE. "Vertical Line
ULINE AT (P_RS_LINEINFO-LINSZ). "Dynamic Line Size
WRITE : / SY-VLINE , "Vertical Line
TEXT-018, "Caption For Total
"Sum of Successful
"Entries
33 L_ERROR, "Total Of Unsuccessful
"Entries
C_USD. "Currency Type USD
POSITION P_RS_LINEINFO-LINSZ. "Dynamic Line Size
WRITE : SY-VLINE. "Vertical Line
FORMAT COLOR OFF. "Color Setting Off
ENDIF.
ENDFORM. "AFTER_LINE_OUTPUT
Step 4
The table T_EVENT is passed to the function 'REUSE_ALV_LIST_DISPLAY' while displaying the ALV Report.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = L_REPID "Program Name
IS_LAYOUT = W_LAYOUT "Layout of the Report
IT_FIELDCAT = T_FIELDCAT "Field Catalog for Report
IT_EVENTS = T_EVENT "For setting the events
TABLES
T_OUTTAB = T_OUTPUT "Report data Internal Table
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
2006 Nov 17 11:27 AM
Hi Sreekanth,
Thanks for your time.
If you have any material regarding ALV ,then please send the same to this ID.
thanks,
Albert
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |