Default row select in ALV
Hi ,
Have a requirement where in all the rows in ALV should be selected defaultly.
Thanks.
Regards,
Suvarna
Hi suvarna,
just add ,
wa_layout-sel_mode = c_a.
this to ur ALV layout.
u will get default selection mode.
here c_a is 'A'.
Regards,
kk.
Similar Messages
-
Default row selected in alv grid
Hi Everyone,
I have couple of alv screens. By default the topmost cell is highlighted in the first grid, the data of second grid is dependant on the first one. So if the topmost record is selected by default in first grid, i want to highlight its corresponding records in the second grid.
How do I achieve this.
Any help on this will be of great use to me.
Thanks in advance,
Prashant.In PAI,
MODULE user_command_9001 INPUT.
REFRESH i_fieldrows.
<b>CALL METHOD o_alvgrid->get_selected_rows
IMPORTING
et_index_rows = i_fieldrows.</b> LOOP AT i_fieldrows INTO w_fieldrows.
READ TABLE i_output INTO w_output INDEX w_fieldrows-index.
ENDLOOP.
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC'.
WHEN 'MD04'.
IF w_output-matnr IS INITIAL.
MESSAGE i001 WITH text-e07.
ELSE.
SET PARAMETER ID 'MAT' FIELD w_output-matnr.
SET PARAMETER ID 'WRK' FIELD w_output-werks.
CALL TRANSACTION 'md04' AND SKIP FIRST SCREEN .
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_9001 INPUT
Similarly in the next screen PAI,
use
CALL METHOD o_alvgrid->set_selected_rows
IMPORTING
et_index_rows = i_fieldrows. -
Using row selection in ALV using class cl_salv
Hi,
how to use row selection by using cl_salv classes...
I need to display scarr table in the basic list in ALV wthout using screens and function modules...
On multiple selection of carrid from ALV, need to display flight details from sflight.
Also how to get the selection buttons for corresponding rows.
NOTE : Using class cl_salv*
Thanks,
SiddarthYou may need to look into Rich's example code by the following thread
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01
a® -
I have an alv that displays data from a few tables.
If I select a row from teh ALV, then the following screen should display some of the fields of the row along with additional information..
I understand that the ON_CLICK event should be used once the row is selected..However, I would appreciate it if someone gave me more info on the same..
Thanks!Hi,
Tray this:
<i> DATA: lr_table TYPE REF TO cl_salv_wd_table_lead_select,
lr_node TYPE REF TO if_wd_context_node,
lv_field1 TYPE (field1 of your alv table ).
lr_table ?= r_param.
lr_node ?= wd_context->get_child_node( 'NODE_TABLE' ).
CALL METHOD lr_node->get_attribute
EXPORTING
index = lr_table->IF_SALV_WD_TABLE_LEAD_SELECT~INDEX
name = 'FIELD1'
IMPORTING
value = lv_field1.
</i>
With this code, you will have the value of the field 1 of the selected row. -
Row Selection in ALV on Single click
Hi
Can we read the row in ALV on row selection ? i set gs_layout-sel_mode = 'D'.
My Scenario is as under
there is an ALV on the screen in which i have displayed the data . there is a push button on the screen. User will select the row and then click the push button. on click of that push button selected row should move to the work area.
I am using following method
CALL METHOD g_Grid->SET_TABLE_FOR_FIRST_DISPLAY
Regards
AmmadIf the method [g_grid->get_selected_rows|http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b55312d30911d2b467006094192fe3/frameset.htm] returns no row, then try a [g_grid->get_current_cell|http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b552fad30911d2b467006094192fe3/frameset.htm] (Don't forget the [cl_gui_cfw=>flush|http://help.sap.com/saphelp_erp2004/helpdata/en/06/3fa1879f2811d2bd68080009b4534c/frameset.htm] to synchronize the automation queue.)
Regards,
Raymond -
HI,
I want to make my ALV Grid only single row select enabled, can some one guide me which variable should be set for the same.
Thanks and Regards,
HarshIf you are using OO for alv then
call method grid1->get_selected_rows
importing
et_index_rows = i_sel_alvrows[].
call method cl_gui_cfw=>flush.
describe table i_sel_alvrows lines v_dbcnt.
if i_sel_alvrows[] is initial.
* Info message : Please select a row
message i176. " Please select a row'.
endif.
if v_dbcnt gt 1.
* Info message : Multiple Row Selection not possible
message i177. " Multiple Row Selection not
" possible'
endif.
or if your using REUSE then
form user_command using p_ucomm type sy-ucomm
rs_selfield type slis_selfield.
" Check the rs_selfield-tabindex value here
" you may get some clue here
endform.
a® -
Row Selection in ALV Grid created using CL_GUI_ALV_GRID
Hi,
I have ALV grid using cl_gui_alv_grid. I want to capture the row selection and display the selected rows in 2nd ALV grid (using cl_gui_alv_grid).
Method CALL METHOD Grid->get_selected_rows giving right no. of selected records first time and process these records by POST button and hence shows these records in next alv grid. but when i came back to 1st ALV by pressing BACK button on 2nd ALV then if I again select records on the same 1st ALV grid the same Method CALL METHOD Grid->get_selected_rows fires again. but this times it wouldn't give the selected records. I mean first time this gives me correct no. of selected records but 2nd time wouldn't.
how do I capture the row selection.?
Kindly suggest me. helpful answer will be appreciated.
Thanx in Advance.
RobinHi,
Write this code, you have to free the container.
MODULE user_command_0101 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
c_container->free( ).
c_container1->free( ). " this is the container of secondary list.
clear: r_grid, r_grid1, c_container, c_container1.
LEAVE TO SCREEN 100.
ENDCASE.
Regards and Best wishes. -
How to set only one row selection in ALV GRID DISPLAY
How to set single row selection in grid display
not multiselection.Hi,
In the USER COMMAND, build the code to check the REFRESHED Data & then check the number of records with SEL = 'X'.
If more than single entry found, then raise an error message.
Best regards,
Prashant -
Detect rows selection in ALV using oops
Hi ALL,
I HAVE An ALV OUTPUT OF RECORDS USING OOPS.
NOW I CAN SELECT ONE OR MULTIPLE ROWS OF THE OUTPUT AND I HAVE ADDED A DELETE ICON TO MY TOOL BAR.
I HAVE BACK AND EXIT BUTTON AND I HAVE CODE FOR THE SAME IN PAI.
FOR DELETE ICON SY-UCOMM IS DELE AND CONTROL COMES TO PAI
MY QUESTION IS HOW DO YOU KNOW WHICH ROW OR ROWS ARE SELETEd , IN NORMAL ABAP , a field BOX type c has a value X , but what about in ALV using OOPS.
I have no idea whether my approach is correct or wrong or do i need to something else.
ThanksHi Darren,
This is what i have . Iam new oops so i want to just make sure
method handle_user_command.
§ 3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
data: lt_rows type lvc_t_row.
case e_ucomm.
when 'DELETE'.
call method g_grid->get_selected_rows
importing et_index_rows = lt_rows.
DATA : WA_LT_ROWS LIKE LINE OF LT_ROWS.
LOOP AT LT_ROWS INTO WA_LT_ROWS.
DELETE I_ZFINAL INDEX WA_LT_ROWS-INDEX.
ENDLOOP.
ENDCASE.
call method g_grid->set_table_for_first_display
exporting
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
is_layout = g_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
it_toolbar_excluding = pt_exclude
IT_HYPERLINK =
IT_ALV_GRAPHICS =
changing
it_outtab = i_zFINAL
it_fieldcatalog = fieldcat
IT_SORT =
IT_FILTER =
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4
LET ME KNOW THANKS -
How to capture row selection in ALV output List
Hi experts,
I am displaying some output using ALV function module. My requirement is i have to capture how much rows user has selected in the output list, based on this information i have to perform some actions.
Please help me
Regards,
SachinHi Sachin,
For this first you have to define a variable in your internal table of type c with length 1 and then while building the layout of the ALV, you have to pass this variable name to the layout field BOX_FIELDNAME.
Now when you select a particular row, then the corresponding field in your internal table willl be marked with X. So, for further processing, you can just loop through the table where 'BOX = 'X' and proceed.
For Example:
* Structure for output details
TYPES: BEGIN OF gs_output.
INCLUDE STRUCTURE zas_water_qlty_rep.
TYPES: selected(1) TYPE c,
END OF gs_output.
DATA: object_tab TYPE STANDARD TABLE OF gs_output.
CONSTANTS: lc_selected(8) TYPE c VALUE 'SELECTED'.
lw_layout-box_fieldname = lc_selected. "Field for checkbox
* Local workarea
DATA: lw_layout TYPE slis_layout_alv.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = gc_x
i_bypassing_buffer = gc_x
i_callback_program = lv_repid
i_callback_pf_status_set = g_form_set_pf_stat
i_callback_user_command = lc_uform
i_structure_name = lv_zas_water_qlty_rep
is_layout = lw_layout
it_fieldcat = g_fieldcat_tab[]
it_events = g_events_tab[]
it_event_exit = g_event_exit_tab[]
TABLES
t_outtab = p_object_tab
EXCEPTIONS
program_error = 1
OTHERS = 2.
Hope this helps.
Regards,
Phani. -
No default row selected in af:table
Hello,
I need no selected row displaied by default on initial rendering of an af:table with single selection enabled.
The reason is that the af:table has a selection listener associated. If a row is selected by default, then the user cannot select the row again to perform an action on it.
I don't want this.
Is there a way to render a table without any selected row by default?have a binding to the table in the managed bean.. with getter and setters.. and in the getter have it like
RichTable tableBidding;
public RichTable getTableBinding(){
if(tableBinding != null){
tableBinding.getSelectedRowKeys().clear();
return tableBinding; -
Default row dislay in ALV Webdynpro ABAP
Hi ,
I have designed an alv webdynpro table with some records.
But in out put i want to dispaly max 10 rows default.
can anybody tell me the code or the solution?
Thanks
Rakshar.Hi rakesh .
All thye ALV table settings are handeled by the if_salv_wd_table_settings interface you can get the reference of it and you can do setting as per your requirement
*------- Get Model--------
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = l_ref_interfacecontroller->get_model( ).
*---------- ALV table settings.
DATA: l_table_settings TYPE REF TO if_salv_wd_table_settings .
l_table_settings ?= lo_value.
*--------Setting row count
l_table_settings ->if_salv_wd_table_settings~set_visible_row_count( 10 ).
Regards
Chinnaiya P -
Hi
I have a requirement in FM ALV where I have a search box and the user can search for criteria. I then search my underlying data table and if the data is found I want to put the row focus on the particular row. How do I set row focus in FM ALV?
Example:
User searches for PERNR 778.
778 is found at SY-TABIX 440. I now want the ALV to focus on row 440.Hi Brad,
Try this way. It works. I have developed sample program for you. Change your program accordingly.
<pre>REPORT zvenkat_alv_list.
DATA: BEGIN OF i_mard OCCURS 0,
color(3) TYPE c, "color
werks TYPE mard-werks,
lgort TYPE mard-lgort,
matnr TYPE mard-matnr,
insme TYPE mard-insme,
einme TYPE mard-einme,
speme TYPE mard-speme,
END OF i_mard.
Types Pools
TYPE-POOLS:
slis.
Types
TYPES:
t_fieldcat TYPE slis_fieldcat_alv,
t_events TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
Workareas
DATA:
w_fieldcat TYPE t_fieldcat,
w_events TYPE t_events,
w_layout TYPE t_layout.
Internal Tables
DATA:
i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
i_events TYPE STANDARD TABLE OF t_events.
START-OF-SELECTION.
PERFORM get_data_from_database .
PERFORM build_fieldcatalog.
w_layout-info_fieldname = 'COLOR'. "color
PERFORM display_data.
*& Form get_data_from_database
FORM get_data_from_database .
CLEAR :i_mard,i_mard[].
SELECT werks lgort matnr insme einme speme
FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_mard
UP TO 100 ROWS.
ENDFORM. " get_data_from_database
*& Form build_fieldcatalog
FORM build_fieldcatalog .
CLEAR :w_fieldcat,i_fieldcat[].
PERFORM build_fcat USING:
"Field Int Tab Text
'WERKS' 'I_MARD' 'WERKS',
'LGORT' 'I_MARD' 'LGORT',
'MATNR' 'I_MARD' 'MATNR',
'INSME' 'I_MARD' 'INSME',
'EINME' 'I_MARD' 'EINME',
'SPEME' 'I_MARD' 'SPEME'.
ENDFORM. " build_fieldcatalog
*& Form display_data
FORM display_data .
DATA :program LIKE sy-repid VALUE sy-repid.
SORT i_mard BY werks.
DELETE ADJACENT DUPLICATES FROM i_mard COMPARING werks.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = program
i_callback_user_command = 'USER_COMMAND'
is_layout = w_layout
it_fieldcat = i_fieldcat
it_events = i_events
TABLES
t_outtab = i_mard.
ENDFORM. " display_data
*& Form BUILD_FCAT
FORM build_fcat USING l_field l_tab l_text.
w_fieldcat-fieldname = l_field.
w_fieldcat-tabname = l_tab.
w_fieldcat-seltext_m = l_text.
IF l_field = 'WERKS'.
w_fieldcat-hotspot = 'X'.
ENDIF.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " BUILD_FCAT
*& Form USER_COMMAND
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
IF r_ucomm = '&IC1'.
READ TABLE i_mard WITH KEY werks = rs_selfield-value.
IF sy-subrc = 0.
i_mard-color = 'C31'.
MODIFY i_mard INDEX sy-tabix.
ENDIF.
rs_selfield-refresh = 'X'.
ENDIF.
ENDFORM. "USER_COMMAND</pre>
Thanks
venkat.O -
Hi All.
I am trying to set multiple selection on in ALV using the method SET_SELECTION_MODE of IF_WD_SELECT_OPTIONS. (if_salv_wd_table_settings)
But it is always resulting in a dump saying that :
Selection type Multi is not allowed in combination with the selection Single of the data node
Now how can we change the context of the ALV?
What am i doing wrong here?
Thanks.Hi this works fine here:
data: lr_table_settings type ref to if_salv_wd_table_settings.
lr_table_settings->set_read_only( abap_false ).
lr_table_settings->set_enabled( abap_true ).
lr_table_settings->set_selection_mode( CL_WD_TABLE=>e_selection_mode-multi ).
The node i bound to the ALV has selection 0..n.
Cheers,
Sascha -
Get Selections From ALV on Multiple Selection Mode
Hi,
How can i get values of selected rows from ALV that has selection '0..n' (multiple selection) ?
Can somebody help me pls?
Thanks.Hi Nurullah,
Steps to make multiple rows selectable in ALV:
1) Create the selection property of the node that you are binding to the DATA node as o..n
2) Un-check the, "Initialization Lead Selection" checkbox for the node which you are using to bind to the DATA node
3) In the WDDOINIT method specify the ALV's selection mode as MULTI_NO_LEAD. It is important that you set the selection mode to MULTI_NO_LEAD or else in the end you would be capturing 1 row lesser than the total number of rows the user has selected. This is because 1 of the rows would have the LeadSelection property & our logic wouldnt be reading the data for that row. Check the example code fragment as shown below:
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model( ).
CALL METHOD lo_value->if_salv_wd_table_settings~set_selection_mode
EXPORTING
value = cl_wd_table=>e_selection_mode-MULTI_NO_LEAD.
Steps to get the multiple rows selected by the user
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. Check the example code fragment below:
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
-
Intercompany Stock transfer for KMAT configurable material
Hi All I have a scenario in which we do intercompany sale of machines which is KMAT - configurable. company A & B , company B's customer raises a order... this raises a order in Company A , and producion in A takes place , and material is created as
-
Hi to the Mac Folks, I have 10.6.8 and have installed two new printers HP 8610 and an Epson 7880 and can not find the Page Set-up menu anywhere in the applications I a trying to print from. This is regardless of either printer selected. I primarily p
-
Separate clip flashing at the beginning of each clip
Each clip I insert into my sequence has a brief flash of another clip at the beginning of it. When I select the clip and trim the unwanted piece away, the unwanted piece simply shifts to the the next available point on the clip. This repeats for ever
-
Differences between jdeveloper&jbuilder
Hello everybody!!!! I'm trying to understand the difference between jdeveloper&jbuilder but.....no result!!! I would develop a project wich should connecting on Oracle database and making statistics with data (it have been stored from file with SQLLO
-
I've somehow managed to screw up my installation and so far uninstalling/reinstalling (both the SAP GUI 6.4 and Office 2003) hasn't helped. My problem is that when I open anything in BEx Analyzer and hit Refresh Query, the box that pops up normally