ALV Grid multiple row selection, disabling some
Does anyone know if it is possible to have an ALV grid with multiple row selection allowed but for some rows the row selection is disabled?
Kind regards,
John.
Hi John,
You can add a check box and select multiple rows. I am using the same technique. I have used OO.
a) Use Even handler "Double Click"
b)Using "SELECT_ALL_ENTRIES CHANGING PT_OUTTAB TYPE STANDARD TABLE" and I am sorting based Check box selection.
Need more help please let me know. I will send you the code.
Lanka
Message was edited by: Lanka Murthy
Similar Messages
-
ALV Grid Single Row Selection Only
Hi,
I have a requirement to select a single row in an ALV grid using class
I tried with layout-sel_mode = 'B' its not working, and don't want to use
call method g_grid->get_selected_rows
importing
et_row_no = lt_row_no.
and check for number of rows and giving error message " select only one row".
Is there any other way to tackle this issue
Thanks
aRsHi,
DATA:
* Internal table for indexes of selected rows
gi_index_rows TYPE lvc_t_row,
* Information about 1 row
g_selected_row LIKE lvc_s_row.
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
DESCRIBE TABLE gi_index_rows LINES l_lines.
Here the L_Lines will contain the number of rows selected
Regards
Sudheer -
Help req : alv grid with multiple row selection
Hi all sap gurus,
i have a alv list display program , in which i can select the o/p rows(multiple rows)
and perform some actiom based on some icons .
now i have to convert this in to grid display
this is initial code i.e for list
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE ztest.
DATA : checkbox type c.
DATA : END OF itab.
s_layout-box_fieldname = 'CHECKBOX'.
ty_events-name = slis_ev_top_of_page.
ty_events-form = 'TOP_OF_PAGE'.
APPEND ty_events TO it_events.
ALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'ITAB'
i_inclname = v_repid
CHANGING
ct_fieldcat = build_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'ITAB'
is_layout = s_layout
it_fieldcat = build_fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = 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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab
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 user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm = 'DELE'.
LOOP AT iTAB WHERE CHECKbox = 'X' .
ENDLOOP.
MODIFY ztEST FROM TABLE itAB.
ENDIF.
selfield-refresh = 'X'.
ENDFORM.
NOW I HAVE A LIST O/P WHERE I CAN SELECT THE BOX AND CLICK DELETE ICON.
NOW I WANT TO CHANGE TO GRID, SO I KEPT EVERYTHING SAMRE AND I CHANGED " LIST" TO "GRID"
NOW TWO THINGS HAPPEND
1) I SEE A EMPTY COLUMN IN THE O/P , I GUESS THATS BECAUSE CHECKBOSX IN INTERNAL TABLE , SO I REMOVED IT
SO THIS MADE ME TO REMOVE
IF ucomm = 'DELE'.
LOOP AT iTAB." WHERE CHECKbox = 'X' .------PROBLEM
ENDLOOP.
MODIFY ztEST FROM TABLE itAB.
ENDIF.
selfield-refresh = 'X'.
NOW I DON'T SEE THE EMPTY COLUMN , BUT NOW PROBLEM IS I CANNNOT DISTINGUISH AS TO WHICH IS SELECTED AND AT ANY POINT OF TIME I CANSELECT ONLY ROW.
ALL I WANT IS
1) I WANT TO SELECT MULTIPLE ROWS AND SHOULD BE ABLE TO KNOW WHICH ROWS WERE SELECTED IN THE O/P SCREEN.
IN THE LIST DISPLAY I HAD CHECKBOX = 'X' FOR ALL THE ROWS THAT WERE SELECTED , I WANT THE SIMILAR THING in grid display
LET ME KNOW whether this can be done without USING 00 LANG.
thanksHi Swati,
Below code might help full for you. Description: is It selects multiple rows from ALV and display it on the next ALV.
*************************Reward Point If help full********************************************
*& Report z7cc_alv_oops_show_next_alv *
*& DEVELOPERS NAME : CHIDANAND CHAUHAN
*& DATE: SATURDAY 08-07-2006
*& DESCRIPTION: TO CREATE AN OBJECT ORIENTED ALV
REPORT z7cc_alv_oops_show_next_alv MESSAGE-ID z5hs .
DATA : BEGIN OF it_mara OCCURS 0,
mark TYPE flag,
matnr TYPE matnr,
mtart TYPE mtart,
meins TYPE meins,
END OF it_mara.
DATA : BEGIN OF it_mara1 OCCURS 0,
* mark type flag,
matnr TYPE matnr,
mtart TYPE mtart,
meins TYPE meins,
END OF it_mara1.
DATA : BEGIN OF it_mara2 OCCURS 0,
* mark type flag,
matnr TYPE matnr,
mtart TYPE mtart,
meins TYPE meins,
END OF it_mara2.
DATA : t_fieldcat TYPE lvc_t_fcat,
t_fieldcat1 TYPE lvc_t_fcat,
s_fieldcat LIKE LINE OF t_fieldcat.
DATA : s_layout TYPE lvc_s_layo.
DATA : control TYPE REF TO cl_gui_custom_container,
grid TYPE REF TO cl_gui_alv_grid.
DATA: BEGIN OF wa ,
mark TYPE flag,
matnr TYPE matnr,
mtart TYPE mtart,
meins TYPE meins,
END OF wa.
* CLASS lcl_events_box DEFINITION
CLASS lcl_events_box DEFINITION.
PUBLIC SECTION.
METHODS :
*Handler_Data_Changed for event Data_Changed of cl_gui_alv_grid
*imporTing er_data_changed,
handler_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
handler_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive.
ENDCLASS. "lcl_events_box DEFINITION
* CLASS lcl_events_box IMPLEMENTATION
CLASS lcl_events_box IMPLEMENTATION.
* method to handle the user command.
METHOD handler_user_command.
PERFORM form_usercommand CHANGING e_ucomm.
ENDMETHOD. "Handler_user_command
*& Mehod to handle the toolbar.
METHOD handler_toolbar.
PERFORM form_toolbar CHANGING e_object e_interactive
e_object->mt_toolbar.
ENDMETHOD. "Handler_ToolBar
ENDCLASS. "lcl_events_box IMPLEMENTATION
START-OF-SELECTION.
DATA : w_events TYPE REF TO lcl_events_box.
SELECT matnr mtart meins FROM mara INTO CORRESPONDING FIELDS OF TABLE
it_mara.
CALL SCREEN 100.
*& Module pbo_module OUTPUT
* text
MODULE pbo_module OUTPUT.
IF grid IS INITIAL.
CREATE OBJECT control
EXPORTING
container_name = 'CUST_CTRL'.
CREATE OBJECT grid
EXPORTING
i_parent = control.
PERFORM build_catalog.
PERFORM build_catalog1.
PERFORM build_layout.
CALL METHOD grid->set_table_for_first_display
EXPORTING
is_layout = s_layout
CHANGING
it_outtab = it_mara[]
it_fieldcatalog = t_fieldcat.
CREATE OBJECT w_events.
SET HANDLER : w_events->handler_toolbar FOR grid,
w_events->handler_user_command FOR grid.
CALL METHOD grid->set_toolbar_interactive.
ELSE.
CALL METHOD grid->refresh_table_display.
ENDIF.
ENDMODULE. " pbo_module OUTPUT
*& Form BUILD_CATALOG
FORM build_catalog .
s_fieldcat-col_pos = '1'.
s_fieldcat-fieldname = 'MARK'.
s_fieldcat-checkbox = 'X'.
s_fieldcat-edit = 'X'.
APPEND s_fieldcat TO t_fieldcat.
CLEAR s_fieldcat.
s_fieldcat-col_pos = '2'.
s_fieldcat-fieldname = 'MATNR'.
s_fieldcat-scrtext_m = 'MATERIAL'.
APPEND s_fieldcat TO t_fieldcat.
s_fieldcat-col_pos = '3'.
s_fieldcat-fieldname = 'MTART'.
s_fieldcat-scrtext_m = 'MATERL TYPE'.
APPEND s_fieldcat TO t_fieldcat.
s_fieldcat-col_pos = '4'.
s_fieldcat-fieldname = 'MEINS'.
s_fieldcat-scrtext_m = 'UOM'.
APPEND s_fieldcat TO t_fieldcat.
ENDFORM. " BUILD_CATALOG
*& Form BUILD_LAYOUT
* text
* --> p1 text
* <-- p2 text
FORM build_layout .
s_layout-zebra = 'X'.
* S_LAYOUT-CWIDTH_OPT = 'X'.
s_layout-grid_title = 'Material Details'.
ENDFORM. "BUILD_LAYOUT
" BUILD_LAYOUT////////////////////////////////////
" USER_COMMAND_0100 INPUT
*& Form FORM_USERCOMMAND
* text
* <--P_E_UCOMM text
FORM form_usercommand CHANGING p_e_ucomm.
CASE p_e_ucomm.
WHEN 'INT1'.
DO.
READ TABLE it_mara INDEX sy-index TRANSPORTING mark matnr.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF it_mara-mark = 'X'.
READ TABLE it_mara INTO wa TRANSPORTING matnr mtart meins .
MOVE-CORRESPONDING wa TO it_mara1.
READ TABLE it_mara1 TRANSPORTING matnr mtart meins .
MOVE-CORRESPONDING it_mara1 TO it_mara2.
APPEND it_mara2.
CALL METHOD grid->set_table_for_first_display
EXPORTING
is_layout = s_layout
CHANGING
it_outtab = it_mara2[]
it_fieldcatalog = t_fieldcat1.
* SET PARAMETER ID 'MAT' FIELD IT_MARA-MATNR.
* CALL TRANSACTION 'MM02'.
ENDIF.
* ENDIF.
ENDDO.
ENDCASE.
ENDFORM. " FORM_USERCOMMAND
*& Form FORM_TOOLBAR
* text
* <--P_E_OBJECT text
* <--P_E_INTERACTIVE text
* <--P_E_OBJECT_>MT_TOOLBAR text
FORM form_toolbar CHANGING p_e_object TYPE REF TO
cl_alv_event_toolbar_set
p_e_interactive
mt_toolbar TYPE ttb_button.
DATA wal_button TYPE stb_button.
*WAL_BUTTON-ICON = ICON_status_reverse.
wal_button-text = 'GO'.
wal_button-quickinfo = 'PROCEED'.
wal_button-function = 'INT1'.
wal_button-butn_type = 0.
wal_button-disabled = space.
INSERT wal_button INTO p_e_object->mt_toolbar INDEX 1.
ENDFORM. " FORM_TOOLBAR
*& Module PF-STATUS OUTPUT
* text
MODULE pf-status OUTPUT.
SET PF-STATUS 'Z7CCSTAT'.
ENDMODULE. " PF-STATUS OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_CATALOG1
* text
* --> p1 text
* <-- p2 text
FORM build_catalog1 .
s_fieldcat-col_pos = '1'.
s_fieldcat-fieldname = 'MATNR'.
s_fieldcat-scrtext_m = 'MATERIAL'.
APPEND s_fieldcat TO t_fieldcat1.
s_fieldcat-col_pos = '2'.
s_fieldcat-fieldname = 'MTART'.
s_fieldcat-scrtext_m = 'MATERL TYPE'.
APPEND s_fieldcat TO t_fieldcat1.
s_fieldcat-col_pos = '3'.
s_fieldcat-fieldname = 'MEINS'.
s_fieldcat-scrtext_m = 'UOM'.
APPEND s_fieldcat TO t_fieldcat1.
ENDFORM. " BUILD_CATALOG1 -
Disabling multiple row selection in JTable
hi,
I have a JTable and I want to disable the multiple row selection.
I used
getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);and this working fine with ctr+clicking on a row
but if i am using shift key instead of Ctrl key multiple selection is possible....
Any idea y?and how to resolve it??
thnx
~neelUse table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);I don't know if it differs but I use it and I don't have the problems you describe. Might be a bug in your Java version?!
Message was edited by:
pholthuizen -
Handle multiple rows selection on Matrix
Hi all,
i'd like to know if someone could help me with multiple selections on matrix via shift + left mouse button on a matrix.
I got a matrix with one column containing a checkbox for selection. The matrix, on a UDO Form, is defined as auto selecting, so multiple selection of rows is allowed.
I want to add the rows selected by the checkbox (using shift + left mouse button on the selection start and selection end) column to the matrix selected rows collection.
Is there any chance to catch an event handling this situation?
I can add the rows in the matrix selected rows collection clicking the checkboxes one by one, but when i use the multiple selection i can't get any event handling this.
I know i couldn't use the checkbox for the selection and use instead the native function of sap b1 matrix., but this way is faster (and more clear, because you see the check when a row is selected) when you have multiple rows selected one by one
I hope i've been clear enough, and hope somene can give me an hint.
Thanks in advance.Hi Cesidio,
if I understand you correctly you want to select one row than shift+mouseclick some rows lower and the result should be, that all rows are selected ?
You can achieve this by catching the itempressed event and querying pVal.Modifiers.
This is an example for Grid :
private void Grid0_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
if (pVal.Modifiers == SAPbouiCOM.BoModifiersEnum.mt_SHIFT)
int lastRowSelected =Grid0.Rows.SelectedRows.Item(Grid0.Rows.SelectedRows.Count-1,SAPbouiCOM.BoOrderType.ot_RowOrder);
if (lastRowSelected < pVal.Row)
for (int i = pVal.Row; i > lastRowSelected; i--)
Grid0.Rows.SelectedRows.Add(i);
regards,
Maik -
Multiple row select for table not working..
Hi Experts,
I have a table in ABAP Web Dynpro where I have enabled the multiple row select functionality. I can select all and deselect all. I can also select a block of adjacent rows of table by choosing first and last by pressing Shift key.
But I am not able to select multiple individual records for that table.
I tried the same thing in different system and it works fine there.
Please let me know if we are missing some standard plugin or we need to enable this in some settings.
System where the issue is:
SAP_APPL: release 600, level 18
SAP_BASIS: Release 700, level 22
System where it is working fine:
SAP_APPL: release 604, level 8
SAP_BASIS: release 701, level 8
Regards,
Anand KolteHi
Press CTRL key and Select records, you can select multiple records, continuously or randomly your desired selection.
Cheers,
Kris. -
Multiple row selection in ADF Table using addition column with checkbox
I am using ADF table(Jdeveloper11g) and i want to selecte multiple rows it may be more than one OR all rows.
For that i added one Column to the table with Header Delete and checkbox
<af:table....
<af:column sortProperty="Delete" headerText="Delete" width="100"
sortable="false">
<af:selectBooleanCheckbox label="#{row.favoriteId}"
valueChangeListener="#{Mybean.onCheck}"
id="checkbox" autoSubmit="true">
</af:selectBooleanCheckbox>
</af:column>
</af:table>
backing bean:Here i added code to get Value of one column with id favoriteId and use an arrayList(listForDelete) to monitor the state of the checkboxes
public void onCheck(ValueChangeEvent valueChangeEvent) {
BindingContainer bindings = getBindings();
DCBindingContainer dcBindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iterBind =
(DCIteratorBinding)bindings.get("getUserFavoritesByUserIDIterator");
if (iterBind != null && iterBind.getCurrentRow() != null) {
RichSelectBooleanCheckbox ch = (RichSelectBooleanCheckbox)valueChangeEvent.getSource();
if (!ch.isSelected()) {
Long issueId = (Long)iterBind.getCurrentRow().getAttribute("favoriteId");
listForDelete.add(issueId);
else
Long issueId = (Long)iterBind.getCurrentRow().getAttribute("favoriteId");
listForDelete.remove(issueId);
Problem is that when i select single row checkBox, onCheck() method of backing bean gets called multiple times(equals to the number of rows)
I think this is beacuse of <af:selectBooleanCheckbox id is same that is "checkbox" but i am not sure.Even i tried to assign some unique id but no any success in assigning Id with value Expression.
I also find related post
Re: ADF Table Multiple row selection by Managed Bean
but that is related to Select All rows or Deselect all rows from table.
From the simillar post i follow the steps given by Frank.but problem with below step
->have an af:clientAttribute assigned to the checkbox with the following EL #{row.key} ,here I added <af:clientAttribute name="#{row.key}"></af:clientAttribute> and i am getting error
Error(64,37): Static attribute must be a String literal, its illegal to specify an expression.
Please let me know if any one had already implemented same test case.
Thanks for all help
Jaydeep
Edited by: JaydeepJ on Aug 7, 2009 4:42 AMjust to update after the rollback is called in the cancel button i wrote following code which does not change the row focus to the first row
DCBindingContainer bc =
(DCBindingContainer)BindingUtils.getBindingContext().getCurrentBindingsEntry();
DCIteratorBinding profItr =
bc.findIteratorBinding("ProfileSearchInstIterator");
Row cRow = profItr.getRowAtRangeIndex(0);
if(cRow != null){
System.out.println("Current row is not null so fixed ");
profItr.setCurrentRowIndexInRange(0);
RowKeySetImpl rks = new RowKeySetImpl();
ArrayList keyList = new ArrayList();
keyList.add(cRow.getKey());
rks.add(keyList);
profileTable.setSelectedRowKeys(rks);
AdfFacesContext.getCurrentInstance().addPartialTarget(profileTable);
} -
Multiple rows selection handling in Tableview
Hi guys,
..Good morning ..
I have developed one page for displaying Employees(pernr and Ename) under CEO/VP/Managers using <b>TableView</b>.
Here i have some difficulties.
<b>1.</b> I managed to show Multiple row selection menu
(Selectall/deselectall) right upper corner of
Tableview. but i can also select multiple rows not all
at a time .So in this case ,those selected employees
Overtime amount i want to show in the next page.here
my question is How do i capture selected rows(not all
at a time).
I am using this code ..
<htmlb:tableView id = "tvX"
headerText = "Employee List"
headerVisible = "true"
idth = "30%"
selectedRowKeyTable = "<%= selectedRowKeyTable %>"
onRowSelection = "MyEventRowSelection"
sort = "server"
keepSelectedRow = "TRUE"
selectionMode = "MULTISELECT"
table = "<%= i_emp_1 %>" >
<htmlb:tableViewColumns>
<htmlb:tableViewColumn columnName = "pernr"
width = "10"
sort = "server"
horizontalAlignment = "center"
title = "Emp No"
type = "TEXT" >
</htmlb:tableViewColumn>
<htmlb:tableViewColumn columnName = "ename"
width = "40"
sort = "server"
horizontalAlignment = "center"
title = "Emp Name"
type = "TEXT" >
</htmlb:tableViewColumn>
</htmlb:tableViewColumns>
</htmlb:tableView>
<b>2</b>. How to send one Itab data from one page to
another page.Presently i am using EXPORT/IMPORT
statements.Is this right way or any other method is
there for?.
Could you please look in to this ..
<b>Best regards,
Venkat.O</b>Hi Venkataiah,
See page <b>TableViewMultiSelect.bsp</b> in BSP application SBSPEXT_TABLE.
There is an attribute <b>selectedRowIndexTable</b> in tableView element. you have to assign a table of type INT4_TABLE, and you can fill this table by table_event->PREVSELECTEDROWINDEXTABLE in OnInputProcessing event. For more details see the above mentioned bsp application.
To Export/Import is ok, you can use server-side cookies also, But best way is using model binding. Learn MVC for that.
Hope it solves your problem.
Regards,
Narnder Hartala -
ADF multiple row selection using checkbox
One of the basic feature missing in ADF 11g is multiple row selection using checkbox (ADF supports multiple row selection by CTRL+CLICK) and business users doesn't like the idea of CTRL+CLICK especially when the volume of click is more. Our requirement is to show the records as selected, on click of checkbox. We implemented multiple row selection by giving a checkbox and on submission, iterate all the rows and filter only selected rows for further processing. The approach works fine,but it is very slow when the volume of data is more, say 10 thousand rows. For 4 thousand records, iterating everything takes more than 200 secs !
Had the multiple row selection been the ADF standard way using CTRL+CLICK, and retrieving the selected rows using method theTable.getSelectedRowKeys() works much faster (completes in millisecs for 4 thousand records). Somehow ADF fetches the selected records much faster this way. Our requirement is on click of the checkbox, the ADF should select the records ( the same way it is doing CTRL+CLICK) and all such selected rows should be retrievable using the ADF method theTable.getSelectedRowKeys()
Is there any way it can be done?
Regards,
Antony.Hi All,
We have implemented the select and select all using check-box and it is working fine. Issue here is the performance is too slow
Assume SelectValue is the VO coulmn for the checkbox to select the values. To filter out the selected rows, we use the following line
Row[] pidRows = pidView.getFilteredRows("SelectValue", Boolean.TRUE);
it is very taking more than 2 minutes if the total number of rows are *4 thousands* and only if 2 rows are selected.
Whereas with the CTRL+CLICK standard approach, ADF has a built in API theTable.getSelectedRowKeys(); to get only the selected rows, and the built in API takes only few milliseconds to get the selected rows. Users are not agreeing to the CTRL+CLICK approach as it is not user friendly. Suggest if there is a way to make the select box to make it work the same way as CTRL+CLICK.
code snippet to do the standard way :
RowKeySet sk = theTable.getSelectedRowKeys();
_logger.info("row count of select "+sk.getSize());;+
Iterator selection =sk.iterator();
EmpVORowImpl empRow = null;
+while (selection.hasNext()) {+
Object rowKey = selection.next();
theTable.setRowKey(rowKey);
rowdata = (JUCtrlHierNodeBinding)theTable.getRowData();
empRow = (EmpVORowImpl)rowdata.getRow();
_logger.info("Emp # "+empRow.getEmpno() +" Emp Name : "+empRow.getEname() +" Is selected ? "+empRow.getisChecked());+
+}+ -
Multiple row selection for table element
Hi,
I have a requirement where I require to select multiple rows from a table element in a WD for abap application.
I have defined a node with cardinality and selection set to 1..n.
The contex node contains 4 fields : emp_name, pernr, manager and position.
The attributes of the table element for selectionmode is set to 'multi' and 'selectionchangebehaviour' is set to 'auto'.
I have defined an action on the 'onleadselection' event.
The code in this method also includes the statement 'lo_el_team_view->set_selected( EXPORTING flag = abap_true ).'
When I execute the application only 1 row is highlighted at any one time when I select it. You can select multiple rows by holding down the 'ctrl' key but I want to avoid having to do this. Is there anything I have missed out causing multiple row selections not to be all highlighted.
Thanks in advance for any assistance.Hi raj,
you can try the following code in the 'onleadselect' event of the table,
create one attribute ' Flag' of type WDY_BOOLEAN under the node which has been binded to the table.
DATA lo_nd_node_tab1 TYPE REF TO if_wd_context_node.
DATA lo_el_node_tab1 TYPE REF TO if_wd_context_element.
DATA lo_elements TYPE wdr_context_element_set.
DATA lo_ele_select_new TYPE REF TO if_wd_context_element.
DATA lv_deselect TYPE wdy_boolean.
DATA lv_flag TYPE wdy_boolean.
DATA lv_select TYPE wdy_boolean.
DATA lv_index TYPE i VALUE 0.
lo_nd_node_tab1 = wd_context->get_child_node( name = wd_this->wdctx_node_tab1 ).
get the current selected element
lo_ele_select_new = wdevent->get_context_element( name = 'NEW_ROW_ELEMENT' ).
CHECK lo_ele_select_new IS NOT INITIAL.
check whether it has been selected or not
CALL METHOD lo_ele_select_new->is_selected
RECEIVING
flag = lv_select.
lo_ele_select_new->get_attribute( EXPORTING name = 'FLAG' IMPORTING value = lv_deselect ).
check whether element has been previously selected or not,if not, set the flag to select it
IF lv_select IS NOT INITIAL AND lv_deselect IS INITIAL.
lo_ele_select_new->set_attribute( name = 'FLAG' value = 'X' ).
if selected currently and previously then set the flag as false,in order to delect it
ELSEIF lv_select IS NOT INITIAL AND lv_deselect IS NOT INITIAL..
lo_ele_select_new->set_attribute( name = 'FLAG' value = ' ' ).
ENDIF.
CALL METHOD lo_nd_node_tab1->get_elements
RECEIVING
set = lo_elements.
according to the falg, select and delect the elements
LOOP AT lo_elements INTO lo_el_node_tab1.
lo_el_node_tab1->get_attribute( EXPORTING name = 'FLAG' IMPORTING value = lv_flag ).
IF lv_flag = 'X'.
lo_el_node_tab1->set_selected( abap_true ).
lo_nd_node_tab1->set_lead_selection_index( lv_index ). * this statement deselects the lead selection index*
ELSE.
lo_el_node_tab1->set_selected( abap_false ).
lo_nd_node_tab1->set_lead_selection_index( lv_index ).
ENDIF.
ENDLOOP.
I hope this resolves your problem.
Thanks,
krishna -
Multiple row selection capability in the table
Hi
I have a group with table layout style and I want to set the rowSelection property of the generated table to "multiple" but it seems that there is no way to do that from JHs unless using the group as LOV, which is not desired for me. Here is the code which sets this property in tableGroup.vm :
#if (! ($JHS.current.group.useAsLov && $JHS.current.group.multiSelect))
selectionListener="#{#BINDINGS_TABLE().collectionModel.makeCurrent}"
rowSelection="single"
#if( ! $JHS.current.group.useAsLov )
selectedRowKeys="#{#TABLE_BEAN().selectedRow}"
#end
#else
rowSelection="multiple"
selectedRowKeys="#{#LOV_PAGE_BEAN().selectedRowKeySet}"
selectionListener="#{#LOV_PAGE_BEAN().selectionListener}"
#end
Is there any reason to not allowing to have multiple row selection capability in the table when it is not in LOV mode?
Thanks
FerezFerez,
No, but if you want to have multiple selection, there is typical a custom action you want to apply to the selected rows, which cannot be defined in the Jheadstart Application Definition editor.
However, it is perfectly fine to use a custom tableGroup.vm template and enable multi-selection.
Steven Davelaar,
JHeadstart team. -
Problem in ALV Grid control in selecting multiple rows.
Dear All,
I am using ALV grid, in that first column is sel field user will select record and he press the customized button for one record it is working fine, but user unable to select multiple records without using CTRL key, and i used HOTSPOT on LIFNR field in this case when ever i ampressing LIFNR field it is takunf Fcode as &IC1 instead of LIFNR, i tried to solve this but i coudn;t succeded, please help me out in this .
Regards,
Madhu srujan.P
Edited by: Chinnu on Apr 9, 2010 5:26 PM
Edited by: Chinnu on Apr 9, 2010 5:30 PMI assume the first column contains the standard selection field of the ALV grid.
To enable the proper method of seletion, you need to pass the appropriate SEL_MODE in the your layout structure:
SEL_MODE is either SPACE, A, B, C or D.
Google for ALV grid PDF and you'll find some documentation on ALV grids in general. -
How to capture multiple rows of ALV grid when user selected?
Actually,It is easy to get one single line.However, my user wants select several lines of ALV grid by condition . i need to process the selected lines ,so i need to put these lines into an internal table. But now, i have no idea to capture the lines.
What method for an ALV Grid will return the lines the user has selected?
Appreciate for your help!
Edited by: Heyman52 on Aug 25, 2010 4:28 AM
Edited by: Heyman52 on Aug 25, 2010 4:30 AMHi,
Once user selects multiple rows and press another button for further execution, you can modify your internal table with marked rows using selection column.
You need to add user command code in your ALV grid call. Please refer below code.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'F_GUI_STATUS'
I_CALLBACK_USER_COMMAND = 'F_USERCOMMAND'
I_GRID_TITLE = TEXT-026
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = I_FIELDCAT
TABLES
T_OUTTAB = I_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE S475 DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
*- User command for details display.
PERFORM F_USERCOMMAND USING I_UCOMM
I_SELFIELD.
FORM F_USERCOMMAND USING FP_R_UCOMM LIKE SY-UCOMM
FP_SELFIELD TYPE SLIS_SELFIELD.
IF L_V_REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = L_V_REF_GRID.
ENDIF.
IF NOT L_V_REF_GRID IS INITIAL.
CALL METHOD L_V_REF_GRID->CHECK_CHANGED_DATA.
ENDIF.
ENDFORM.
You can then read your final internal table as below and take the selected records in another internal table.
LOOP AT I_OUTTAB ASSIGNING <FS_OUTTAB> WHERE SEL EQ 'X'.
APPEND <FS_OUTTAB> TO I_CHECK.
ENDLOOP.
Edited by: Archana Pawar on Aug 25, 2010 11:16 AM -
Disable Multiple Row Selection in REUSE_ALV_GRID_DISPLAY
How can I disable multiple rows from being selected in an ALV grid that is created using REUSE_ALV_GRID_DISPLAY?
I do not see a selection mode option in the Layout for this Func ModsHi John,
You can use NO_ROWMARK of layout structrue in REUSE_ALV_GRID_DISPLAY_LVC instead. It's still SLIS type-pools in use, though.
Check [Vijay's bottom most post|Is it possible to color a text in ALV GRID; how to use this fm.
Regards
Marcin
PS: Sorry I mixed it up. I thought you want to suppress selection at all. For your request therefore SEL_MODE = 'B' of layout strcuture is what you need. Above fm still applies.
Edited by: Marcin Pciak on Jul 30, 2009 11:16 PM -
ALV - how to make selectable only some rows on an ALV?
Hi my problem is:
I have an ALV GRID as output of a report.
I have to make selectable only few rows based on the contents of a field (showed in a column in the ALV).
Is it possible?
Best Regards, VincenzoI did understand, but as i told you there is nothing like that, neither an option nor an event to capture.
Here is the documentation: http://help.sap.com/saphelp_erp2005vp/helpdata/EN/bf/3bd1369f2d280ee10000009b38f889/frameset.htm
Read it and choose what you need and what is in existance.
Maybe you are looking for
-
As I was playing around on the front cover of an album re background colour etc I somehow changed the # of photos on the whole album( per page ) and now can't retrieve the earlier version of the album. The software has chosen several photos from eac
-
I don't see how to sync on this latest version of iTunes - what to do?
I have the iPod Nano 6 and the latest version of iTunes and don't see how to sync - what to do?
-
Business process for power generation co's
Hi all, Can any one mail me the busines scenarios that are involved in power generation co's and what r the customizations required for the same, where billing has to be done on the basis of meter reading at customers automatically.
-
How import flac files into itunes
how do you import flac files into itunes on a mac? thx
-
Since upgrading to Lion OS 10.7.1, the wifi connectivity keeps blocking up intermittently and we need to manually keep switching on and off the wifi utility to get the connection back. even locking the preferred wifi network in system preferences doe