ALV Grid - Subtotal
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
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.
Similar Messages
-
ALV Grid Subtotal text and Total text display
Hello ABAPGuru's
I want to display the subtotal and Total texts. alv grid program runing on background.
Regards
Sweety(Sri)Hello Neil,
Here I have attached my routines.anyway my confusion. I have wrote the routine subtotal_text .but i am not passing ALV GRID FM.
*& Form eventtab_build
&---- This is used to get the list of events
---- <--RI_EVENTS Internal table
FORM eventtab_build CHANGING ri_events TYPE slis_t_event.
Structure for event handling.
DATA: rs_event TYPE slis_alv_event.
Returns table of possible events for a list type.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = ri_events. " Table of events to perform
Read the internal table with the TOP_OF_PAGE and move the
form name to the internal table
READ TABLE ri_events
WITH KEY name = slis_ev_top_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_end_of_page INTO rs_event.
IF sy-subrc = 0.
MOVE c_form_eop_name TO rs_event-form. " Form name
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
READ TABLE ri_events
WITH KEY name = slis_ev_subtotal_text INTO rs_event.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO rs_event-form. " Formname
MODIFY ri_events FROM rs_event
INDEX sy-tabix. " Top of page event
ENDIF.
*&-- Delete all unneeded events:
DELETE ri_events WHERE form IS INITIAL.
ENDFORM. " eventtab_build
*& Form SUBTOTAL_TEXT
text
--> p1 text
<-- p2 text
FORM SUBTOTAL_TEXT USING ep_subtot_line TYPE type_data
e_event_data TYPE slis_subtot_text.
IF NOT e_event_data-criteria IS INITIAL.
E_EVENT_DATA-DISPLAY_TEXT_FOR_SUBTOTAL = 'Account Total'.
ENDIF.
ENDFORM. "SUBTOTAL_TEXT
*& Form initialise_layout
Initialise Layout
FORM initialise_layout .
i_layout-colwidth_optimize = c_x.
i_layout-group_change_edit = c_x.
*i_layout-subtotals_text = ' a'.
i_layout-detail_popup = c_x.
i_layout-zebra = c_x.
i_layout-no_vline = 'X'.
i_layout-no_hline = 'X'.
i_layout-totals_text = 'Account Total'.
ENDFORM. " initialise_layout
Call the function module to display the report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_program
i_callback_top_of_page = 'TOP_OF_PAGE' "Top Of Page
is_layout = i_layout
it_fieldcat = i_fieldtab
it_sort = i_sort
it_events = i_events " Events
is_print = i_print
i_default = c_x
i_save = c_save
is_variant = v_variant
TABLES
t_outtab = i_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards
Sweety (Sri) -
Inconsistency in ALV grid subtotal
I have an oops ALV grid where I am doing subtotal by a particular column called 'PRDHA'. But my subtotal seems very inconsistent. It is grouping non-similar PRDHA's as one PRDHA.
My assumption was that perhaps I need to sort the internal table (which in my case is a field symbol - <gt_tabletotal>) by that column 'PRDHA'. Is this right ? Please correct me if this assumption is right.
Also this internal table is a dynamic internal table number of columns depend on certain conditions.
How do I sort <gt_tabletotal> by PRDHA ?
wa_sort2-fieldname = 'PRDHA'.
wa_sort2-up = 'X'.
wa_sort2-subtot = 'X'.
append wa_sort2 to gt_sort.
call method o_grid->set_table_for_first_display
exporting
is_variant = gx_variant
i_save = 'A'
is_layout = gs_layout
changing
it_fieldcatalog = it_fldcat
it_sort = gt_sort[]
it_outtab = <gt_tabletotal>.
(I am trying to subtotal by PRDHA. The row with '*' indicates the subtotal line and you see inconsistency )
Report as is :
Plant Cont. PRDHA Material Desc.
2001 021 18/10R 33200-1866043 AHDC 24/4.3oz AW BS&P CS 0.000
* 11/16T 0.000
2001 021 18/10R 33200-1866450 AHDC 24/4.3oz AW Brillnt Sprkl Gel CS 0.000
2001 021 18/10R 33200-2784000 AHDC 121g/24ct Enamel Care Korea CS 0.000
2001 021 18/10S 33200-1805330 AHDC 24/6.0oz Complete X-White CS 8,100.000
* 18/10R 0.000
2001 021 18/10S 33200-1877030 AHDC 24/6.0oz TC Peroxicare CS 0.000
2001 021 18/10S 33200-1886030 AHDC 24/6.0oz Peroxicare CS 5,400.000
2001 021 18/10S 33200-2781501 AHDC 178gr/24ct Complete Care Korea CS 0.000
2001 021 18/1M5 33130-1008010 AHDC 12/75ml Email Diamant Replenium CS 0.000
* 18/10S 13,500.000Found it on my own.
data : field(5) value 'PRDHA' .
assign field to <prdha>.
sort <gt_tabletotal> ascending by (<prdha>).
(If I dont sort the table by PRDHA, subtotal is inconsistent ). -
ALV Grid - Subtotal & total to be shown at the top of the table
Hi,
I am using function module 'REUSE_ALV_GRID_DISPLAY' to display a table, and I count subtotals and total for some fields. The total is always shown at the bottom of the table, and subtotals are always shown after the rows that subtotals are calculated for. Is there a way to make it so that the total is always shown at the top of the table, and subtotals are shown before the rows that subtotals are calculated for?
Thank you,
Jake AlexanderGW_LAYOUT-TOTALS_BEFORE_ITEMS = 'X'.
Regards
Sreekanth -
ALV Grid Control - Modifiy data in total and subtotal lines
Hello all,
I´am creating a report using ALV Grid Control. This report calculates (using delivered and returned materials) for each vendor/material-combination the return quote.
Using the totals and subtotals function for different characteristics I want to calculate the return quote for the selected characteristic. Example:
Material delivered returned quote
..4711 . . . 500 . . . 5 . . . . 1 (=returned*100/delivered)
..4711 . . . 400 . . . 10 . . . . 2,5
. SUM . . . 900 . . . 15 . . . . 3,5 <-- 3,5 is the sum but I want display the calculated value 1,667
Is there a possibility to modify data in the total and subtotal lines.
Thank you for your answer
Best regards
Thomasyou said instead of 3.5 you want to show 1,667 ..
how is it possible...
3,5 become 1,667
i thought you are doing any conversions...
vijay -
Subtotal in ALV grid for a particular type and Grand total in ALV
Hi,
I need to have sub total for a particular type(eg: goods, services).. and grand total at end in ALV grid..
ALV output required as below:
Type VAT registration number Country Total Gross Amounts Total Tax Amounts Total Amount, ex-tax
Goods ATU12345678 AT 222.42 0 222.42
Goods NL123456789B02 NL 3,417.00 0 3,417.00
Goods Total 3,639.42 - 3,639.42
Services ATU12345678 AT 2,342.34 0 2,342.34
Services NL123456789B02 NL 223.33 0 223.33
Services Total 2,565.67 - 2,565.67
Grand Total 6,205.09 - 6,205.09
Let me as to how to achieve the above type in ALV grid...
Regards
Shivacheck this link..
Grand Totals in ALV grid disply function module
or do like this..
REPORT ZALVTESTFORSUBTOTAL.
tables:pa0008.
type-pools:slis.
types:begin of ty_pa0008,
pernr like pa0008-pernr,
begda like pa0008-begda,
endda like pa0008-endda,
ansal like pa0008-ansal,
lga01 like pa0008-lga01,
bet01 like pa0008-bet01,
end of ty_pa0008.
data:it_pa0008 type standard table of ty_pa0008 with header line.
data:it_fieldcat type SLIS_T_FIELDCAT_ALV,
wa_fieldcat type slis_fieldcat_alv,
it_layout type slis_layout_alv,
WA_events TYPE slis_alv_event,
it_events TYPE slis_t_event.
select-options:s_pernr for pa0008-pernr.
start-of-selection.
perform getD_data.
perform disp_alv.
*& Form getD_data
text
--> p1 text
<-- p2 text
form getD_data .
select pernr
begda
endda
ansal
lga01
bet01
from pa0008
into table it_pa0008
where pernr in s_pernr.
sort it_pa0008 by pernr begda descending.
endform. " getD_data
*& Form disp_alv
text
--> p1 text
<-- p2 text
form disp_alv .
wa_fieldcat-fieldname = 'PERNR'.
wa_FIELDCAT-REPTEXT_DDIC = 'Personnel no'.
*WA_FIELDCAT-no_subtotals = 'X'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'BEGDA'.
wa_FIELDCAT-REPTEXT_DDIC = 'Start date'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ENDDA'.
wa_FIELDCAT-REPTEXT_DDIC = 'End date'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'ANSAL'.
wa_FIELDCAT-REPTEXT_DDIC = 'Annula salary'.
wa_fieldcat-do_sum = 'X'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'LGA01'.
wa_FIELDCAT-REPTEXT_DDIC = 'Wage Type'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'BET01'.
wa_FIELDCAT-REPTEXT_DDIC = 'Amount for wagetype'.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
DATA: sort TYPE slis_sortinfo_alv,
it_sort TYPE slis_t_sortinfo_alv.
sort-fieldname = 'PERNR'.
sort-subtot = 'X'.
SORT-UP = 'X'.
APPEND sort TO it_sort.
*sort-fieldname = 'BEGDA'.
*SORT-NO_SUBTOTS = 'X'.
*APPEND sort TO it_sort.
IT_layout-totals_text = 'total text'.
IT_layout-subtotals_text = 'Subtotal text'.
*WA_EVENTS-NAME = 'SUBTOTAL TEXT'.
*WA_EVENTS-FORM = 'SUBTOTAL TEXT'.
*APPEND WA_EVENTS TO IT_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IS_LAYOUT = it_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
it_sort = it_sort
it_events = it_events
TABLES
t_outtab = it_pa0008 .
endform. " disp_alv -
Regarding user interface in subtotal line of ALV grid, ensure points
Hi,
I have 3 fields,
A= vendor , B = freight , C = Cost PMT
When the vendor get changed, My Grid is showing subtotal of B i.e freight.
Now my requirement is, in the same subtotal line, I want average of C (Cost PMT) field.
So how we can interact with the subtotal line of the ALV grid.
Pleas reply!!!! & have ur points.
cheersRead the documentation of FM ICON_CREATE, the purpose of the Function module is entirely different from what you are using it for.
To print Icons in ALV (Using FMs ) all you need to do is to send the Icon name in the field.
Also parameters TEXT and INFO of FM ICON_CREATE seem to be flags, that are appended to the icon name so that when you set it on the screen the appropriate info or Text is shown. -
How to display a row after a subtotal field in ALV Grid
Hi All,
My requirement is to print a extra row with values and constant text after printing subtotal values in ALV Grid.
e.g. TOTAL 12.23 ---> Subtotal field
Tax 5.2 ---> extra row after subtotal field.
Please help me....
Thanks in advance.
Regards
AjayHi
You can try using INSERT <WA> OR INSERT INITIAL LINE .
fill the wa with tax value.
INSERT <wa> into table < internal table >
A row will be inserted into internal table with the values.
Try this and let me know.
Thanks
Hariharan -
Subtotal Text in ALV Grid and hiding empty row
Hello,
ive got a ALV-Grid with a few fields .. Total on one field subtotal on VKORG, category or some other fields .
after subtotal of one of the 2 named fields i'm reading the literal to the given fields and writing them in the table which is displayed and do a refresh.
i can show the field literal in the alv by adding it into the field cat but than its displayed even if its not filled.
i just want to display that column after filling it - the subtotal of the 2 columns.
and i want to add the text of the literal to the subtotal line. so if the alv grid is closed to display the totals. i want to see what the subtotal is for.
for displaying i use
CALL METHOD lcl_alv_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
is_variant = gs_variant
it_toolbar_excluding = gt_exclude
i_save = x_save
i_default = 'X'
CHANGING
it_outtab = it_alvlist[]
it_fieldcatalog = gt_field_cat.
for refresh
lv_lvc_s_stbl-row = 'X'.
lv_lvc_s_stbl-col = 'X'.
lv_soft_refresh = 'X'.
CALL METHOD lcl_alv_grid->refresh_table_display
EXPORTING
is_stable = lv_lvc_s_stbl
i_soft_refresh = lv_soft_refresh
EXCEPTIONS
finished = 1
OTHERS = 2.
get the selected column to read literal
CALL METHOD lcl_alv_grid->get_selected_columns
IMPORTING
et_index_columns = it_col_tab
EXCEPTIONS
OTHERS = 1.
Hope you can help me and understand my problemHi,
Use the No_out from Reusable types of fieldcat..For example.
IF it_final-field is initial.
READ TABLE IT_FIELDCAT5 WITH KEY FIELDNAME = 'BCD'.
IF SY-SUBRC EQ 0.
IT_FIELDCAT5-NO_OUT = 'X'.
MODIFY IT_FIELDCAT5 INDEX SY-TABIX TRANSPORTING NO_OUT.
ENDIF.
else.
READ TABLE IT_FIELDCAT5 WITH KEY FIELDNAME = 'BCD'.
IF SY-SUBRC EQ 0.
IT_FIELDCAT5-NO_OUT = ' '.
MODIFY IT_FIELDCAT5 INDEX SY-TABIX TRANSPORTING NO_OUT.
ENDIF.
ENDIf.
Cheers,
Syed Maheboob. -
ALV grid display the subtotal not getting for one column at the output
Hi,
I am working one report ALV grid display and subtotal is not getting for one paricular coulumn.
Eventhough that column has some values.
So can anyone give the proper solution.
Waiting quick response.
Best Regards,
BansiHi
see this link .
https://wiki.sdn.sap.com/wiki/display/ABAP/SUBTOTALinALV
or try this program.
REPORT zalv.
DATA:
t_sflight TYPE TABLE OF sflight,
fs_sflight TYPE sflight.
DATA:
r_container TYPE REF TO cl_gui_custom_container,
r_grid TYPE REF TO cl_gui_alv_grid.
*FIELD CATALOG
DATA:
t_fcat TYPE lvc_t_fcat,
fs_fcat TYPE lvc_s_fcat.
*SORTING THE BASIC LIST
DATA:
t_sort TYPE lvc_t_sort,
fs_sort TYPE lvc_s_sort.
fs_fcat-fieldname = 'PRICE'.
fs_fcat-do_sum = 'X'.
APPEND fs_fcat TO t_fcat.
fs_sort-spos ='1'.
fs_sort-fieldname = 'CARRID'.
fs_sort-down = 'X'.
fs_sort-group = '*'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO t_sort.
SELECT * FROM sflight INTO TABLE t_sflight.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN1'.
SET TITLEBAR 'TITLE1'.ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
**& Module HANDLER OUTPUT
MODULE list OUTPUT.
CREATE OBJECT r_container
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT r_grid
EXPORTING
i_parent = r_container.
CALL METHOD r_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_fieldcatalog = t_fcat
it_outtab = t_sflight
it_sort = t_sort.
ENDMODULE. "list OUTPUT
Regards
Hareesh Menon -
Total, Subtotal of a hidden column in an ALV grid
I have a requirement for an ALV grid where I have to use a custom formula for a column's total and subtotal.
This value is a function of another column which is hidden (No_out = 'X').
I am unable to access the total and subtotal of this hidden column . I am able to access this only when I unhide the column in the field catalog.
THis is how I access the total and subtotal of the GRID. I use oops ALV of the class CL_GUI_ALV_GIRD.
call method o_grid->get_subtotals
importing
ep_collect00 = total
ep_collect01 = subto.
assign total->* to <ftotal>.
assign subto->* to <fsubto>.
I thought I would manipulate <ftotal>-mycolumn and <fsubto>-mycolumn . But both these are functions of a hidden column
and <ftotal>-hiddencolumn and <fsubto>-hiddencolumn is always empty unless I unhide them. I cannot display these columns to users as they are just logical columns of a dynamic internal table I have built. :-sHI,i have the same issue, how did you solve it?
Regards. -
Total/Subtotal Icon in ALV GRID
Hi;
i have an ALV GRID that is already sorted and data is shown ordered in the grid:
Sort Documento
wa_sort-spos = '1' .
wa_sort-fieldname = 'MBLNR'.
wa_sort-tabname = 'ITAB'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO i_sort .
CLEAR wa_sort.
But, i need to subtotal by a column and i do this:
gt_fieldcat-seltext_l = 'Cant_entregada'.
gt_fieldcat-fieldname = 'MENGE'.
gt_fieldcat-ref_tabname = 'itab'.
gt_fieldcat-outputlen = 14.
gt_fieldcat-do_sum = 'X'.
APPEND gt_fieldcat. CLEAR gt_fieldcat.
Menge is data type Integer because the Key User doesn´t want decimal places.
And ,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_sort = i_sort
i_default = 'X'
i_save = 'A'
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
So data in the grid is ordered by Document number, but the total/subtotal button is not displayed.
i've been lookin other posts about the same, but i don´t see any difference with my code.
Any help.
David Fúnez
Tegucigalpa, Hondurasi found the answer..jus added this line : gt_fieldcat-datatype = 'INT4'.
gt_fieldcat-seltext_l = 'Cant_entregada'.
gt_fieldcat-fieldname = 'MENGE'.
gt_fieldcat-ref_tabname = 'itab'.
gt_fieldcat-outputlen = 14.
gt_fieldcat-do_sum = 'X'.
gt_fieldcat-datatype = 'INT4'.
APPEND gt_fieldcat. CLEAR gt_fieldcat.
Now buttons are displayed... -
ALV GRID: How to change Subtotal and Main total values in standard row
Hi Experts,
By using SORT-SUBTOT = 'X' and FIELDCATALOG-DO_SUM = 'X', I will get subtotal and Main total.
My requiremnt is I need be calculate values manually and pass the calculated values to subtotal and maintotal.
is it possible in ALV GRID?
By adding extra row we will do this but I am looking standard subtotal and maintotal row change.
Thanks in advance,
MaheHi,
With function REUSE_ALV_GRID_DISPLAY you cannot do this.
It´s possible if you create a class inherited from cl_gui_alv_grid and rewrite the method set_data_table, you can do this. Like:
CLASS xgrid DEFINITION INHERITING FROM cl_gui_alv_grid.
PROTECTED SECTION.
METHODS: set_data_table REDEFINITION.
ENDCLASS. "xgrid DEFINITION
CLASS xgrid IMPLEMENTATION.
METHOD set_data_table.
* ....MODIFY data_table ...
CALL METHOD super->set_data_table
CHANGING
data_table = data_table.
ENDMETHOD. "set_data_table
ENDCLASS. "xgrid IMPLEMENTATION
DATA: grid TYPE REF TO xgrid.
CREATE OBJECT custom_container EXPORTING container_name = mycontainer.
CREATE OBJECT grid EXPORTING i_parent = custom_container.
CALL METHOD grid1->set_table_for_first_display ...
Best regards,
Leandro Mengue -
Change the total and subtotal dynamically in ALV GRID
Hi guys,
I need to change the total and subtotal of field "AMOUNT" dynamically.I am using ALV GRID CONTROL(oops concept).I need to override the standard functionality.I need to show my own subtotal and total line instead of standard one .Hi
I've understood it, I wanted to use OO Grid too, but I had to use the ALV list in order to write my total.
If you need to use OO grid u can try to exclude all funcitonalities for the total, subtotal and sorting and insert in the output table the lines with your totals.
Max -
Percentage Total/Subtotal in ALV Grid
Dear All,
I have to display an ALV report with percentage feilds. Everything is fine but the problem arises when the standard ALV sum functionality is used. It simply adds up all the percentage columns. Making do_sum = 'C' wont help either as it would simple give an average of all the percentage. My requirement is to show them through calculation. I have searched the web and saw some solutions with SUBTOTAL_TEXT nad some with OOP programming but i am not able to get this. Can anybody please help.
<REMOVED BY MODERATOR>
Thanks
MV
Edited by: Alvaro Tejada Galindo on Apr 21, 2008 4:24 PMhi manish,
try this program.
ALV Grid List with sub-totals
REPORT z_demo_alv_sort.
* This program lists orders (VBAK) with sort and sub-total for *
* 'sold-to-party' (KUNNR) and 'Sales organization' (VKORG) *
TABLES : vbak.
TYPE-POOLS: slis. " ALV Global types
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
DATA:
BEGIN OF gt_vbak OCCURS 0,
vkorg LIKE vbak-vkorg, " Sales organization
kunnr LIKE vbak-kunnr, " Sold-to party
vbeln LIKE vbak-vbeln, " Sales document
netwr LIKE vbak-netwr, " Net Value of the Sales Order
waerk LIKE vbak-waerk, " Document currency
END OF gt_vbak.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form f_read_data
FORM f_read_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
FROM vbak
UP TO p_max ROWS
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
ENDFORM. " F_READ_DATA
* Form f_display_data
FORM f_display_data.
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = 'VBAK'.
ls_fieldcat-do_sum = &2.
ls_fieldcat-cfieldname = &3.
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
ls_sort-up = 'X'.
ls_sort-subtot = &2.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
ls_layout TYPE slis_layout_alv.
m_fieldcat 'VKORG' '' ''.
m_fieldcat 'KUNNR' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'NETWR' 'X' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
m_sort 'VKORG' 'X'. " Sort by vkorg and subtotal
m_sort 'KUNNR' 'X'. " Sort by kunnr and subtotal
m_sort 'VBELN' ''. " Sort by vbeln
ls_layout-cell_merge = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
it_sort = lt_sort
TABLES
t_outtab = gt_vbak.
ENDFORM. " F_DISPLAY_DATA
***************** END OF PROGRAM Z_DEMO_ALV_SORT **********************
thanks
karthik
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 21, 2008 4:50 PM
Maybe you are looking for
-
Oracle Apps Sys Admin -- Disabling a button on a form
Hi Guys, I want to disable a button on a form in oracle applications. Normally, i disable a button by goin to that MENU, SUBMENU(if there are any) and take the button's sub-function and add it in FUNCTION and MENU Exclusions in the reponsibility defi
-
Is there a way to create a thumbnail for QuickTime videos on a PC? (Windows XP) All the the videos currently have the same QuickTime logo as their thumbnail.
-
Cancel Sales Order lines that are picked
Hi 1. I'm trying to cancel sales order lines through process order api that are picked and delivery status is Staged/Pick Confirmed. The error is You are not allowed to cancel Order Line because: Line has been pick confirmed/staged. I'm unable to per
-
Account determination error at billing level
Hi, for Account determination error at billing level i checked the line item level for the material by highlighting the item, then GO TO > ITEM > ITEM DETAILS. here 5 line items are there , 4 line items have same "Acct asgnmt grp" and 1 line item is
-
Click "adapter monitoring" cause "The page cannot be displayed"
At RWB, the "adapter monitoring" used to be OK. But now it gives "The page cannot be displayed". How to debug it? Thanks!