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 PM
Hi,
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
Similar Messages
-
Hi,
I have created an application that uses a web dynpro alv grid. I want to display totals - is there a setting that can do this automatically - if so, can you please tell me how to do this? Thanks,Hi
You can take help of following code snippet to create totals for a particular column
Data: lr_function_settings TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lt_column type salv_wd_t_column_ref,
ls_column type salv_wd_s_column_ref.
Data: lr_field_amnt type REF TO CL_SALV_WD_FIELD.
* get reference of ALV component
lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_EARNED_ALV( ).
wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
* get function settings
lr_function_settings ?= wd_this->alv_config_table.
* display columns in correct order
lr_column_settings ?= wd_this->alv_config_table.
lt_column = lr_column_settings->get_columns( ).
loop at lt_column into ls_column.
CASE ls_column-id.
when 'AMOUNT'
* aggregate field
CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_FIELD_SETTINGS~GET_FIELD
EXPORTING
FIELDNAME = 'AMOUNT'
RECEIVING
VALUE = lr_field_amnt.
* create aggregate rule as total
CALL METHOD LR_FIELD_AMNT->IF_SALV_WD_AGGR~CREATE_AGGR_RULE
EXPORTING
AGGREGATION_TYPE = IF_SALV_WD_C_AGGREGATION=>AGGRTYPE_TOTAL
RECEIVING
VALUE = lv_aggr_rule.
endcase.
Regards
Manas DUa -
Web Dynpro ALV grid filter on date
Hi,
I want to set a "view" on my web dynpro alv grid that uses the current date. Is there a way to specify the current date in the filter values? Thanks,
SamirThanks Thomas. I will certainly look into using POWL in the future.
A related question - Its possible to use a filter by entering something like " .01. " but it doesnt seem to allow me to save that value as its not a date. Is there any way around this? Thanks -
Web Dynpro ALV grid column width
Hi,
I have a web dynpro alv grid that has columns titles that are long. What is the best way of displaying the data without taking up too much space with the titles?
For example is it possible to wrap the title into 2 or 3 rows
Thanks,
SamirHi,
DATA: lr_column type ref to cl_salv_wd_column,
lr_colheader type ref to cl_salv_wd_column_header.
CALL METHOD lrcolumn->get_header
RECEIVING
value = lr_COLHEADER.
lr_COLHEADER->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_short ).
Refer this if_salv_wd_c_ddic_binding in se24 for more.
Regards,
Lekha. -
Web Dynpro ALV grid column colour
Hi,
I have tried to set the colour of a column for my web dynpro alv with the below code but it the colour for this column has not changed - it seems to remain the standard colour. Is there something else i need to do?
DATA: lt_columns TYPE salv_wd_t_column_ref
, ls_columns TYPE salv_wd_s_column_ref
, lr_column TYPE REF TO cl_salv_wd_column
lt_columns = lo_value->if_salv_wd_column_settings~get_columns( ).
LOOP AT lt_columns INTO ls_columns.
IF ls_columns-id CS 'TOTAL_'.
lr_column = ls_columns-r_column.
lr_column->set_cell_design( cl_wd_abstr_master_table_col=>e_cell_design-positive ). "CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-GROUP_LEVEL1
ENDIF.
ENDLOOP.Hi Samir,
You will have to create an attribut WDUI_TABLE_CELL_DESIGN and bind this attribute with the cell design property of the column. Check this wiki link [https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP%20Web%20Dynpro%20ALV%20-%20Change%20Cell%20Colour%20based%20on%20Content], it will solve your issue.
Regards,
Radhika. -
Web Dynpro ALV grid equivalent of onLeadSelect
Hi,
I am new to web dynpro alv and would like to know how to implement the equivelent of the action onLeadSelect that you can do with a table UIElement, but I want to do this for the ALV table that I have. Many thanks,
SamirHi,
Go to the View's property tab and include you ALV in that.
whenever you instantiate the ALV then in the view, METHODS tab, you can find the Event handler for the lead selection for that ALV. Implement that.
Method name Method type Event
ONLEADSELECT Eventhandler ON_LEAD_SELECT
Check out the links -
Re: click event on ALV
http://www.flickr.com/photos/31042772@N08/3408386623/
Regards,
Lekha -
Hi,
I have a web dynpro alv table that has many columns (about 20) I would like it to be displayed so that the user does not have to scroll right to see all the data.
at the moment columns:
col1 col2 col3 ......col19 col20
i would like the second half of the table under the 1sta half:
col1 col2 col3...col9 col10
col11 col12...col19 col20
Is there any way that i can get the table to be split into two or some other nice way to display without scrolling?You won't be able to do this with a single ALV. I suppose you could have two ALVs and bind them both to the same context. You wouldn't be able to sync the veritcal scrolling between the the two ALVs however. I'm also not sure how usage this design is from a UI design pattern. I would think the acceptible approach would be to use horizontal scrolling within the ALV. You don't have to make the ALV display all columns at once as this can make your entire page very wide and require using the browser scrolling. Instead consider using the set_scrollable_col_count method.
-
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 -
Action on selected row in Web dynpro ALV grid
Hello,
i'm pretty new on web dynpro development, and i need some help.
I have a working grid alv and i would like to create an event when i select a row (not editable).
I have looked around and didn't find anything interesting.
Do you have a solution?
Thanks a lot.
CedricHi.,
U have to use onLeadSelection Event Handler.,
Check this tutorial.,: [ALV onLead Selection another ALV|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/7020c76f-c40e-2e10-a795-d88e67740ee4?quicklink=index&overridelayout=true]
hope this helps u.,
Thanks & Regards
Kiran. -
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. -
Filter in web dynpro ALV grid error
The filter in the ALV web dynpro seems to work like *<condition>*. let's say if you have 4 entries in the table 30,230,300,1230 applying the filter value '30' will select all of them making the filter function virtually useless.
Is there a way to change how the filter works?Dear Stanley,
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/63a47dd9-0b01-0010-3d8e-de27242bf011
Regards,
Flavya -
WEB DYNPRO ALV GRID : CELL CONTENT - Initial Value
I created a sort of 'Timesheet' in web dynpro...
Unfortunatly, for all days of the month it displays '0.00' as initial value...
Is it possible to not display this initial value or display space/empty ?
In gui alv it is possible, I don't know if it could be done in web dynproHi,
For the node to which the ALV is bound. For the column (context attribute) check the property of the attribute check the formatting propertioes as ZEROS AS BLANKS
for ex: price is the context attrbiute check the properties.
This FORMATTING options for the context attribute is found in the latest verions like EHP4.
Regards,
Lekha. -
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%) -
Web Dynpro ALV grid navigation problems when entry is selected
Hi,
We have implemented support packs 19 and 20 and following this, we are having the following side effect :
When you click on an entry within an alv grid, it does not navigate to the next screen. It worked fine before the service packs, please advise if you have any suggestions as to how we can get it to work again!? Thanks in advance.
When I click, the debug does not event go to the ON_LEAD_SELECT event.
Edited by: James Wilson on Dec 10, 2009 3:52 PMHi Samir,
I think possibly you have other code which is relying on a lead selection being set in the context that you have provided to the ALV grid?
And it is that code that is falling over?
In this case I think you need to handle in that other code the possibility that the user/ALV grid will unselect all entries in the table.
Or am I misunderstanding your issue? Please do let us know,
Thanks,
Chris -
WEB DYNPRO ALV GRID GET SELECTED ROWS...
I'm reusing component ALV Grid ...
How can i get selected rows...Hi Stephan,
In order to get the multiple rows which were selected by the user you will just have to call the get_selected_elements method of if_wd_context_node. So as you can see its no different from how you would get the multiple rows selected by the user in a table ui element. First get the reference of the node which you have used to bind to the ALV & then call this method on it.
METHOD get_selected_rows .
DATA: temp TYPE string.
DATA: lr_node TYPE REF TO if_wd_context_node,
wa_temp TYPE REF TO if_wd_context_element,
ls_node1 TYPE wd_this->element_node_flighttab,
lt_node1 TYPE wd_this->elements_node_flighttab.
lr_node = wd_context->get_child_node( name = 'NODE_FLIGHTTAB' ).
" This would now contain the references of all the selected rows
lt_temp = lr_node->get_selected_elements( ).
LOOP AT lt_temp INTO wa_temp.
" Use the references to get the exact row data
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_node1.
APPEND ls_node1 TO lt_node1.
CLEAR ls_node1.
ENDLOOP.
ENDMETHOD.
Hope this helps resolve your problem.
Regards,
Uday
Maybe you are looking for
-
EXport Jitter for H.264
I am hoping someone can help because I am baffled... I create a project in CS5 using P2 footage shot from an HVX200 camera - 1280x720 - 29.97fps. The footage appears as 960x720 in project. I finished the project and hit File-Export-Media. In the enco
-
How do I recover .emix messages into Mail app?
I wanted to rebuild my mailbox because of some issues I was having with a rule not catching all the files I thought it should. I am using 4 POP accounts all on the same smtp server. I have 10s of thousands of messages so I knew it might take some tim
-
Hello We have a profiling policy for a firm XP device, and I am tring to see each if it passes the 6 rules that we have I am. this is forour legacy machines which we will kill when xp dies and all new machines will have dot1x configured.
-
SP2-0575: Use of Oracle SQL feature not in SQL92 Entry Level.
Hi, When I tried to login I am able to login but getting the following message:SP2-0575: Use of Oracle SQL feature not in SQL92 Entry Level. After loging, when I tried to "SELECT SYSDATE FROM DUAL;" I am getting the following error. ORA-00942: table
-
Hi, I want to add some information in RTP Packet, (in Extensions Header). How can I do that in JMF ? Thanks in Advance, Karthikeyan R