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 Alexander
GW_LAYOUT-TOTALS_BEFORE_ITEMS = 'X'.
Regards
Sreekanth
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) -
Create TOTAL at the top of the page
Hi,
I would like to know if is there any chance to create total on crosstab page and put it on page items or at the top of the page.
The only way i know is that i can put it at the bottom, right or subtotal.
Thank you in advance,
DaniHi Russ, Michael,
Before i posted here i tried Russ' idea but is not working on my case because my data points are set to detail and when i tried to create a calculation it gave me an error in which said that i cannot aggregate details data point.
So in this situation i came with another solution where i added a graph on viewer.
The only problem is that for example my Total Column is equal with 21.456.879 and the Graph show me only 21.46 M.
I tried to change the scale but it did not work.
Do you have any idea how i can deal with this issue ?!
Many thanks,
Dani -
When I open safari from the dock it opens as a small window at the top of the screen that is totally white and does not have a tool bar or exit options. All I can do is force quit to exit. What do I do?
With Safari open, press Command , (comma) to open Safari Preferences then select the Extensions tab.
Turn that off, quit (or force quit) Safari then relaunch to test. -
Hi SAP Experts,
Currently I have ALV Grid table as below as example :
FIELD1
FIELD2
Account
Amount
1. Rev
1.Rev
Acct1
100.00
1. Rev
1.Rev
Acct2
50.00
Subtotal FIELD2 (1.Rev)
150.00
Subtotal FIELD1 (1.Rev)
150.00
2. Cost
2.1 Cost1
Acct3
100.00
2. Cost
2.1 Cost1
Acct4
75.00
Subtotal FIELD2 (2.1 Cost1)
175.00
2. Cost
2.2 Cost2
Acct5
25.00
Subtotal FIELD2 (2.2 Cost 2)
25.00
| Subtotal FIELD1 (2.Cost) | 200.00 |
I have 2 questions.
First, as you can see, I have 2 subtotal for 1.Rev eventhough 1.Rev actually only need one subtotal because there is no subgroup for 1.Rev. Is it possible to have only one subtotal for this 1.Rev but I still maintained 2 subtotal for 2.Cost because 2.Cost has subgroup?
My 2nd issue is I need to insert another row exactly below Subtotal FIELD1 (2.Cost) row like this:
Gross Margin
(Some formula)
This row does not come from any sub total. The problem is I can not just insert this column and put Gross Margin description in FIELD1 because I will have 3 row like below :
Gross Margin
(Formula)
Subtotal FIELD2 (blank)
(Formula) sub total
Subtotal FIELD1 (Gross Margin)
(Formula) sub total
Is there any way I can insert Gross Margin Row without creating new subtotal for it so it will only have one line in the ALV Grid table? Please help. Thank you.
Regards,
AbrahamHi Vijay.
I'm not posting this before I search everywhere and this is not the first time I post in this forum so I know what I should do before posting. If I miss something, maybe you can give me at least a hint whether it can be done or not.
This report that I am using is ALV Grid using REUSE_ALV_GRID_DISPLAY function module and not OOP using dialog module. I never said I need sample code because I only want to know is there a way to do that using ALV Grid which until now I will say that SAP ALV grid has this limitation where you can not insert row without including it in the subtotal.
So, I would be very thankful if someone can give me some clarity on this thing and Vijay, if you really don't know what is the answer, I really appreciate if you can hold your self from making that kind of reply. It does not need experienced ABAP Consultant to write such remarks. Thanks.
Regards,
Abraham -
Hi All,
I have written a code to show sub totals in ALV.
But, is there any way by which I can show *Only the sub total
lines* and not the individual line items that form the sub total ?
e.g.:-
KeyField1 KeyField2 Field1 Field2
A 1 10 12
A 1 15 8
SUBTOTAL 25 20
B 2 15 12
SUBTOTAL 15 12
C 1 10 8
C 2 8 12
C 3 7 2
SUBTOTAL 25 22
Now I want only the SUBTOTAL rows to be visible in ALV not the individual rows as follows :-
KeyField1 KeyField2 Field1 Field2
SUBTOTAL 25 20
SUBTOTAL 15 12
SUBTOTAL 25 22
Regards,
Ashishhi check this..in this only subtotals are shown if u click on the subtotal it will show the detailed list for that subtotal..
*& Report ZVG_ALV_SLIST2 *
report zvg_alv_slist2 .
ALV
type-pools: slis.
G L O B A L I N T E R N A L T A B L E S
data: gt_fieldcat type slis_t_fieldcat_alv,
gs_layout type slis_layout_alv,
gt_events type slis_t_event.
data: it_sort type slis_t_sortinfo_alv ,
wa_sort type slis_sortinfo_alv .
data: gs_print type slis_print_alv.
data: begin of it_sflight occurs 0,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
price like sflight-price,
planetype like sflight-planetype,
seatsmax like sflight-seatsmax,
seatsocc like sflight-seatsocc,
paymentsum like sflight-paymentsum,
end of it_sflight.
*DATA: GI_SFLIGHT LIKE STANDARD TABLE OF ST_SFLIGHT.
data: g_repid like sy-repid.
data: gt_list_top_of_page type slis_t_listheader.
data: v_total(5).
start-of-selection.
g_repid = sy-repid.
perform init_fieldcat using gt_fieldcat[].
perform build_eventtab using gt_events[].
perform build_comment using gt_list_top_of_page[].
perform get_data.
perform set_layout using gs_layout.
SORTING
clear wa_sort.
wa_sort-fieldname = 'CARRID'.
wa_sort-up = 'X'.
wa_sort-group = '*'.
wa_sort-subtot = 'X'.
append wa_sort to it_sort.
clear wa_sort.
wa_sort-fieldname = 'CONNID'.
wa_sort-up = 'X'.
wa_sort-group = 'UL'.
wa_sort-subtot = 'X'.
append wa_sort to it_sort.
DISPLAY LIST
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_interface_check = ' '
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_sort = it_sort[]
it_events = gt_events
is_print = gs_print
tables
t_outtab = it_sflight
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.
*& Form INIT_FIELDCAT
form init_fieldcat using p_gt_fieldcat type slis_t_fieldcat_alv.
data: ls_fieldcat type slis_fieldcat_alv,
l_index type sy-tabix.
data :rep like sy-repid.
rep = sy-repid.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = rep
i_internal_tabname = 'IT_SFLIGHT'
i_inclname = rep
changing
ct_fieldcat = gt_fieldcat
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type 'S' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-subrc.
endif.
sort gt_fieldcat by col_pos.
loop at gt_fieldcat into ls_fieldcat.
l_index = sy-tabix.
if ls_fieldcat-fieldname = 'PRICE'.
ls_fieldcat-do_sum = 'X'.
ls_fieldcat-sp_group = 'X'.
modify gt_fieldcat from ls_fieldcat index l_index .
endif.
endloop.
endform. " INIT_FIELDCAT
*& Form BUILD_EVENTTAB
form build_eventtab using p_gt_events type slis_t_event.
data: ls_event type slis_alv_event.
clear ls_event.
ls_event-name = slis_ev_top_of_page.
ls_event-form = 'XTOP_OF_PAGE'.
append ls_event to p_gt_events.
clear ls_event.
ls_event-name = slis_ev_top_of_list.
ls_event-form = 'XTOP_OF_LIST'.
append ls_event to p_gt_events.
clear ls_event.
clear ls_event.
ls_event-name = slis_ev_end_of_page.
ls_event-form = 'XEND_OF_PAGE'.
append ls_event to p_gt_events.
ls_event-name = slis_ev_end_of_list.
ls_event-form = 'XEND_OF_LIST'.
append ls_event to p_gt_events.
clear ls_event.
endform. " BUILD_EVENTTAB
*& Form BUILD_COMMENT
form build_comment using p_gt_list_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
ls_line-typ = 'H'." = Header, S = Selection, A = Action
ls_line-key = 'KEY'.
ls_line-info = 'INFO'.
append ls_line to p_gt_list_top_of_page.
endform. " BUILD_COMMENT
*& Form SELECTION
form get_data..
data: l_rows type i value 3.
Read data from table SFLIGHT
select carrid
connid
fldate
price
planetype
seatsmax
seatsocc
paymentsum
from sflight
into table it_sflight.
up to l_rows rows.
sort it_sflight.
endform. " SELECTION
*& Form SET_LAYOUT
form set_layout using p_gs_layout type slis_layout_alv.
* P_GS_LAYOUT-F2CODE = P_F2CODE.
p_gs_layout-zebra = 'X'.
p_gs_layout-colwidth_optimize = 'X'.
p_gs_layout-no_input = 'X'.
p_gs_layout-no_colhead = space.
p_gs_layout-totals_text = 'Total Price'.
p_gs_layout-subtotals_text = 'Sub Total'.
p_gs_layout-totals_only = 'X'.
p_gs_layout-key_hotspot = 'X'.
p_gs_layout-detail_popup = 'X'.
p_gs_layout-no_subtotals = space.
p_gs_layout-expand_all = 'X'.
p_gs_layout-group_buttons = 'X'."space.
endform. " SET_LAYOUT
FORM XTOP_OF_PAGE *
form xtop_of_page.
data : lv_page(5),
lv_text(20).
MOVE SY-PAGNO TO LV_PAGE.
write:/ 'X_TOP_OF_PAGE'.
endform. "xtop_of_page
FORM XTOP_OF_LIST *
form xtop_of_list.
write:/ 'X_TOP_OF_LIST'.
endform. "xtop_of_list
FORM XEND_OF_PAGE *
form xend_of_page.
write:/ 'X_END_OF_PAGE'.
endform. "xend_of_page
FORM XEND_OF_LIST *
form xend_of_list.
write:/ 'X_END_OF_LIST'.
data : lv_page(5),
lv_text(20).
data : l_lines type i,
l_line type i.
clear v_total.
write sy-pagno to v_total left-justified.
export v_total to memory id 'V_TOTAL'.
do sy-pagno times.
lv_page = sy-index.
concatenate 'Page' lv_page 'of' v_total
into lv_text separated by space.
if sy-index = 1.
read line 2 of page sy-index.
else.
read line 1 of page sy-index.
endif.
sy-lisel+60(20) = lv_text.
modify current line .
enddo.
endform. "xend_of_list
USER_COMMAND *
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when 'EXIT'.
leave to screen 0.
when '&IC1'.
data: text(256),text1(6),text2(5).
move rs_selfield-tabindex to text1.
move rs_selfield-sumindex to text2.
concatenate 'Double clicked on (field:'
rs_selfield-fieldname
'Value:'
rs_selfield-value
text1
text2
into text
separated by space.
call function 'POPUP_TO_DISPLAY_TEXT'
exporting
textline1 = text.
endcase.
endform. "user_command
regards,
venkat. -
Issue in ALV Grid Grand Totals
Hi Friends,
Hwo can i display grand total text in ALV Grid? Eventhough i am using Totals_text parameter in layout i am unable to display. any one vcan help me out in this refgard.
if pos send the code
Regards,
Vijay<REMOVED BY MODERATOR>
SAMPLE PROGRAM:
REPORT ysalesorder_alv_subtotals.
* Type Pools
TYPE-POOLS:slis.
* Tables
TABLES: vbak, "Sales Document: Header Data
vbap. "Sales Document: Item Data
* Global Structures
DATA:gt_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
gt_sortcat TYPE slis_t_sortinfo_alv,
wa_sortcat LIKE LINE OF gt_sortcat.
* Internal Table
DATA: BEGIN OF gt_salesorder OCCURS 0,
vbeln LIKE vbak-vbeln, " Sales Document Number
posnr LIKE vbap-posnr, " Sales Doc Item
netwr LIKE vbap-netwr, " Net Value
END OF gt_salesorder.
* SELECT OPTIONS
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME
TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln. " Sales Document
Number.
SELECTION-SCREEN END OF BLOCK b1.
* Initialization
INITIALIZATION.
PERFORM initialization.
* Start Of Selection
START-OF-SELECTION.
PERFORM field_catalog. "For Structure Creation
PERFORM fetch_data. "Get the Data From DB Table
PERFORM sorting USING gt_sortcat.
* End Of Selection
END-OF-SELECTION.
PERFORM display_data.
*& Form initialization
* text
* --> p1 text
* <-- p2 text
FORM initialization .
s_vbeln-sign = 'I'.
s_vbeln-option = 'BT'.
s_vbeln-low = '4969'.
s_vbeln-high = '5000'.
APPEND s_vbeln.
ENDFORM. " initialization
*& Form field_catalog
* text
* --> p1 text
* <-- p2 text
FORM field_catalog .
REFRESH : gt_fieldcat.
CLEAR : wa_fieldcat.
wa_fieldcat-col_pos = '1'. "Column Position
wa_fieldcat-tabname = 'IT_SALESORDER'. "Internal Table
wa_fieldcat-fieldname = 'VBELN'. "Field Name
wa_fieldcat-key = 'X'. "Blue Color
wa_fieldcat-seltext_m = 'Sales Doc No'. "Display Text In Screen
APPEND wa_fieldcat TO gt_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '2'. "Column Position
wa_fieldcat-tabname = 'IT_SALESORDER'. "Internal Table Name
wa_fieldcat-fieldname = 'POSNR'. "Field Name
wa_fieldcat-seltext_m = 'Sales Doc Item'."Display Text In Screen
APPEND wa_fieldcat TO gt_fieldcat.
CLEAR wa_fieldcat.
*SubTotal on the Field NETWR
wa_fieldcat-col_pos = '3'. "Column Position
wa_fieldcat-tabname = 'IT_SALESORDER'. "Internal Table
wa_fieldcat-fieldname = 'NETWR'. "Field Name
wa_fieldcat-do_sum = 'X'. "Sum
wa_fieldcat-seltext_m = 'Net Value'. "Display Text In Screen
APPEND wa_fieldcat TO gt_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " field_catalog
*& Form sorting
* text
* -->P_IT_SORTCAT text
FORM sorting USING p_it_sortcat TYPE slis_t_sortinfo_alv.
CLEAR wa_sortcat.
wa_sortcat-fieldname = 'VBELN'.
wa_sortcat-up ='X'.
wa_sortcat-subtot = 'X'.
APPEND wa_sortcat TO p_it_sortcat.
ENDFORM. " sorting
*& Form display_data
* text
* --> p1 text
* <-- p2 text
FORM display_data .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
it_fieldcat = gt_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = gt_sortcat
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_salesorder
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.
ENDFORM. " display_data
*& Form fetch_data
* text
* --> p1 text
* <-- p2 text
FORM fetch_data .
REFRESH : gt_salesorder.
CLEAR : gt_salesorder.
SELECT a~vbeln
posnr
b~netwr
FROM vbak AS a
INNER JOIN vbap AS b ON a~vbeln = b~vbeln
INTO TABLE gt_salesorder
WHERE a~vbeln IN s_vbeln.
ENDFORM. " fetch_data
Edited by: Alvaro Tejada Galindo on Apr 11, 2008 12:24 PM -
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 ). -
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.
AlbertHi 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 have done an object in alv grid where it is working fine but what i want i am giving a sample please do let tell me how to do
OUTPUT
DATE TIME-ENTRY ACM-NO CHARG SHIFT MACHINE-SPEED STANDARD-D ACTUALL-DIPS DOWNTIME-MINS DOWN-TIME-IN%
2009/08/23 00:45:41 ACMA01 910808 B 27.090 2,167 2,120 10 2.08
2009/08/23 08:38:45 ACMA01 910808 C 27.090 2,167 1,459 157 32.71
910808 4,334 3,579 167
2009/08/23 08:51:59 ACMA01 910809 C 27.090 2,167 141 449 93.54
2009/08/23 17:24:39 ACMA01 910809 A 27.090 2,167 2,113 12 2.50
910809 4,334 2,254 461
2009/08/23 00:48:56 ACMA02 920810 B 25.700 2,056 2,015 10 2.08
2009/08/23 09:07:02 ACMA02 920810 C 25.700 2,056 2,043 3 0.63
2009/08/23 17:27:04 ACMA02 920810 A 25.700 2,056 421 382 79.58
2009/08/23 17:27:12 ACMA02 920810 A 25.700 2,056 421 382 79.58
920810 8,224 4,900 777
2009/08/23 17:30:12 ACMA02 920811 A 25.700 2,056 1,335 168 35.00
920811 2,056 1,335 168
In Down time in % i want to do a bit of calculation
X = 3579(ACCTUALL DIPS)/4334(STANDARD DIPS)
X = .0852 * 100 = 82.5 - 100
X = -17.4%( This should display in DOWN-TIME-IN%)
This will be Similar Calculation only number of lines will reduce to make it clear i gave in this way
Waiting for Reply
Thank's In Advance
Sravya
Edited by: Sravya Ch on Aug 24, 2009 7:41 AMHi Rajihta
I think you did not under stand what I want clearly
DATE TIME-ENTRY ACM-NO CHARG SHIFT MACHINE-SPEED STANDARD-D ACTUALL-DIPS DOWNTIME-MINS DOWN-TIME-IN
2009/08/23 00:45:41 ACMA01 910808 B 27.090 2,167 2,120 10 2.08
2009/08/23 08:38:45 ACMA01 910808 C 27.090 2,167 1,459 157 32.71
* 910808 4,334 3,579 167 *17%*
So how to do for that 17% .i have just eneterd it now(every thing is from SAP other than that 17%) -
ALV GRID Report is not showing all records which is in internal table
hi all,
have one doubt. please clarify me. ALV Report is working fine since long tiem. But suddenly this report is showing few records only for the given input. Example: it_main table have 50 records, but output is showing only 10 records only. (we have not made any modifications in this report).
temporarily i have given excel output file from it_main table. excel file is showing all records.
here it_main have all the records. but output is showing few records only. it is not showing any error. i have tested with REUSE_ALV_LIST_DISPLAY function also. but it also showing same results(few records only.)
please give me some idea.
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = it_fcat
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
Best Regards,
Srinivashi
Please study this program and give me suggestions.
ALV Declaration
DATA : it_events TYPE slis_t_event, "ALV event
it_fcat TYPE slis_t_fieldcat_alv, "Field catalog
it_list_top_of_page TYPE slis_t_listheader,
c_tabname TYPE slis_tabname VALUE 'IT_MAIN'.
DATA : wa_layout TYPE slis_layout_alv,
wa_event TYPE slis_alv_event,
wa_fcat TYPE slis_fieldcat_alv,
wa_variant TYPE disvariant.
START-OF-SELECTION.
PERFORM material_pass.
PERFORM data_retrieval.
END-OF-SELECTION.
PERFORM sub_display_report.
FORM sub_display_report .
DATA status(1).
IF r1 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'SIZE2' 'SIZE2' '' '10' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mains
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ELSEIF r2 = 'X' OR r3 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'CUT1' 'CUT1' '' '11' '',
'22' 'SIZE2' 'SIZE2' '' '10' '',
'23' 'CUT2' 'CUT2' '' '11' '',
'24' 'SIZE3' 'SIZE3' '' '10' '',
'25' 'CUT3' 'CUT3' '' '11' '',
'26' 'SIZE4' 'SIZE4' '' '10' '',
'27' 'CUT4' 'CUT4' '' '11' '',
'28' 'SIZE5' 'SIZE5' '' '10' '',
'29' 'CUT5' 'CUT5' '' '11' '',
'30' 'SIZE6' 'SIZE6' '' '10' '',
'31' 'CUT6' 'CUT6' '' '11' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mainall
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ENDIF.
PERFORM build_layout.
PERFORM build_events.
PERFORM sub_comment_build USING it_list_top_of_page.
PERFORM sub_set_variant.
PERFORM display_alv_report.
IF status = 'S'.
MESSAGE 'Excel Output file Downloaded to Given Path' TYPE 'I'.
ELSE.
MESSAGE 'Download Not Possible' TYPE 'I'.
ENDIF.
ENDFORM. " SUB_DISPLAY_REPORT
FORM BUILD_FIELDCATALOG
FORM build_fieldcatalog USING p_col_pos
p_fieldname
p_text
p_datatype
p_outputlen
p_col_freez.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = p_col_pos.
wa_fcat-fieldname = p_fieldname.
wa_fcat-tabname = c_tabname.
wa_fcat-reptext_ddic = p_text.
wa_fcat-datatype = p_datatype.
wa_fcat-ddic_outputlen = p_outputlen.
wa_fcat-key = p_col_freez.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
FORM build_layout.
CLEAR: wa_layout.
wa_layout-window_titlebar = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-totals_text = 'CUMULATIVE'.
ENDFORM. "BUILD_LAYOUT
*& Form BUILD_EVENTS
FORM build_events.
CLEAR wa_event.
REFRESH it_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc = 0.
READ TABLE it_events INTO wa_event
WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
APPEND wa_event TO it_events.
CLEAR wa_event.
ENDIF.
ENDIF.
ENDFORM. "BUILD_EVENTS
-->P_IT_LIST_TOP_OF_PAGE text
FORM sub_comment_build USING it_top_of_page TYPE slis_t_listheader.
DATA ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = str1.
APPEND ls_line TO it_top_of_page.
CLEAR ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. " SUB_COMMENT_BUILD
*& Form SUB_SET_VARIANT
text
--> p1 text
<-- p2 text
FORM sub_set_variant .
CLEAR wa_variant.
wa_variant-report = sy-repid.
wa_variant-username = sy-uname.
wa_variant-variant = c_variant.
wa_variant-variant = p_layout.
ENDFORM. " SUB_SET_VARIANT
*& Form DISPLAY_ALV_REPORT
*Display Report Using ALV GRID
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
i_callback_pf_status_set = c_pf_status
i_callback_user_command = c_user_command
is_layout = wa_layout
it_fieldcat = it_fcat
it_sort = it_sort[]
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
*ALV Report Header
FORM top_of_page.
DATA : t_header TYPE slis_t_listheader WITH HEADER LINE,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
wa_header-typ = 'H'.
T_HEADER-INFO = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_header-info = str1.
APPEND wa_header TO t_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. "TOP_OF_PAGE
here it_main internal table having all data. but output is showing few records only.
pl. give some idea.
Thanks & Regards
Srinivas. -
In ALV grid report, totals of columns display at end of report
Hi.....!
In ALV report i want to display grand totals in end of list and also i want to output display ALV report in page by pageHi,
this the code i am sending it may help you.
DATA : wa_sort TYPE slis_sortinfo_alv.
DATA : it_sort TYPE slis_t_sortinfo_alv. " for sorting
PERFORM sub_total USING '<field based on wich you want sort(say key field>>'.
FORM sub_total USING value(p_sortfld) .
wa_sort-fieldname = p_sortfld.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort
and then is main function module for display grid or list.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = wa_pgm
i_callback_top_of_page
='TOP_OF_PAGE'
i_grid_title = text-016
it_fieldcat = it_fieldcat
<b> it_sort = it_sort</b>
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = it_final. -
Web Dynpro ALV grid sub totals
Hi,
I have managed to get totals working with web dynpro ALV using code like this :
DATA: lr_field TYPE REF TO cl_salv_wd_field.
For total calculations...
lo_value->if_salv_wd_std_functions~set_aggregation_allowed( abap_true ).
lr_field = lo_value->if_salv_wd_field_settings~get_field( 'N_OF_DLRS' ).
lr_field->if_salv_wd_aggr~create_aggr_rule( aggregation_type = if_salv_wd_c_aggregation=>aggrtype_total ).
Please can someone advise how i can do subtotals also. Thanks
Edited by: Samir Vora on Jul 15, 2009 12:40 PMHi,
For creating subtotals, you can have a look at following article:
[Tutorial for Creation Subtotals using ALV|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20abap/tutorial%20for%20creating%20totals%20and%20subtotals%20using%20alv.pdf].
Hope this helps.
Regards
Manas Dua -
ALV GRID: Sub Total of a field
Hi All,
Currently I am getting O/P in the following format:
CURRENCY QUANTITY VALUE
GBP 1 10
GBP 2 15
INR 1 12
I want the output to be:
CURRENCY QUANTITY VALUE
GBP 1 10
GBP 2 15
GBP 25
INR 1 12
INR 12
I have already tried with:
wa_fieldcatalog-fieldname = 'VALUE'.
wa_fieldcatalog-do_sum = 'X'.
and,
clear wa_sort.
wa_sort-spos = 1.
wa_sort-fieldname = 'VALUE'.
wa_sort-expa = 'X'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
append wa_sort to t_sort
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = t_layout
it_fieldcat = wa_fieldcatalog[]
it_sort = t_sort[]
i_save = 'A'
it_events = t_events[]
TABLES
t_outtab = ts_final_output[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
It's still not working. Request u all to plz help
Edited by: Ajoy Chakraborty on Jan 23, 2009 11:43 AMHello Ajoy,
You can do like this..
wa_field-fieldname = 'MENGE'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 20.
wa_field-seltext_l ='Quantity'.
wa_field-input = ' '.
wa_field-edit = ' '.
wa_field-col_pos = '4'.
wa_field-hotspot = 'X'.
wa_field-do_sum = 'X'. " In the field catalog suppose you want the subtotal of this field
APPEND wa_field TO it_field.
CLEAR wa_field.
wa_field-fieldname = 'WERKS'.
wa_field-tabname = 'IT_TAB'.
wa_field-outputlen = 20.
wa_field-col_pos = '5'.
wa_field-seltext_l ='Plant'.
wa_field-input = 'X'.
wa_field-edit = 'X'.
APPEND wa_field TO it_field.
CLEAR wa_field.
*Manintainig internal table for sorting
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELP'.
wa_sort-tabname = 'IT_tab'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'. " this works like an T New for this field that is on every new value of this field , Subtotal will get calculated through above field catalog.
APPEND wa_sort TO itab_sort.
CLEAR wa_sort.
Hope it helps you
Regards
Mansi -
Help file is misleading. To restore, I have connected to my Macbook and stat-rted itunes. The screen per the help file does NOT appear on my Macbook itunes software
FORCE IPAD INTO RECOVERY MODE
1. Turn off iPad
2. Turn on computer and launch iTunes (make sure you have the latest version of iTune)
3. Plug USB cable into computer's USB port
4. Hold Home button down and plug the other end of cable into docking port.
DO NOT RELEASE BUTTON until you see picture of iTunes and plug
5. Release Home button.
ON COMPUTER
6. iTunes has detected iPad in recovery mode. You must restore this iPad before it can be used with iTunes.
7. Select "Restore iPad"...
Note:
1. Data will be lost if you do not have backup
2. You must follow step 1 to step 4 VERY CLOSELY.
Maybe you are looking for
-
My client sent out an email campaign to 81 recipients. The campaign generated 25 hard bounces. Is there a way to get more detailed information about the reason for these bounces? We are trying to evaluate this result -- a high rate of hard bounces (o
-
The Status of the Virtual Machine Is "Error"
hi, i using Oracle VM 2.1.2 version while starting the machine,it shows the status as Error when i checked the log for the same,log shows the below error failed:<Exception: return=>failed:<Exception: ['xm', 'create', '/OVS/running_pool/25_srv2vm2_oel
-
Wondering why when you choose 8x10 Photo to print on an 8.5x11 paper its not 8x10. Also wondering why it does not have an 8x10 borderless setting. Using 7410 all in one HP printer and Windows 7 Any one have this same problem?
-
SURVEY: Blend mode options in Brush tool?
This is a survey question for users of all versions of Fireworks. In Fireworks 8, I've noticed a difference in the Brush tool properties depending on whether the selection is an object or a mask-in particular, the Blend mode options do NOT appear in
-
Media Cache issue-how to change save location?
I have CS5 Master Collection on a Win7 Pro 64 bit PC. The C: (System) drive is on an SSD 64 Gb d rive. My problem seems to be that when working on a project in PPro CS5, the folder that Premiere creates to store Media Cache files is located on the Sy