on ‎2004 Sep 24 10:36 AM
Hi,
I sorted my tableview by SERVER. This is working fine, however when I add a row problems start. My navigationmode is BYPAGE and I want to show the added row and select it. Selection I think I can manage with the attribute selectedRowkey, however to set the visibleFirstRow is a problem.
This attribute needs to be set before the call view. However the data is not sorted yet, so the index supplied is wrong.
Anyone any suggestions besides set sort to APPLICATION and do it myself?
Request clarification before answering.
I'm just started development of a BSP application. I'm using an HTMLB tableView and I'm going to need to sort the table. Does anyone have some sample code to do this that I could see before I go and re-invent the wheel?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've looked through SBSPEXT_HTMLB and SBSPEXT_TABLE and I could not find an answer for my problem.
<b>My scenario:</b>
I Can not put my select statement inside the "onCreate" event because I need variables that are being passed from a previous page in my select statement. So I do my select statement in the "onInitialization" event. This means I can not call my select statement everytime before the "onInputProcessing" is invoked.
<b>What the User Does:</b>
After the data is on the screen the user selects a row. The user then pushes a button on the screen to delete the record. I use CL_HTMLB_EVENT_TABLEVIEW to find out what row the user has selected. This works great. The problem now is my internal tables no longer have data in them. And none of the example code shows how to pull the values out of the table that is being displayed on the screen to the user.
<b>SO How can I actually delete the record the user chose from the SAP table:</b>
Since I'm using: tableview_event->prevselectedrowindex. and that returns the Row the user selected, what can I use to get the data from that row? All the other attributes I tried that looked promising are blank
<b>A little more information:</b>
I know I can use a combination of SELECTEDROWINDEX, SELECTEDROWKEY, and ALLCOLUMNNAMES to get the row the user selected and the value in the first field (key). It will also give me a list of all the avaliable column names. The only thing I'm missing is the values for the other fields I need.
<b>I could be successful:</b>
If I could Change the KEY of the display table so SELECTEDROWKEY could contain the values for the three fields I need
OR
If I could pull the values for each of the columns I need
Any thoughts here would be greatly appreciated. THanks,
Anthony
All of what you ask is not really possible. The very moment that you sort a table, all the index related stuff makes no sense. So, what you should do is use keys as much as possible, especially when setting the selected row, etc. You might have to also set (or reset) the first visible row to show you selected row (if this is important for you).
To set the visibleRow, do a READ TABLE with the key, and TRANSPORTING NO FIELDS. Then you can look at sy-tabix to have the index in the newly sorted table of where your selected row will be use. Use this as the first visible row.
Also look at SBSPEXT_TABLE for ideas.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Brian,
Maybe I stated it not all clear, but that is exactly what I did. So let me try to give an example.
Item 1
Key = 001
Date = 21.08.2004
Category = B
Item 2
Key = 002
Date = 22.08.2004
Category = C
Item 3
Key = 003
Date = 23.08.2004
Category = A
In the view selectedRowKey is set to field Key, and this works fine.
Lets say the visible rowcount is set to 2, and sort is on Date and Item 3 is selected.
Now I sort on category. I read the data binded table just before the call view. Problem is Item 3 is still at tabix 3. If I look at my table just after the call view, Item 3 is at tabix 1. Only now I cannot set the firstvisiblerow anymore.
Greetings,
Vincent
Hmmm... I read the text, but I failed to understand all of your remarks. Unfortunately the written word requires a lot more detail to paint the picture. We see the data. Who does the sorting where? What is the data binded table? Is there now suddenly also a selection problem? Why are we even talking about tabix here. We agreed that we are actually only interested in keys. So after sorting, the selected row still have key=003. So we now reread the table to find out that key=003 is on tabix=1 (this is only case where we want to have a tabix). So we set firstVisibleRow=tabix.
Maybe you can reduce your problem to about 25-50 lines of code. Use only one table, fill table with three items below. Show event handling and your sort logic.
Then we can paste into a test page and just understand where the road should have been.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.