Showing selected row after sorting
I have big JTable with lots of columns. Selection of row is highlighted
using some background color. Sorting is also provided on TableHeader.
After selecting some row, when user does the sorting, this selected row
goes outof visible view of table.
My requirement is to show the same selected row again after doing sorting. I was thinking of calling method like setSelectedRow(), but
unfortunately there is nothing like this method.
I was also thinking of using AccessibleJTable, but couldnt go
anywhere.
Is there any way to do this?
Thanks in advance.
Anup
I have big JTable with lots of columns. Selection of row is highlighted
using some background color. Sorting is also provided on TableHeader.
After selecting some row, when user does the sorting, this selected row
goes outof visible view of table.
My requirement is to show the same selected row again after doing sorting. I was thinking of calling method like setSelectedRow(), but
unfortunately there is nothing like this method.
I was also thinking of using AccessibleJTable, but couldnt go
anywhere.
Is there any way to do this?
Thanks in advance.
Anup
Similar Messages
-
Selecting top row after sorting
hi,
i have a table emp, whose primary key is empid(varchar2),
i want to sort the empid and select the top row after sorting,
i can sort the table using "select * from emp order by empid desc,
i can select the top row using "select * from emp where rownum=1"
i want a combination of the 2,
pls provide me the required query
Thanks and Regards,
Saurabh JhunjhunwalaSEELCT *
FROM ( SELECT e.*
, ROWNUM row_num
FROM emp e
ORDER BY empid desc
WHERE row_num = 1Regards
Arun -
ALV - Editing a Row after Sorting - REAL HEADACHE.....
Hi,
I have a ALV table with a DropDown in one of the columns. The user can enter a value in the dropdown boxes.
Now the proble is, lets say I have SORTED the table by another column. Now the user enters a value in one of the rows of the dropdown and clicks the SAVE Button.
How do i find out, which Row the User Has entered the value ?
I tried using the table it_modified_cells in the event handler for ON_DATA_CHECK . However it gives wrong row indexes, that is if, the row number '10' is Row number '1', after sorting, and if this row is modified, then it_modified_cells table gives Row '1' as modified rather than Row '10'.
So ina nut shell, after sorting , if a row is edited, How to find out which is this row...... ?Nithya,
Look at this thread of mine....
Re: ALV - Lead Selection of Node When FILTERS ACTIVE
I had this issue when after filtering in ALV Table, th e bound Node wtill held original records......
So is it something likeSORTING Updates the context,,,,,FILTERING does not ?
Thanks
Anand -
ALV GRID - Handling selected rows? Sorting in OUTTAB is different from ALV
Dear Experts ,
I have a transaction with ALV grid. I have defined several application specific functions to the ALV grid tool bar. My requirement is to handle the ALV tool bar functions only for the selected rows.
Code snippet:
DATA:
LS_GRID_DS TYPE TYS_DS.
TYPES: BEGIN OF TYS_DS.
INCLUDE TYPE TYS_ALVGRID.
TYPES: STRUCNAME LIKE DD02L-TABNAME.
TYPES: PRETAB TYPE ZTAB_T,
OUTTAB TYPE ZTAB_T,
OUTTAB_HIDDEN TYPE ZTAB_T,
OUTTAB_SUM TYPE ZTAB_T,
OUTTAB_ROLLBACK TYPE ZTAB_T,
END OF TYS_DS.
LOOP AT ls_grid_ds-marked_rows INTO ss_index_split
WHERE rowtype IS INITIAL.
( Marked rows is correctly giving the row numbers of the highlighted rows)
READ TABLE ls_grid_ds-outtab INTO ss_sel_rows_ds_split
INDEX ss_index_split-index.
ISSUE : Sorting in ls_grid_ds-outtab internal table is different from ALV Grid display.
Hence, though ls_grid_ds-marked_rows giving correct rows, I am not able to handle the my requirement correctly.
Why sorting in gs_grid_ds-outtab is different from ALV display? How can they made in sync?
Thank you in Advance.
Sravan.
Edited by: Raja Sravan on Jan 16, 2009 1:13 AMHello Raja
The OUTTAB is usually in sync with the display on the frontend grid control because it is a CHANGING parameter (of method SET_TABLE_FOR_FIRST_DISPLAY).
Question: Do you "feed" ls_grid_ds-outtab to the parameter IT_OUTTAB of method SET_TABLE_FOR_FIRST_DISPLAY?
If not then it is obvious why you get discrepancies.
Regards
Uwe -
Problem with showing selected rows
Hi,
I have writed ALV report with OO and some input field(dialog programming) in same screen.I want to select rows but rows looking like unselected(all of them) on ALV report when i fill input field after selected rows and use enter key.I didn't understand
why my input fields reset my ALV report.After selecting your Input fields, & when you processing the data, check in debugging mode, whether your ALV report (Table) is getting refreshed or not. If its refreshing, try it not to get refreshed, it solves your problem.
-Dileep .C -
Keep selected row after calling TF
Hi,
I'm using jdeveloper 11.1.2.3.0
This is my case:
In one TF I have a fragment with a table.
In each row of this table I have an edit button to edit the row.
when I select a row and click on the edit button it's calling to another TF with edit form.
When I return back from the another TF i'm doing executeQeury to the view in the first TF,
so the user will be able to see the changes that were done in the table.
Then I see the iterator standing on the first row of the table.
I would like the iterator to keep the selected row that was before calling the edit TF.
I could I do that?
ThanksWhen I return back from the another TF i'm doing executeQeury to the view in the first TF,
As you said you are doing executeQuery(), so the row currency changed to first row. While returning from the taskflow you might have some method to execute this. In the same method you need to change the row currency to previous key.
DCIteratorBinding iter = (DCIteratorBinding)getBindings().get("EmpUVO1Iterator");
iter.executeQuery();
ADFContext aDFContext = ADFContext.getCurrent();
Key key = (Key)aDFContext.getSessionScope().get("key");
System.out.println("key "+key);
ViewObjectImpl vo = (ViewObjectImpl)iter.getViewObject();
Row[] row = vo.findByKey(key,1);
vo.setCurrentRow(row[0]); -
CheckBox Item Renderer checks wrong grid row after sorting
I have an advanced Data Grid that has a checkBox ItemRenderer. The underlying object being displayed (Server) in the dataGrid is being bound to the checkBox with a selectedForDeployment:Boolean property.
I had this working just fine until the datagrid is sorted. After the grid is sorted I can click on the checkBox in row 2 and the checkBox in row 8 will be selected for instance. Or in some cases all checkBoxes will become checked. Also, if I have some already checked and then sort, the checkBox will become unchecked.
I have an example of my itemRender below. Any idea on how I can get this to work:
public class CheckBoxRenderer extends CheckBox
override public function set data(value:Object):void {
if(value){
super.data = value;
Server(super.data).addEventListener("setSelectionChanged", valueChange);
this.selected = value.selectedForDeployment;
public function CheckBoxRenderer(){
focusEnabled = false;
BindingUtils.bindSetter(selectionChange, this, "selected");
//this method occurs the checkbox is clicked
public function selectionChange(value:Boolean):void{
trace(value);
this.selected = value;
if(this.data){
this.data.selectedForDeployment = value;
//This method occurs when the selectedForDeployment boolean in the object changes
public function valueChange(event:Event):void{
this.selected = event.target.selectedForDeployment;
/* center the checkbox if we're in a datagrid */
override protected function updateDisplayList(w:Number, h:Number):void
super.updateDisplayList(w, h);
if (listData is DataGridListData)
var n:int = numChildren;
for (var i:int = 0; i < n; i++)
var c:DisplayObject = getChildAt(i);
if (!(c is TextField))
c.x = (w - c.width) / 2;
c.y = (h - c.height) / 2;This usually works for me:
package renderers
import flash.events.Event;
import mx.controls.CheckBox;
public class CheckBoxRenderer extends CheckBox
public function CheckBoxRenderer()
super();
addEventListener(Event.CHANGE, handleChange);
override public function set data(value:Object):void {
if(value){
super.data = value;
selected = value.selectedForDeployment;
private function handleChange(event:Event):void{
data.selectedForDeployment = event.target.selected; -
A selected row in af:table does not get sorted.
Hi,
When a table supports single selection and the table contains quantity of rows gt it can fit into its viewport, then, on sorting, selected row gets out of the sorting process. But when you move to the end of the table, select a row there and then sort the table, then all rows sorted correctly. The selected row, after sorting, always set as a first row in the current viewport, doesn't matter whether it is in the order or out of it.
Noteworthy, when number of rows is lt the viewport allows:
1. sorting works as it should to;
2. on sorting/PPR'ing, as it gets some time, one can see how the viewport updates in two steps and in the first step the first row is the selected one.
JDev's version is 11.1.1.3.0.
VO, iterator and tree bindings, af:table all the props related to data retrieving, fetching and row displaying have default values.
What can cause that?
Thx,
Y.Hi,
so what you are saying is that the selected table row is not sorted but added on top. I tried to reproduce this with 11.1.1.3 but can't see the issue. I tried with editable and read-only tables
Frank -
Row doesn't get selected after sorting
I have a table bond to a javabean data control. I have enabled multi row selection. I get some rows on the table and then I select one of those rows, after that I use the value of the selected row for some operations.
I have 3 columns, first name, lastname , email. The first 2 are sortable. If I click on the header of firstname, the information gets sorted ok (asc / desc). The problem is that after sorting, I can NOT select any rows. When I click on the row, it doesn't get highlighted, and If I try to use the value of the selected row I get a null pointer exception.
Again this is happening only after sorting. If I don't sort, it works ok.
I'm using JDEV + ADF 11.1.1.5.
This is my code
<af:table value="#{bindings.User1.collectionModel}" var="row" partialTriggers="::cb1"
rows="#{bindings.User1.rangeSize}"
emptyText="#{bindings.User1.viewable ? identityBundle.no_data_to_display : identityBundle.access_denied}"
fetchSize="#{bindings.User1.rangeSize}" rowBandingInterval="0"
id="t1" rowSelection="multiple"
selectionListener="#{AssignRolesBean.onTableSelect}"
binding="#{AssignRolesBean.searchResultsTable}"
columnStretching="last">
<af:column sortProperty="firstname" sortable="#{AssignRolesBean.columnSortable}"
headerText="#{bindings.User1.hints.firstname.label}" id="c1"
width="136">
<af:outputText value="#{row.firstname}" id="ot4"/>
</af:column>
<af:column sortProperty="lastname" sortable="#{AssignRolesBean.columnSortable}"
headerText="#{bindings.User1.hints.lastname.label}" id="c2"
width="182">
<af:outputText value="#{row.lastname}" id="ot2"/>
</af:column>
<af:column sortProperty="mail" sortable="#{AssignRolesBean.columnSortable}"
headerText="#{bindings.User1.hints.mail.label}" id="c4"
width="361">
<af:outputText value="#{row.mail}" id="ot5"/>
</af:column>
<af:column sortProperty="uid" sortable="false"
headerText="#{bindings.User1.hints.uid.label}" id="c3"
visible="false">
<af:outputText value="#{row.uid}" id="ot3"/>
</af:column>
</af:table>
I have a selection listener only, I don't have a sort listener.
My bean;
AssignRolesBean
public void onTableSelect(SelectionEvent selectionEvent) {
GenericTableSelectionHandler.makeCurrent(selectionEvent);
My makeCurrent method
public static void makeCurrent( SelectionEvent selectionEvent){
RichTable _table = (RichTable) selectionEvent.getSource();
CollectionModel tableModel = (CollectionModel) table.getValue();
JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding) tableModel.getWrappedData();
DCIteratorBinding tableIteratorBinding = adfTableBinding.getDCIteratorBinding();
Object selectedRowData = table.getSelectedRowData();
JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding) selectedRowData;
Key rwKey = nodeBinding.getRowKey();
tableIteratorBinding.setCurrentRowWithKey( rwKey.toStringFormat(true));
SHOULD I IMPLEMENT A SORT LISTENER FOR THIS TABLE IN ORDER TO HANDLE ROW SELECTION PROPERLY AFTER SORTING?
Is there a guideline for handling row selection after sorting?
ThanksI have a table bond to a javabean data control. I have enabled multi row selection. I get some rows on the table and then I select one of those rows, after that I use the value of the selected row for some operations.
I have 3 columns, first name, lastname , email. The first 2 are sortable. If I click on the header of firstname, the information gets sorted ok (asc / desc). The problem is that after sorting, I can NOT select any rows. When I click on the row, it doesn't get highlighted, and If I try to use the value of the selected row I get a null pointer exception.
Again this is happening only after sorting. If I don't sort, it works ok.
I'm using JDEV + ADF 11.1.1.5.
This is my code
<af:table value="#{bindings.User1.collectionModel}" var="row" partialTriggers="::cb1"
rows="#{bindings.User1.rangeSize}"
emptyText="#{bindings.User1.viewable ? identityBundle.no_data_to_display : identityBundle.access_denied}"
fetchSize="#{bindings.User1.rangeSize}" rowBandingInterval="0"
id="t1" rowSelection="multiple"
selectionListener="#{AssignRolesBean.onTableSelect}"
binding="#{AssignRolesBean.searchResultsTable}"
columnStretching="last">
<af:column sortProperty="firstname" sortable="#{AssignRolesBean.columnSortable}"
headerText="#{bindings.User1.hints.firstname.label}" id="c1"
width="136">
<af:outputText value="#{row.firstname}" id="ot4"/>
</af:column>
<af:column sortProperty="lastname" sortable="#{AssignRolesBean.columnSortable}"
headerText="#{bindings.User1.hints.lastname.label}" id="c2"
width="182">
<af:outputText value="#{row.lastname}" id="ot2"/>
</af:column>
<af:column sortProperty="mail" sortable="#{AssignRolesBean.columnSortable}"
headerText="#{bindings.User1.hints.mail.label}" id="c4"
width="361">
<af:outputText value="#{row.mail}" id="ot5"/>
</af:column>
<af:column sortProperty="uid" sortable="false"
headerText="#{bindings.User1.hints.uid.label}" id="c3"
visible="false">
<af:outputText value="#{row.uid}" id="ot3"/>
</af:column>
</af:table>
I have a selection listener only, I don't have a sort listener.
My bean;
AssignRolesBean
public void onTableSelect(SelectionEvent selectionEvent) {
GenericTableSelectionHandler.makeCurrent(selectionEvent);
My makeCurrent method
public static void makeCurrent( SelectionEvent selectionEvent){
RichTable _table = (RichTable) selectionEvent.getSource();
CollectionModel tableModel = (CollectionModel) table.getValue();
JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding) tableModel.getWrappedData();
DCIteratorBinding tableIteratorBinding = adfTableBinding.getDCIteratorBinding();
Object selectedRowData = table.getSelectedRowData();
JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding) selectedRowData;
Key rwKey = nodeBinding.getRowKey();
tableIteratorBinding.setCurrentRowWithKey( rwKey.toStringFormat(true));
SHOULD I IMPLEMENT A SORT LISTENER FOR THIS TABLE IN ORDER TO HANDLE ROW SELECTION PROPERLY AFTER SORTING?
Is there a guideline for handling row selection after sorting?
Thanks -
How to maintain selected row in adf table displayed after refresh
Hi,
I am using jdev 11g
I my jsf page I have a table with multiple rows.
When i scroll and click on one of the rows its selected but if the page is refreshed the row is always selected but not displayed.
I need to be able to maintain the selected row after the refresh of the page, so my table will look like its already scrolled to the selected row..
I tried to use the attribute displayRow="selected" but it won't do the trick.
Any hints
EmileHi Branislav,
Kindly answer the following if you may.
Is there a way to refresh the table after the selectListner is fired.
Automatically when i select the table i need to refresh it.
Why after refresh the selected row changes skin.
Regards -
Toad is not showing selected row number option on status bar???
plz help
i checked grid visual option it doesnt showing select rownumber option[email protected] wrote:
Toad is not showing selected row number option on status bar???TOAD? Oh.. and there I thought the title of this forum is SQL and PL/SQL.... my mistake...
So, can I ask some Compiz questions here? (after all, this is the window manager I used for SQL*Plus) -
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 -
Row selection messed up after sorting
JDev version: 11.1.1.4 (but also reproducable in 11.1.2.1)
See http://kpdwiki.be/Bart_L/tableIteratorSortSync.zip (open BO726.jws and run runThis.jspx)
Situation:
- iterator 'EmployeesIterator' which points to a view with Employees -> ChangeEventPolicy='none'
- Bindings which all point to this iterator:
- Tree binding 'Employees' used for an af:table with employees (firstname, lastname)
- Attribute bindings 'FirstName' and 'LastName' which is used in a formLayout to show the currently selected employee
- Operation Bindings to iterate through the employees (First, Previous, Next, Last)
- runThis.jspx
- formlayout with FirstName and LastName
-> partialtriggers: Next-button and table (for the rest, no partialtriggers)
- Next-button
- table with employees
Problem:
1) if you select one of the employees in the table, and sort one of the columns, the first row will be selected. This is normal behaviour
2)
a) select the first row
b) press the 'Next' button a few times. Now the selected employee in the iterator is 'X'
c) in the table, select employee 'X' by clicking on its row
d) sort one of the columns.
Result: In the iterator, the first row of the table is selected, while the table selection shows something different!
--> this is different behavior than the situation described in 1)
--> after doing something with the table (sorting, filtering, selecting rows, ...), I would expect that the selected row in the table is always the same as the selected row in the iterator.
Questions:
1) Is this a bug?
2) If yes, is this a known bug?
3) If no: am I doing something which is not allowed? Or should I do something different here?I can reproduce the problem in 11.1.1.4.
First employee is Steven King, which is selected. I then press next a few times till the output text reads Bruce Ernst (the table selection is still on Steven King, while the iterator points to Bruce Ernst). I then click on Bruce Ernst in the table, so it is selected (iterator stays on the same record). If I then sort the table, the table selection stays on Bruce Ernst, while the output text shows the first record in the table after the sort.
We have the same issue using a non-modal popup to edit table rows (non-isolated task flow, sharing data controls & transaction). Our edit popup has navigation controls. When we scroll through records in the popup, the table selection doesnt refresh (changeEventPolicy = none). If we then select the record in the table that we scrolled to in the popup , without closing the popup, and then sort the table (with the popup still open), the selection stays on the previously selected record, whille the popup shows the first record in the table after the sort. -
Edit a selected row in an alv report after pressing a push button ?
hi all ,
I want to edit a selected row in an alv report but that too after i press a push button . After pressing the push button , a pop up shud *** showing all the entries of the selected row which shud be editable and after editing it shud be saved into the database table.
How can i do this please help asap ???May this prog. of mine can solve your requirement.
REPORT z_demo_alv_jg.
TYPE-POOLS *
TYPE-POOLS: slis.
INTERNAL TABLES/WORK AREAS/VARIABLES *
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.
FIELD-SYMBOLS *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.
SELECTION SCREEN *
PARAMETERS: tabname(30) TYPE c,
lines(5) TYPE n.
START-OF-SELECTION *
START-OF-SELECTION.
Storing table name
p_table = tabname.
Create internal table dynamically with the stucture of table name
entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
LEAVE TO LIST-PROCESSING.
ENDIF.
Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>.
SORT i_fieldcat BY col_pos.
Select data from table
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS.
REFRESH <dyn_tab_temp>.
Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*& Form SET_PF_STATUS
Setting custom PF-Status
-->RT_EXTAB Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'Z_STANDARD'.
ENDFORM. "SET_PF_STATUS
*& Form user_command
Handling custom function codes
-->R_UCOMM Function code value
-->RS_SELFIELD Info. of cursor position in ALV
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.
Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.
Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.
Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>.
CASE r_ucomm.
When a record is selected
WHEN '&IC1'.
Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex.
IF sy-subrc = 0.
Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.
Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'Z_DEMO_PDF_JG'
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
Make all the fields input enabled except key fields
w_field-input = 'X'.
MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL.
ENDIF.
Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc = 0.
Read the modified data
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
If the record is changed then track its index no.
and populate it in an internal table for future
action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF.
ENDIF.
When save button is pressed
WHEN 'SAVE'.
Sort the index table
SORT i_index.
Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index.
LOOP AT i_index.
Find out the changes in the internal table
and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF.
ENDLOOP.
Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
REFRESH <dyn_tab_temp>.
Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table.
ENDIF.
ENDCASE.
rs_selfield-refresh = 'X'.
ENDFORM. "user_command
Regards,
Joy. -
Field should not display in the subtotal row in ALV report after sorting .
we have a requirement, after sorting and subtotaling, the output in ALV is -
vbeln amount1 amount2 amount3
123 11 12 13
123 12 13 14
123 23 25 27
133 11 12 13
133 12 13 14
133 23 25 27
Now the customer wants the ALV outpput in this fashion -
123 11 12 13
123 12 13 14
23 25 27 --->123 (vbeln) should not come in subtotaling row
133 11 12 13
133 12 13 14
23 25 27--->133(vbeln) should not come in subtotaling rowHi,
if it helps you could create a hierachy. In this way you can define the field catalog for the lines and for the subtotal columns. The only thing is that you would always show the subtotal rows.
You have references of hierachy alvs in
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f
ALV Hierarchy
alv hierarchy
In this case it also sorts
Sorting for ALV hierarchy
I hope it helps.
Edited by: Oscar Pecharroman on Aug 2, 2010 1:13 PM
Maybe you are looking for
-
I work in an office building with free Wifi to connect to the Internet. I want to be able to use this internetconnection, but at the same time I want to shield of my own wired network. I've made the following configuration: - fritz adsl modem / route
-
Group cursor on xml input ... HELP!
Hi all! I'm trying to create a group cursor on my xml data source. Can that be done? Or group cursor can only be created for groups constructed by sql query? I followed the example given in the help topics without any success. Could someone please he
-
When I open safari, I can pull up mail and facebook ok, but that's as far as I can go. It is frozen and dark. Also there is a lock emblem above the address line.
-
Hold Switch On and Off not working - Always ON
Hi, I am having a serious problem with Hold Switch which is all the times in ON condition though I am moving right and left. None of the buttons are working because its in Locked state. Hold switch is not working. Is it a product related issue where
-
Image on canvas prob...
Is there any way to know that whether an image is present at particular location on canvas or not? Actually, i have written a code that draws image on canvas and moving it randomly. I have to keep checking how many times the image passes through a re