Multiple Row Select in ALV
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
Similar Messages
-
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 -
Selecting multiple rows of an alv
Hi All,
I have a requirement where in i have to select multiple rows of an alv and when i click a button i should get the data of all the selected rows, i am able to select only one row by default , how to select multiple rows or records,i am new to this Web dynpro alv , can aynbody please help me on this.
Thanks,
Praveen.hi, praveen kumar.
About how to make "Multiple-select" of ALV available, you can take a reference of the following coding. Just one example:
****ALV Config****
DATA:
lr_salv_wd_table TYPE REF TO iwci_salv_wd_table,
l_value TYPE REF TO cl_salv_wd_config_table,
lr_table_settings TYPE REF TO if_salv_wd_table_settings.
lr_salv_wd_table = wd_this->wd_cpifc_alv_child( ). "Your statically declared ALV component usage
l_value = lr_salv_wd_table->get_model( ).
* tabel setting
lr_table_settings ?= l_value .
lr_table_settings->set_selection_mode( cl_wd_table=>e_selection_mode-MULTI ).
About how to get your selected records of ALV, you can make use of the context node bound to your ALV component. For example,
****get selected elements****
lt_elems = lo_node->GET_SELECTED_ELEMENTS(
INCLUDING_LEAD_SELECTION = abap_true ).
These are just examples. For detail, you can search them.
Thanks.Best wishes. -
Multiple checkbox selection in ALV and updating internal table
Dear Expert,
Can anyone tell me how to handle the multiple checkbox selection in ALV Grid report and then updating the internal table.
I tried the option but it works only when i select only 1 row in ALV.
DO L_LINES TIMES.
read table icoas index rs_selfield-tabindex.
if sy-subrc = 0.
ICOAS-NOCHK = 'X'.
modify ICOAS INDEX rs_selfield-tabindex TRANSPORTING NOCHK.
ENDIF.
ENDDO.
Requires help....
Regards & Thanx,
Bhupathi.Hi,
Use this method to capture the check box event. Write this once you create your grid using CREATE OBJECT grid1.
DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID,
CALL METHOD grid1->register_edit_event
EXPORTING
i_event_id = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
EXCEPTIONS
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.
LOOP AT T_GRIDDETAILS INTO WA_GRIDDETAILS.
IF WA_GRIDDETAILS-CHECKBOX = 'X'.
"Do your operation
ENDIF.
CLEAR WA_GRIDDETAILS.
ENDLOOP. -
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® -
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 -
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. -
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 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 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. -
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 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 -
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 -
Selecting Multiple rows in an ALV
Hi Experts,
Using 'REUSE_ALV_GRID_DISPLAY' is it possible to select multiple rows, WITHOUT using CTRL OR SHIFT keys ?
thanks in advance.I have done an application for multiple selection in ALV using check box concept. Please find that code below.
*& Report ZATL_DELIVERY
REPORT zatl_delivery.
INCLUDE zatl_delivery_declarations.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln OBLIGATORY.
SELECTION-SCREEN END OF BLOCK a.
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION .
SET PF-STATUS 'ABC'.
SET PF-STATUS 'BCD'.
get the sales order numbers thru given
selection-screen parameters
SELECT vbeln FROM vbak INTO TABLE it_data
WHERE vbeln IN s_vbeln.
AND ERDAT = P_DATE.
IF NOT it_data[] IS INITIAL.
SELECT vbeln vstel FROM vbap INTO TABLE it_vstel
FOR ALL ENTRIES IN it_data
WHERE vbeln = it_data-vbeln.
ENDIF.
LOOP AT it_data INTO wa_data.
CALL FUNCTION 'ZBAPI_GET_MATERIAL_PLANT_DTL'
EXPORTING
v_vbeln = wa_data-vbeln
TABLES
it_bapi = it_result.
LOOP AT it_result INTO wa_result.
READ TABLE it_vstel INTO wa_vstel WITH KEY
vbeln = wa_result-vbeln.
wa_final-vbeln = wa_result-vbeln. " SALES ORDER NO
wa_final-matnr = wa_result-matnr.
wa_final-vstel = wa_vstel-vstel.
wa_final-werks = wa_result-werks.
wa_final-labst = wa_result-kwmeng.
APPEND wa_final TO it_final.
CLEAR wa_result.
ENDLOOP.
REFRESH it_result.
CLEAR wa_data.
ENDLOOP.
PERFORM build_fldcat.
PERFORM disp_output.
*SET PF-STATUS 'ABC'.
*& Form ABC
text
-->EXTAB text
FORM abc USING extab TYPE slis_t_extab.
SET PF-STATUS 'ABC'. " excluding extab.
ENDFORM. "ABC
read
*& Form build_fldcat
text
--> p1 text
<-- p2 text
FORM build_fldcat .
wa_fldcat-col_pos = '1'.
wa_fldcat-fieldname = 'MARK'.
wa_fldcat-checkbox = 'X'.
wa_fldcat-edit = 'X'.
wa_fldcat-seltext_m = 'MARK'.
APPEND wa_fldcat TO i_fldcat.
CLEAR wa_fldcat.
wa_fldcat-col_pos = '2'.
wa_fldcat-fieldname = 'VBELN'.
wa_fldcat-tabname = 'IT_FINAL'.
wa_fldcat-seltext_m = 'SALES ORD NO'.
APPEND wa_fldcat TO i_fldcat.
wa_fldcat-col_pos = '3'.
wa_fldcat-fieldname = 'MATNR'.
wa_fldcat-tabname = 'IT_FINAL'.
wa_fldcat-seltext_m = 'MAT NO'.
APPEND wa_fldcat TO i_fldcat.
wa_fldcat-col_pos = '4'.
wa_fldcat-fieldname = 'WERKS'.
wa_fldcat-tabname = 'IT_FINAL'.
wa_fldcat-seltext_m = 'PLANT'.
APPEND wa_fldcat TO i_fldcat.
wa_fldcat-col_pos = '5'.
wa_fldcat-fieldname = 'LABST'.
wa_fldcat-tabname = 'IT_FINAL'.
wa_fldcat-seltext_m = 'QNTY'.
APPEND wa_fldcat TO i_fldcat.
ENDFORM. " build_fldcat
*& Form disp_output
text
--> p1 text
<-- p2 text
FORM disp_output .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'ABC'
it_fieldcat = i_fldcat
i_callback_user_command = 'CHECKED'
TABLES
t_outtab = it_final
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. " disp_output
*& Form CHECKED
text
-->R_UCOMM text
-->RS_SELFIELD text
FORM checked USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: gd_repid LIKE sy-repid, "Exists
ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data .
ENDIF.
CASE r_ucomm.
WHEN 'DELIVERY'.
IF rs_selfield-fieldname = 'MARK'.
DATA : date_external(10) TYPE c.
DATA: temp_date TYPE sy-datum.
temp_date = sy-datum.
temp_date = temp_date + 1.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = sy-datum
IMPORTING
date_external = date_external
EXCEPTIONS
date_internal_is_invalid = 1
OTHERS = 2.
LOOP AT it_final INTO wa_final WHERE mark EQ 'X'.
PERFORM bdc_dynpro USING 'SAPMV50A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LV50C-VBELN'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'LIKP-VSTEL'
wa_final-vstel. " 'HLL'.
PERFORM bdc_field USING 'LV50C-DATBI'
date_external. "
PERFORM bdc_field USING 'LV50C-VBELN'
wa_final-vbeln. " '34'.
PERFORM bdc_dynpro USING 'SAPMV50A' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'LIPS-MATNR(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
PERFORM bdc_field USING 'LIKP-BLDAT'
date_external. " '19.09.2008'.
CLEAR date_external.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = temp_date
IMPORTING
date_external = date_external
EXCEPTIONS
date_internal_is_invalid = 1
OTHERS = 2.
PERFORM bdc_field USING 'LIKP-WADAT'
date_external ." '19.09.2008'.
CLEAR date_external.
PERFORM bdc_field USING 'LIKP-BTGEW'
wa_final-labst. " -'12'.
PERFORM bdc_field USING 'LIKP-GEWEI'
'wa_likp-GEWEI'.
PERFORM bdc_transaction USING 'VL01'.
PERFORM msg_get TABLES it_msg.
CLEAR wa_final.
REFRESH it_msg.
ENDLOOP.
PERFORM disp_msg.
ENDIF.
ENDCASE.
ENDFORM. "CHECKED
*& Form BDC_DYNPRO
text
-->P_0443 text
-->P_0444 text
FORM bdc_dynpro USING value(p_0443)
value(p_0444).
wa_bdc-program = p_0443.
wa_bdc-dynpro = p_0444.
wa_bdc-dynbegin = 'X'.
APPEND wa_bdc TO it_bdc.
CLEAR wa_bdc.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
text
-->P_0448 text
-->P_0449 text
FORM bdc_field USING value(p_0448)
value(p_0449).
wa_bdc-fnam = p_0448.
wa_bdc-fval = p_0449.
APPEND wa_bdc TO it_bdc.
CLEAR wa_bdc.
ENDFORM. " BDC_FIELD
*& Form BDC_TRANSACTION
text
-->P_0508 text
FORM bdc_transaction USING value(p_0508).
CALL TRANSACTION p_0508 USING it_bdc
MODE 'N'
UPDATE 'S'
MESSAGES INTO it_msg.
ENDFORM. " BDC_TRANSACTION
*& Form msg_get
text
-->P_IT_MSG text
FORM msg_get TABLES p_it_msg STRUCTURE bdcmsgcoll.
LOOP AT p_it_msg INTO wa_msg.
v_msgid = wa_msg-msgid.
v_msgnr = wa_msg-msgnr.
v_msgv1 = wa_msg-msgv1.
v_msgv2 = wa_msg-msgv2.
v_msgv3 = wa_msg-msgv3.
v_msgv4 = wa_msg-msgv4.
IF wa_msg-msgtyp = 'E' OR
wa_msg-msgtyp = 'A' OR
wa_msg-msgtyp = 'X'.
PERFORM build_msg USING v_msgid
v_msgnr
v_msgv1
v_msgv2
v_msgv3
v_msgv4
CHANGING msg_text_e.
Build the text for successful records getting created
ELSEIF wa_msg-msgtyp = 'S' OR
wa_msg-msgtyp = 'W' OR
wa_msg-msgtyp = 'I'.
PERFORM build_msg USING v_msgid
v_msgnr
v_msgv1
v_msgv2
v_msgv3
v_msgv4
CHANGING msg_text_s.
ENDIF.
ENDLOOP.
ENDFORM. " msg_get
*& Form build_msg
text
-->P_V_MSGID text
-->P_V_MSGNR text
-->P_V_MSGV1 text
-->P_V_MSGV2 text
-->P_V_MSGV3 text
-->P_V_MSGV4 text
<--P_MSG_TEXT_E text
FORM build_msg USING p_v_msgid
p_v_msgnr
p_v_msgv1
p_v_msgv2
p_v_msgv3
p_v_msgv4
CHANGING p_msg_text_s.
CALL FUNCTION 'TB_MESSAGE_BUILD_TEXT'
EXPORTING
langu = sy-langu
msgid = p_v_msgid
msgno = p_v_msgnr " wa_msgcoll-msgnr
msgv1 = p_v_msgv1
msgv2 = p_v_msgv2
msgv3 = p_v_msgv3
msgv4 = p_v_msgv4
IMPORTING
text = p_msg_text_s.
wa_mess-v_msg = p_msg_text_s .
APPEND wa_mess TO i_mess.
CLEAR wa_mess.
ENDFORM. " build_msg
*& Form disp_msg
text
--> p1 text
<-- p2 text
FORM disp_msg .
PERFORM build_fieldcat_secandary.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'BCD'
it_fieldcat = i_fldcat1
i_callback_user_command = 'SECANDARY'
TABLES
t_outtab = i_mess
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. " disp_msg
*& Form build_fieldcat_secandary
text
--> p1 text
<-- p2 text
FORM build_fieldcat_secandary .
wa_fldcat1-col_pos = '1'.
wa_fldcat1-fieldname = 'V_MSG'.
wa_fldcat1-tabname = 'I_MESS'.
wa_fldcat1-seltext_m = 'MESSAGE'.
APPEND wa_fldcat1 TO i_fldcat1.
ENDFORM. " build_fieldcat_secandary
*& Form SECANDARY
text
-->R_UCOMM text
FORM secandary USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'BCK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDFORM. "SECANDARY
*& Form ABC
text
-->EXTAB text
FORM bcd USING extab TYPE slis_t_extab.
SET PF-STATUS 'BCD'. " excluding extab.
ENDFORM. "ABC
Hope this will help you,
Murthy.
Maybe you are looking for
-
Alright, this have been a painful day trying to solve this and I am pulling my hair out. So I decided to download the FB4.7 trial for some test with AIR13, and after an indecent amount of hours trying to install the latest player and android sdk (why
-
Logical dataguard SQL apply fails during import on primary database
I have created logical dataguard using GRID, initially every things works fine. One time we had to do import of new data on primary database, that is where the problem started. log apply is lagging big time, and i got this error StatusRedo apply serv
-
Why won't my itunes import aac files i've downloaded nor will it even play them
For years i download off a website audiobooks and magazines in aac format from a website. I name and save the file and then when it downloads i open it and it automatically would open in itunes and then remain in itunes. I could then sync it to my
-
When I open itunes the store will not open nor will it let me sign in trouble shooting says I am not connected to internet ... I am connected.
-
When moving countries, do we then need to create a new apple id?
When moving countries, do we then need to create a new apple id to purchase from our new country? I have logged into my apple id in a browser (not itunes) to change my country details so that I can register my CC information to purchase from my new c