Clear TableView Selected rows - Urgent
Hi All,
I have a stateful BSP application. I have a tableview in that applications. I have the multiselect option in that table. Is there any way to clear the previous selected rows of the table. The table is getting new data without any problems but the previously selected line remain on the table Would appreciate if anyone could help me out as it is Urgent !!
Best Regards,
Sudhi
Hi Sudhi,
You can follow up using this sample code. Here you can set a flag variable which is updated in onInputProcessing event.
Layout:
<htmlb:form>
<%
if flag is initial.
%>
<htmlb:tableView id = "tab1"
table = "<%= itab %>"
visibleRowCount = "8"
design = "ALTERNATING"
footerVisible = "TRUE"
selectionMode = "multiSelect"
keepSelectedRow = "true" >
</htmlb:tableView>
<%
endif.
%>
<%
if flag eq 1.
%>
<htmlb:tableView id = "tab2"
table = "<%= itab %>"
visibleRowCount = "8"
design = "ALTERNATING"
footerVisible = "TRUE"
selectionMode = "multiSelect"
keepSelectedRow = "true" >
</htmlb:tableView>
<%
clear flag.
%>
<%
endif.
%>
<htmlb:button id = "but01"
text = "Click"
onClick = "myEvent" />
</htmlb:form>
OnInputProcessing:
DATA: tv TYPE REF TO cl_htmlb_tableview.
DATA: event TYPE REF TO cl_htmlb_event.
event = cl_htmlb_manager=>get_event( runtime->server->request ).
IF event->id = 'but01' AND event->event_type = 'click'.
tv ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'tableView'
id = 'tab1' ).
IF tv IS NOT INITIAL.
DATA: tv_data TYPE REF TO cl_htmlb_event_tableview.
tv_data = tv->data.
DATA : itab2 TYPE TABLE OF selectedrow,
ind TYPE selectedrow,
row_s TYPE zdi_so.
CALL METHOD tv_data->get_rows_selected
RECEIVING
selected_rows = itab2.
ENDIF.
IF itab2 IS NOT INITIAL.
DATA :rw LIKE LINE OF itab.
LOOP AT itab2 INTO ind.
flag = '1'.
DELETE itab INDEX ind-index.
ENDLOOP.
ENDIF.
ENDIF.
Hope this helps,
Regards,
Ravikiran.
Message was edited by: Ravikiran C
Similar Messages
-
Error in receiving tableview data for selected row
Hi Collegues ,
We plan to realize an application for the maintanance of planning data . In the first step we created a value help page by using a tableview with iterator class ( 1 of the 3 methods of the Interface was filled with logic ) . We don't use any controller for that application .
A global internal table with the relevant help value data ( fgrvalues ) is used for the tableview and the call is :
TYPE I .
+CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
CLEAR ONCLICKEVENT.
IF EVENT_ID = CL_HTMLB_MANAGER=>EVENT_ID.
EVENT_DATA = CL_HTMLB_MANAGER=>GET_EVENT( REQUEST ).
IF ( EVENT_DATA IS NOT INITIAL ) AND
( EVENT_DATA->EVENT_TYPE = 'click' ) .
ONCLICKEVENT = EVENT_DATA->SERVER_EVENT .
ENDIF.
ENDIF.+
CASE ONCLICKEVENT.
WHEN 'take' .
TABLE ?= CL_HTMLB_MANAGER=>GET_DATA( REQUEST = REQUEST
NAME = 'tableView'
ID = 'fgr1_vhelp' ) .
TABLE_EVENT = TABLE->DATA.
IF TABLE_EVENT->SELECTEDROWINDEX IS NOT INITIAL.
ROWSELECTION = TABLE_EVENT->SELECTEDROWINDEX.
-> ROWSELECTION - Content is now the index of the selected tableview row
We always get the selected row in TABLE_EVENT->SELECTEDROWINDEX and the table TABLE_EVENT->ALLCOLUMNNAMES filled ( column ZX_FGR1 is the 2nd column )
but we never got the tableview data for that tableview row no matter what we tried . We tried it with a tableview-event fired on 'rowselection' by user line-selection . We have deactivated the iterator or changed the BPS design value . With the same result - nothing was given back .
We found that the System-Call Return value of :
+system-call ict
did
ihttp_scid_get_form_field
parameters
m_c_msg " > c handle
name " > form field name value " < form field value
m_last_error. " < return code+
in the method IF_HTTP_ENTITY~GET_FORM_FIELD is empty . M_LAST_ERROR occurs with value '20' .
+ ASSIGN ROWSELECTION TO .
COLUMN_VALUE = TABLE_EVENT->GET_CELL_VALUE( ROW_INDEX =
COLUMN_INDEX = '2' ). -> Column Value is empty !!+
+CALL METHOD TABLE_EVENT->GET_CELL_VALUE
EXPORTING
ROW_INDEX = TABLE_EVENT->SELECTEDROWINDEX
COLUMN_INDEX = '2'
RECEIVING
VALUE = COLUMN_VALUE -> Column Value is empty !!+
+CALL METHOD TABLE_EVENT->GET_SIMPLE_DATA ....
-> Column Value is empty !!+ *----
What could be the reason for that problem ? In generally it must be possible somehow to read the tableview data for one or all rows of the mentioned tableview .
We hope that someone can help and are very thankful for a hint or solution . If you need more details please let us know .
Please Remark: It's no solution for us to read the data by using the created internal table fgrvalues and the selectedrowindex cause in a later step we plan to update an ODS table with the manual modified planning data of an editable tableview .
Thanks a lot in advance
Dirk LäuferHi collegues ,
It's done .
After we've got a very helpful little hint from Brian :
The <htmlb:tableView> renders a table to the browser. It does not keep a copy of the table. The browser will also never return the table. Never. What it can return are inputfields for each cell. But then only if each cell is custom rendered as an inputfield.
we could certainly solve the problem .
We set the field we want to get back from table view on not editable inputfield via the tableview-iterator method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START :
DATA: LCL_TABLE TYPE REF TO CL_BSP_BEE_TABLE ,
LCL_INPUTFIELD2 TYPE REF TO CL_HTMLB_INPUTFIELD .
CASE P_COLUMN_KEY .
WHEN 'ZX_FGR1'.
* Field Firm Group
CREATE OBJECT LCL_INPUTFIELD2.
LCL_INPUTFIELD2->ID = P_CELL_ID.
LCL_INPUTFIELD2->WIDTH = '100%'.
LCL_INPUTFIELD2->MAXLENGTH = 4.
LCL_INPUTFIELD2->TYPE = 'STRING'.
LCL_INPUTFIELD2->DESIGN = 'STANDARD'.
LCL_INPUTFIELD2->DISABLED = 'TRUE'.
LCL_INPUTFIELD2->VALUE =
GET_COLUMN_VALUE( COLUMN_NAME = 'ZX_FGR1').
P_REPLACEMENT_BEE = LCL_INPUTFIELD2 .
Now the method in OnInputPorcessing:
TRY.
CALL METHOD CL_HTMLB_MANAGER=>GET_SIMPLE_DATA
EXPORTING
REQUEST = RUNTIME->SERVER->REQUEST
ID = 'fgr1_vhelp'
ROW_IDX = TABLE_EVENT->SELECTEDROWINDEX
COL_NAME = 'ZX_FGR1'
CHANGING
DATA = FGRVALUES_LINE-ZX_FGR1 .
IF NOT FGRVALUES_LINE-ZX_FGR1 IS INITIAL.
* selektierte Firmengruppe übernehmen
ZX_FGR1 = FGRVALUES_LINE-ZX_FGR1 .
CALL METHOD NAVIGATION->SET_PARAMETER
EXPORTING NAME = 'ZX_FGR1'
VALUE = ZX_FGR1.
ENDIF.
CATCH CX_SY_CONVERSION_ERROR .
ENDTRY.
works properly as it should be ...
An enormous Thanksgiving to you , Brian !!!! -
Get value of a selected row in a TableView
Hi all.
I'm very new to BSP-Extensions and don't know how to get the values of a selected row in a tableview. I've written a simple bsp with a tableview and a button (both htmlb). I want to get the selected values (as a workarea of tab or cell values) of the tableview at the moment where a user hits the button. I have thought that i could use the method GET_CELL_VALUE but it never works.
Here are my type definitions:
TYPES t_scarr TYPE TABLE OF scarr.
Here are my page attributes:
DATA pa_str_scarr TYPE scarr.
DATA pa_tab_scarr TYPE t_scarr
Here is the layout coding:
<htmlb:content design = "design2003"
controlRendering = "SAP" >
<htmlb:document>
<htmlb:documentHead>
</htmlb:documentHead>
<htmlb:documentBody>
<htmlb:form>
<htmlb:tableView id = "tableview_scarr"
table = "<%= pa_tab_scarr %>"
headerText = "Table SCARR"
headerVisible = "TRUE"
width = "100%"
selectionMode = "SINGLESELECT"
onRowSelection = "select" >
</htmlb:tableView>
<htmlb:button id = "button_go"
text = "Go"
onClick = "button_go" />
</htmlb:form>
</htmlb:documentBody>
</htmlb:document>
</htmlb:content>
Here is the coding of OnInitialization:
SELECT * FROM scarr INTO TABLE pa_tab_scarr.
And this is my OnInputProcessing:
DATA: event TYPE REF TO cl_htmlb_event,
tv TYPE REF TO cl_htmlb_tableview,
table_event TYPE REF TO cl_htmlb_event_tableview,
selected_row_index TYPE selectedrow-index,
cell_value TYPE string.
IF event_id = 'htmlb'.
event = cl_htmlb_manager=>get_event( runtime->server->request ).
CASE event->server_event.
WHEN 'button_go'.
tv ?= cl_htmlb_manager=>get_data( request = request
name = 'tableView'
id = 'tableview_scarr' ).
IF tv IS NOT INITIAL.
table_event = tv->data.
selected_row_index = table_event->selectedrowindex.
cell_value = table_event->get_cell_value(
row_index = selected_row_index
column_index = 1 ).
ENDIF.
ENDCASE.
ENDIF.
What is wrong and what is the best way to get the selected data at this moment?In your code....
change
<htmlb:button id = "button_go"
text = "Go"
onClick = "button_go" />
to
<htmlb:button id = "button_go"
text = "Go"
onClick = "onInputProcessing" />
Also you are not getting the <b>selectedRowIndextable</b>.That might also be the problem...
<b><i>Do reward each useful answer..!</i></b>
Thanks,
Tatvagna. -
[Urgent] Issue with Selected rows in Advanced table
[I have searched archive and found lots of mails on same issue but none were conclusive so i am asking this again]
Hi All,
I have created an advanced table and i want to have functionality of deleting selected rows.
For implementation of this functionality, i have created a selectflag transient attribute [varchar2] and linked it to multiple select item of Advanced table but the table always returns null for selectflag attribute irrespective of row being selected or not.
One thing i have noticed is that i can't supply 'checked value' and 'unchecked value' property in advanced table multiple select item. Is that the issue?
Can anybody please guide, its quite urgent.
Regards
LokeshHi Reetesh,
Thanks for the reply.
Yes, you are right i am using same AM at 2 different places.
Let me just elaborate a little about my implementation:
I have a Page layout region and within this page layout, i have a query bean which performs results based search.
Within this query bean, i have added an Advanced table within that query bean to display the results.
Now coming to multiple AM issue:
1. Page Layout region must have one AM or its an error.
2. If i donot add an AM to advanced table, it doesn't return rows.
So do i need to have 2 diferent AM's for this implementation?
Regards
Lokesh -
Hello,
Using a tableview with table iterator, the user can select one or more lines and delete them by using a button.
A server event is triggered then to delete the data on the database. But afterwards the tableview appears with the same row indexes selected. But I don't
want to have any selected rows afterwards and I don't know
in fact where this indexes are from, where they are kept.
The selected rows come from table->data
->PREVSELECTEDROWINDEXTABLE to delete the selected rows.
The deletion of this indextable afterwards does not help to get rid of the selected rows after the server event.
<htmlb:tableView id = "<%= l_ref_wa-QSDS_I_R3QSC_FIELDS-fields %>"
table = "//g_page1model_view/QSDS_I_QS_INPUT_NR2"
headerVisible = "FALSE"
footerVisible = "FALSE"
design = "alternating"
selectionMode = "MULTISELECT"
iterator = "<%= g_page1model_view->tv_iterator %>"
focus1stSelectedCell = "FALSE"
tabIndexCell = "FALSE"
tableLayout = "FIXED"
keepSelectedRow = "FALSE"
headerText = "<%= l_ref_wa-header %>"
allRowsEditable = "X" />
Anyone could help me.
kind regards.
CarolaHi Carola,
some months ago a cool dude in this forum posted this code =)
cl_htmlb_manager=>check_tableview_all_rows(
rowcount = table_event->ROWCOUNT
request = request
id = '<YOUR TABLEID>'
keytable = table_event->PREVSELECTEDROWKEYTABLE
check = '' ).
I am using it to deselect my tables and it works without any problems, have fun.
regards
Thomas -
Htmlb:tableView Recover the selected row
Hi.
How can I recover the selected row in a internal table, with the htmlb:tableView, in the onInputProcessing?
Thanks very much!
I'm using this sentence in the "layout":
<!-- Visualizamos Línea de selección + tabla interna -->
<htmlb:tableView id = "myTableView"
visibleRowCount = "<%= c_ver_registros %>"
width = "<%= c_ancho_tabla %>"
selectionMode = "SINGLESELECT"
table = "<%= T_TABLA %>" >
</htmlb:tableView>
nullhi Marcos,
While calling the Tableview in the layout get the selected row index in the attribute <b>selectedRowIndex = "<%= var_selectedindex %>"</b> { where var_selectedindex should be defined as a pageattribute} the tableview definition should be like this..
<htmlb:tableView id = "myTableView"
visibleRowCount = "<%= c_ver_registros %>"
width = "<%= c_ancho_tabla %>"
selectionMode = "SINGLESELECT"
<b>selectedRowIndex = "<%= var_selectedindex %>"</b>
table = "<%= T_TABLA %>" >
</htmlb:tableView>
And in the <b>inputprocessing</b> ,
Try this code..
IF htmlb_event IS NOT INITIAL AND htmlb_event->if_htmlb_data~event_name = 'tableView' AND
( htmlb_event->if_htmlb_data~event_type = 'cellClick' OR
htmlb_event->if_htmlb_data~event_type = 'rowSelection' OR
htmlb_event->if_htmlb_data~event_type = 'navigate' ) .
DATA tableview_event TYPE REF TO cl_htmlb_event_tableview.
tableview_event ?= htmlb_event.
IF lr_tableview_event->selectedrowindex IS NOT INITIAL .
var_selectedindex = tableview_event->selectedrowindex.
ENDIF.
ENDIF.
regards,
Bhanu. -
Getting the selected row from a datatable -- URGENT
Hi,
I am facing the following problem with a datatable. The datatable does not have any Input components like CommandLink, Buttons, Radio Buttons and Checkbox. Even I cannot use the hidden Command Link.
One solution is to use a input hidden variable which can hold the curent row Id. But in this case too, how to get the control in a backing bean method is not clear to me.
Please guide me how to get the data of the selected row in the backing bean.
Thanks in advance......
VJain.I again explain my problem:
I need to get the Current Selected Row onclick of any row in a Datatable. But the datatable is restricted not to have any CommandLink or Input component so that I can generate the action to go to any method on a backing bean as shown below.
<h:dataTable id="dTable" value="#{Bean.myList}" var="currentRow" >
<h:column id="row1">
<h:outputText value="# currentRow.productNumber}"></h:outputText>
</h:column>
<h:column id="row2">
<h:outputText value="# currentRow.productName}"></h:outputText>
</h:column>
</h:dataTable>
As shown above I cannot use any commandButton or CommandLink to submit the page. All I can do is to generate any onclick function on Table and do something with it. But not sure how to do it.
Now I want the productNumber of the selected row in any method say getCurrentRowId of the Bean.
I hope the problem must be clear now....
Thanks for your quick reply..
VJ -
RichTable moves Selected Row to the Top of my tableview on refresh
When I issue a partialtrigger on a table with a selected Row, the selected row is repositioned to be the first Row that is available. The actual positions of the rows in the tables dont change, the selected row is just scrolled to the top... I need to suppress this behavior. Anyone have any Ideas?
Without an exact jdve version we can't do much.
Check these properties of hte table
activeRowKey, displayRowKey and displayRow. Then read the doc for the properties and set them according your use case.
Timo -
How to delete selected row in table control
Hi all,
here is my coding for deleting selected row.
But it is not working correctly.
I am not able to delete seleced row.
If i press delete button it automatically delete from beginning instead of selected rows.
Can anyone can help me plz...
CONTROLS rowdeleting TYPE TABLEVIEW USING SCREEN 100.
TABLES zdetails.
data : begin of itab occurs 0,
NAME TYPE ZDETAILS-NAME,
ADDRES TYPE ZDETAILS-ADDRES,
CONTACTNO TYPE ZDETAILS-CONTACTNO,
INIT TYPE C,
end of itab .
DATA OK_CODE LIKE SY-UCOMM.
CALL SCREEN 100.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'BACK'.
IF ITAB-INIT IS INITIAL.
SELECT NAME ADDRES CONTACTNO FROM ZDETAILS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
DESCRIBE TABLE ITAB LINES rowdeleting-LINES.
ITAB-INIT = 'X'.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE CHANGE_SDYN_CONN OUTPUT.
READ TABLE itab INTO ZDETAILS INDEX rowdeleting-current_line.
ENDMODULE. " CHANGE_SDYN_CONN OUTPUT
MODULE READ_TABLE_CONTROL INPUT.
IF ITAB-INIT = 'X' AND OK_CODE = 'DELETE'.
DELETE ITAB index rowdeleting-current_line ."FROM ZDETAILS.
DESCRIBE TABLE ITAB LINES rowdeleting-LINES.
ENDIF.
ENDMODULE. " READ_TABLE_CONTROL INPUT
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'DELETE'.
IF ITAB-INIT = 'X' AND OK_code = 'DELETE'.
DELETE ITAB index rowdeleting-current_line .
ENDIF.
ENDCASE.
ENDMODULE.
regards ,
ranjith.Hi,
Check the following code:
CONTROLS TABLE_CONTROL TYPE TABLEVIEW USING SCREEN 100.
TABLES SDYN_SDW4.
DATA SDYN_ITAB LIKE STANDARD TABLE OF SDYN_SDW4.
DATA INIT.
DATA OK_CODE LIKE SY-UCOMM.
DATA SAVE_OK LIKE SY-UCOMM.
DATA MARK.
DATA COL TYPE CXTAB_COLUMN.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'GRUND'.
SET TITLEBAR '100'.
IF INIT IS INITIAL.
Datenbeschaffung
SELECT CARRID CONNID CITYFROM AIRPFROM CITYTO AIRPTO DEPTIME ARRTIME
DISTANCE DISTID
FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE SDYN_ITAB.
DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.
INIT = 'X'.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module FILL_TABLE_CONTROL OUTPUT
text
MODULE CHANGE_SDYN_CONN OUTPUT.
you can change the content of current table control line via
sdyn_conn
READ TABLE sdyn_itab INTO sdyn_conn INDEX table_control-current_line.
ENDMODULE. " FILL_TABLE_CONTROL OUTPUT
*& Module READ_TABLE_CONTROL INPUT
text
MODULE READ_TABLE_CONTROL INPUT.
Check input values
IF MARK = 'X' AND SAVE_OK = 'DELETE'.
DELETE TABLE SDYN_ITAB FROM sdyn_sdw4.
DESCRIBE TABLE SDYN_ITAB LINES TABLE_CONTROL-LINES.
ENDIF.
ENDMODULE. " READ_TABLE_CONTROL INPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'SORT'.
DATA: FLDNAME(100),HELP(100).
READ TABLE TABLE_CONTROL-COLS INTO COL WITH KEY SELECTED = 'X'.
SPLIT COL-SCREEN-NAME AT '-' INTO HELP FLDNAME.
SORT SDYN_ITAB BY (FLDNAME).
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module EXIT INPUT
text
MODULE EXIT INPUT.
LEAVE PROGRAM.
ENDMODULE. " EXIT INPUT
Regards,
Bhaskar -
Tableview - Uncheck rows after processing
Hello,
I'm having a problem. I have an MVC app which has a tableview on the page. Users click the "standard" selection checkbox and click a button to delete the selected row. The deletion works great, but the problem is that when the page is refreshed a row is selected (the previously selected row has been deleted, so it's usually the first row in the tableview). Is there any way to "clear" this highlight when the page redisplays?
Any help would be greatly appreciated!
Thanks in advance,
LisaUse below code:
<htmlb:tableView id = "TVTABLE"
selectionMode = "MULTISELECT"
visibleRowCount = "20"
sort = "SERVER"
keyColumn = "PERNR"
filter = "SERVER"
selectedRowKeyTable = "<%=key_tab%>"
tabIndexCell = "TRUE"
table = "<%=lt_01%>" />
Event Handling:
cl_htmlb_manager=>check_tableview_all_rows( rowcount = n
request = request
id = '<tableview id>'
keytable = keytable "Table containing the key values of your itab
check = '' ). "If its 'X' all items will be selected and ' ' will uncheck all items.
Raja -
Hi, in my iphone App, I have a UITableViewController which is popped up from my main view with presentModalViewController. Tapping on an item in the Table View results in the item becoming highlighted, and it goes back to the main page. However, if I pop up the Table View again, my previous selection remains highlighted. This is not what I want. How can I clear any selection when the Table view show up?
Use the following code in second UITableViewController (the one where you select a row):
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:NO];
Andreas -
How do I get the values from a selected row.
I am using JDeveloper 9.0.5. On my page, I have placed a button within a table. The button has been assigned an event. The event is within my Action class. This class implements DataAction and has overriden the
processComponentEvents(DataActionContext actionContext);
method.
Question: While I am within the processComponentEvents method, is it possible to obtain the values of selected row?Good Morning Jeffery,
First off thanks for your clear explanation. I have a few related questions as noted from your response:
There are two ways to communicate the desired model row between the UIX view and the struts controller. One way is to use the singleSelection component in your table and put your buttons in the singleSelection's contents.
When the user selects the radio button for a particular row and then clicks on one the buttons, a built in event handler in UIX will set the current row in the model to be the user selected row. Therefore, your Struts action can operate on the currently selected model row.
When you drop a UIX table from the data control palette it is automatically set up in this way (with a single selection).
Ok, Lets say that i've set everything up as you described. Not lets say that the button was pressed and I hit the overriddenprotected void processComponentEvents(DataActionContext actionContext) throws IOException, ServletException ;
When I look at the request object, I do not see the values. How do I get access to the rowkey at this point?
Some people, however, want to actually render buttons in their table rows, and have those buttons initiate an action on their row. If you are doing this, then you need to pass the row id to your struts action as a parameter, which means that you need to know the row id when you are rendering a button for a given row. There is an EL expression that will return the row-id for the current row, it is:
${uix.current.rowKeyStr}
which is not so obvious or well documented in the preview release (sorry) but should be for the production release.
A generic code snippet would go a long way to shedding some light on that. I guess I am use to using JDeveloper 9.0.3. It seems,"to me", that JDev 9.0.5 has put a completely new twist on things. I find myself wondering when I can use the 9.0.3 syntax and when
should not. If your team has any short source toys around which demonstrated using rowkeys, or accessing the internal parts of the
struts controller, I would find that invaluable. It dose not matter if this information is documented.
Thank you -
Need sample code to get handle of Selected rows from ADF Table
Hi,
I am new to ADF. I have an ADF table based on VO object.On some button action,I need to get handle of selected rows in application module.
If anybody is having sample code to do this then please share with me.
Thanks,
ashokwow now link http://blogs.oracle.com/smuenchadf/examples/#134 is working.thanks a lot.
also the link http://baigsorcl.blogspot.com/2010/06/deleting-multi-selected-rows-from-adf.html is very useful. Thanks a lot for Sameh Nassar too.He made it clear that in 11g Select column is not available for a ADF table and provided a solution to get Select column.
Thanks,
ashok -
Getting selected row values of a classic report
Hi Guys,
i'm using Apex 4.1,
I have a classic report on my apex page. First column of this report is check box for row selection. and its binded to primary key of a table. i know that i can get the selected row's primary key (Check box value) using APPLICATION_ITEM.G_FO1() function. What i need is how can i get the other cell values of the selected row ?
Appreciate if someone can help on this,
Thanks.Apex-Ape wrote:
i'm using Apex 4.1,
I have a classic report on my apex page. First column of this report is check box for row selection. and its binded to primary key of a table. i know that i can get the selected row's primary key (Check box value) using APPLICATION_ITEM.G_FO1() function. What i need is how can i get the other cell values of the selected row ?If you really have a report with just one checkbox column and the rest of the data standard read-only report columns then it's not clear exactly what the requirement is. What do you want to do with them when you get them?
I can think of 2 possible approaches:
<li>Stick with the current report. On page submit you get an array of zero or more PKs. Create a collection with a row containing each PK. Whatever it is that you want to do next can then use a query that is a clone of the original report query plus a join to the PK values in the collection.
<li>Recreate the report with shadow <tt>apex_item.hidden</tt> columns in the query for each value. In the report column attributes, do not display the <tt>apex_item.hidden</tt> columns, but include them with each displayed column (or stuff them all into one column for convenience) using HTML Expressions. The values will then be available in <tt>apex_application.g_fxx</tt> arrays like the row selector checkbox.
I prefer the first one, but really it depends on what the next step is...
(If it's actually a tabular form then the values will be in other <tt>apex_application.g_fxx</tt> arrays.) -
How to deselect the selected row when we come back again?
Hi all,
I have one screen(100),which contains records.User can select any one record and click 'Details' button.Then it will take to screen 110.When I am coming back to screen 110 again.The previously selected row is again in selected mode only.Now if I am selecting another row and click the 'Detail' button.I am getting the error saying that 'Please select one record'.In debugging mode also I checked using the FM get_current_cell but nothing is getting selected surprisingly.
Even I used CALL METHOD grid->refresh_table_display in the PBO of screen 100.
Below is the code I used in PBO of screen 100
ODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'PF100'.
SET TITLEBAR 'TITLE'.
DATA: G_CONSISTENCY_CHECK TYPE CHAR1.
DATA: G_EXCLUDE TYPE UI_FUNCTIONS.
IF container100 IS INITIAL.
*ex_FUNCTIONS-
*-- Check execution mode (foreground/background)
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CREATE OBJECT CONTAINER100
EXPORTING CONTAINER_NAME = 'CONTAINER100'.
CREATE OBJECT GRID
EXPORTING I_PARENT = CONTAINER100.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ''
I_CONSISTENCY_CHECK = G_CONSISTENCY_CHECK
IT_TOOLBAR_EXCLUDING = G_EXCLUDE
IT_TOOLBAR_EXCLUDING = IT_TOOLBAR
I_STRUCTURE_NAME =
IS_VARIANT = gs_layout
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT = X_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING = IT_TOOLBAR
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_YAPOHDR_MAIN[]
IT_FIELDCATALOG = IT_FIELDCAT[].
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4.
ENDIF.
*--Register enter key for data changed event
CALL METHOD grid->set_ready_for_input
EXPORTING i_ready_for_input = 0.
create object event_receiver.
Register the 'hotspot' event handler method dynamically...
set handler event_receiver->handle_hotspot_click for grid.
Register the User Command event handler method dynamically...
set handler event_receiver->handle_user_command for grid.
Register the User Command event handler method dynamically...
set handler event_receiver->handle_data_changed for grid.
else.
CALL METHOD grid->refresh_table_display.
endif.
ENDMODULE. " STATUS_0100 OUTPUT
The below is the code I used in PAI of screen 110.
MODULE USER_COMMAND_0110 INPUT.
DATA : LT_DETAILS_MAIN LIKE YAPOPLN_ITM OCCURS 0 WITH HEADER LINE,
LV_POP TYPE C,
APPROVE.
CASE SY-UCOMM.
WHEN 'BACK'.
CALL METHOD grid->REFRESH_TABLE_DISPLAY.
CALL METHOD grid->GET_FRONTEND_FIELDCATALOG.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDMODULE. " USER_COMMAND_0110 INPUT
Please Let me know if there is any solution.
Thanks,
BalajiHello Balaji
The sample report <b>ZUS_SDN_TWO_ALV_GRIDS_7</b> shows basically what I meant in my previous answer. There is no row mark available on the first ALV list. Instead of bothering the user to push a button he or she can simply double-click on the ALV lists and sees the details of a customer.
As you can see there is absolutely no need to free any object instances or rebuild grid controls.
Final remark: based on the function module you mention I assume you are still using fm-based ALV lists. Do not use them. OO-based ALV lists are much easier to develop, to maintain and to enhance.
*& Report ZUS_SDN_TWO_ALV_GRIDS_7
*& Description: Display two ALV lists either in single screen or
*& two screens
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*& Flow logic:
* PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
* PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
REPORT zus_sdn_two_alv_grids_7.
TYPE-POOLS: abap.
DATA:
gd_repid TYPE syst-repid,
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_docking2 TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo.
DATA:
gs_knb1 TYPE knb1,
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_knvv TYPE STANDARD TABLE OF knvv.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
CHECK ( sender = go_grid1 ).
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
** CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ). " not on 4.6c
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'DETAIL'
* IMPORTING
* RC =
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
PARAMETERS:
p_single RADIOBUTTON GROUP radi, " single screen
p_double RADIOBUTTON GROUP radi. " two screens
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = '1000'.
" Add dummy customer without any master sales data
CLEAR: gs_knb1.
gs_knb1-kunnr = 'DUMMY'.
gs_knb1-bukrs = '1000'.
INSERT gs_knb1 INTO gt_knb1 INDEX 1.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF ( p_single = abap_true ).
PERFORM create_splitter_container.
ELSE.
* Create 2nd docking container
CREATE OBJECT go_docking2
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
IF ( p_single = abap_true ).
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_docking2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
* Set event handler
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
* Display data
gs_layout-grid_title = 'Customers'.
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
is_layout = gs_layout
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
gs_layout-grid_title = 'Customers Details (Sales Areas)'.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNVV'
is_layout = gs_layout
CHANGING
it_outtab = gt_knvv " empty !!!
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro(s)
gd_repid = syst-repid.
IF ( p_single = abap_true ).
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking2->link
EXPORTING
repid = gd_repid
dynnr = '0200'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
" NOTE: screen '0200' uses same flow logic as '0100'
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
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.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
IF ( syst-dynnr = '0100' ).
SET SCREEN 0. LEAVE SCREEN.
ELSE.
SET SCREEN 100.
ENDIF.
* User has pushed button "Display Details"
WHEN 'DETAIL'.
PERFORM entry_show_details.
IF ( p_single = abap_true ).
ELSE.
SET SCREEN 200.
ENDIF.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ENTRY_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM entry_show_details .
* define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM knvv INTO TABLE gt_knvv
WHERE kunnr = ls_knb1-kunnr.
ENDFORM. " ENTRY_SHOW_DETAILS
*& Form CREATE_SPLITTER_CONTAINER
* text
* --> p1 text
* <-- p2 text
FORM create_splitter_container .
* Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
ENDFORM. " CREATE_SPLITTER_CONTAINER
Regards
Uwe
Maybe you are looking for
-
Dreamweaver CS5.5 and Mobile | ADC Presents | Adobe TV
Scott Fegette explores the new Live View and CSS3 Media Queries features in Dreamweaver CS5.5 that enables web designers and developers to quickly create and test custom web experiences across mobile devices. http://adobe.ly/wYVoFE
-
Elevator Progrogram, written in java
Hi there I'm looking for code of an elevator program, wriiten in java programming. Please if have it, help me! Thankx in advance
-
Mi código se daño al quitar la etiqueta de seguridad, me faltan 4 dígitos ¿puedo recuperar mi código?
-
Code for FM CNECP_MAINTAIN
Hi Experts, Has anyone written a code to wrap to function module CNECP_MAINTAIN for maintaining easy cost planning or does have any idea how to write ? Please help. Regards A Karthik
-
I'm a student. Is there a monthly plan that I can get instead of the yearly plan?
I've seen that there are monthly plan options, but is there a monthly plan for students?