ALV Grid OO : Set Field editable for selected rows
Hello ABAPers,
I used object cl_gui_alv_grid to created ALV grid and i succed to set an editable
field for all rows. However my request is to set it for and only for selected rows
I could get the row index but i didn't know how to use it
Thanks in advance
Amine
Hi Amine,
I think the standard SAP sample program might help you, BCALV_EDIT_02.
I will tell the procedure to make the selected rows editable on ALV.
1. Add a additional field of type LVC_T_STYL in the internal table that you are displaying in the ALV. LVC_T_STYL is a actually a table type.
2. Place a button on the ALV toolbar for EDIT/DISPLAY.
3. Once you press the EDIT button after selecting the rows, loop through the records which you have selected (you have already said that you have the index of selected records).
4. The table type LVC_T_STYL has fields for FIELDNAME and STYLE.
If you have 10 fields in the internal table, then all these ten fields name should be appended to the newly added field in the internal table (LVC_T_STYL) and their style should be populated with value cl_gui_alv_grid=>mc_style_enabled.
Regards,
Rahul MB
Similar Messages
-
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. -
How to set focus on a input field in a selected row of a table?
In a previous discussion (http://scn.sap.com/thread/3564789) I asked how to access an input (sap.m.Input) field of a selected row in a table. In the answer that was supplied I was shown how to get the items of the table. Then using the selected index to get the selected item get the cells. Then I could set editable on the proper cell(s). This worked fine.
Now I need to set the focus on one of the fields. I tried something like this:
var oNewLink = table.getSelectedItem();
var oNewLinkName = oNewLink.getCells()[1];
oNewLinkName.focus();
But this doesn't seem to work.
I have searched through other discussions and have seen this technique for putting focus on a field if you have its ID:
sap.ui.getCore().byId(id_of_the_input_field).$().focus();
In my case though I do not have an ID since the row and its cells are generated. How can I set focus on the cell of a certain row in a table?Hello Venkatesh. Yes that code does work. First I tried it on a table cell that was already rendered and it did work. The next time I tried it on a table row that was being added and it did not work there. So I added an on after rendering function for the table and added that code there. That did not work until I added a delay (timeout) to do a context switch before calling the focus and that worked.
Once last thing though sometimes when I call focus on an input field (actually in a table row cell) if the field has text in it already the flashing cursor is at the beginning of the text and other times it is at the end of the text (which is the desired way). It depends on where I click in the row. Is there anyway to make sure the flashing cursor is at the end of the text when the focus is applied to a field that contains text? -
How to download alv grid output(with field catalog) into excel file format
Hi all,
How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
Please help.
Regards,
Satya.Hi,
On list where alv is displayed, select export icon( green color -> ),select spread sheet.
This will display records in Excel sheet. -
ALV GRID with icon fields. When exports to Excel, icon fields are emtpy.
Hi all,
In our SAP system (6.0 ECC) we've noticed the following behaviour:
In ALV GRID with icons (color lights for example...) when we export the list to Excel format with the standard button bat, the icon column is always empty.
We think that in previous SAP version (4.7), the code corresponding to the icon appeared (For example @08@ for green light).
It's possible to have tha same functionality in this new version like in 4.7?
Regards.
Edited by: Ole ES on Nov 17, 2010 6:05 PMHi,
Check the format in which you export to Excel (MHTML, XML, ...) and try antoher one.
http://help.sap.com/saphelp_erp60_sp/helpdata/en/66/79ad48157f11d2953700a0c930328a/content.htm
I think the integrated Excel mode shows '@08@'.
Best regards,
Guillaume -
What makes a field eligible for selecting data in a subreport?
Hello,
I have posted the following question to [StackOverflow|http://stackoverflow.com/questions/4366702/what-makes-a-field-eligible-for-selecting-data-in-a-subreport], but it has so far generated no replies. I decided to cross-post it here to see if I could get a better result.
The TL;DR of it is that I have a field which I should be able to link in my Subreport, but it does not appear, and I was wondering what I need to do to make it appear.
I have a Crystal Report I'm trying to recreate from scratch after an update from VS2008 to VS2010 caused it to implode horribly.
I've gotten most of the way through, but I'm at a stage where I'm linking a field in the Main Report to a corresponding field in the Subreport.
I have set up a bunch of Database fields in the Subreport, I've added the table I want, TableA, I've linked it up as everything was linked in the original report, with TableA at the head of the linking chain, so that all the rows I want can be derived from the result of that first query ( Actually, all of the links from the original Report were red in the Database Fields linking dialog, whereas mine are a bit rainbow-y. All the links in TableA are red, though... _ )
In the "Subreport Links" dialog, I have an integer which I know is being pulled from the database correctly. I've added it in the "Fields to link to" listbox, and selected the newly-created parameter in the "Subreport parameter to use" combobox. I've ticked the "Select data in subreport based on field" checkbox.
The database field I want to link to then does not appear in the second combobox.
Another integer field in TableA shows up fine in the "Select data..." combobox (and is linked to another field being passed in), so I don't know why these two integer fields, which are equally important, and exist on the same level, on the same table, are being treated differently by the report designed.
Any ideas what I'm doing wrong?Here is what I'd do:
1) Download CR 2008 eval designer from here:
http://www.sap.com/solutions/sapbusinessobjects/sme/freetrials/index.epx
2) Try the linking in CR 2008 designer
3) If it does not work there, ask why not in the [CR design|SAP Crystal Reports, version for Visual Studio; forum.
4) If you get the linking working in the CR 200 designer, try to run the report in your VS2010 app (after ensuring the report woks as expected in CR 2008).
5) If (4) above works out for you, please let me know as this may be an issue with CRVS2010.
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports] -
How to set background color for selected days in DateChooser
How to set background color for selected days. I created
checkbox for each day [Son,Mon,Tue,Wed,Thu,Fri,Sat] and a
DateChooser, I want to change the background color for the selected
day when i click on a button after selecting the desired checkboxs
[ monthly wise/yearly wise]
Thanks in advanceThere is no button involved in the following code, but it may
be of use to you:
<?xml version="1.0"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="init()">
<mx:Script>
<![CDATA[
private var origColor:uint;
private function init():void {
origColor = dc.getStyle("selectionColor");
public function setBackGrdColors(newColor:uint):void {
dc.setStyle("selectionColor", origColor);
if(dc.selectedDate){
var dayOfWeek:Number = dc.selectedDate.day;
else{
return;
switch(dayOfWeek) {
case 0:
if(sun.selected)
dc.setStyle("selectionColor", newColor);
break;
case 1:
if(mon.selected)
dc.setStyle("selectionColor", newColor);
break;
case 2:
if(tue.selected)
dc.setStyle("selectionColor", newColor);
break;
case 3:
if(wed.selected)
dc.setStyle("selectionColor", newColor);
break;
case 4:
if(thu.selected)
dc.setStyle("selectionColor", newColor);
break;
case 5:
if(fri.selected)
dc.setStyle("selectionColor", newColor);
break;
case 6:
if(sat.selected)
dc.setStyle("selectionColor", newColor);
break;
default:
break;
]]>
</mx:Script>
<mx:VBox horizontalAlign="center" verticalGap="20">
<mx:DateChooser id="dc" textAlign="left"
change="setBackGrdColors(cellColor.selectedColor)"/>
<mx:HBox width="100%" horizontalAlign="center">
<mx:CheckBox id="sun" label="Sun"/>
<mx:CheckBox id="mon" label="Mon"/>
<mx:CheckBox id="tue" label="Tue"/>
<mx:CheckBox id="wed" label="Wed"/>
</mx:HBox>
<mx:HBox width="100%" horizontalAlign="center">
<mx:CheckBox id="thu" label="Thu"/>
<mx:CheckBox id="fri" label="Fri"/>
<mx:CheckBox id="sat" label="Sat"/>
</mx:HBox>
<mx:HBox width="300" horizontalAlign="center">
<mx:Label text="Background Color" />
<mx:ColorPicker id="cellColor"
selectedColor="#FF00FF"/>
</mx:HBox>
</mx:VBox>
</mx:Application> -
Color a specific row in ALV GRID display when user clicks on that row
hi
i have the entire code ready of how to check the line selected by the user and also to color that line but after settings those parameters
for to refresh the GRID so that the row apppears coloured .plz reply soon.... points will be awarded.....
wat i have done is
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
i_callback_user_command = 'USER_COMMAND'
is_layout = it_layout
it_fieldcat = int_fieldcat
TABLES
t_outtab = int
EXCEPTIONS
program_error = 1
OTHERS = 2.
to display the GRID then when user clicks on any row this module gets called
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
READ TABLE int INDEX rs_selfield-tabindex.
int-rowcolor = 'C410'.
MODIFY int INDEX rs_selfield-tabindex TRANSPORTING rowcolor.
it_layout-info_fieldname = 'ROWCOLOR'.
then again i call 'REUSE_ALV_GRID_DISPLAY'
to display the GRID with the user selected line colored . the problem with this is when u go back from this screen u go to the previously displayed grid ....... whihc i dont want .....
ENDFORM. "user_commandHi,
By using following code,you can set the colors for each row,
Change this based on your requirement.
TABLES VBAK.
TYPE-POOLS SLIS.
Data Declaration
TYPES: BEGIN OF T_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
NETWR TYPE VBAK-NETWR,
VKORG TYPE VBAK-VKORG,
VKGRP TYPE VBAK-VKGRP,
LINE_COLOR(4) TYPE C,
END OF T_VBAK.
DATA: IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0,
WA_VBAK TYPE T_VBAK.
ALV Data Declaration
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID TYPE SY-REPID.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BLD_FLDCAT.
PERFORM BLD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
Build Field Catalog for ALV Report
FORM BLD_FLDCAT.
FLDCAT-FIELDNAME = 'VBELN'.
FLDCAT-SELTEXT_M = 'Sales Document'.
FLDCAT-COL_POS = 0.
*FLDCAT-EMPHASIZE = 'C411'.
FLDCAT-OUTPUTLEN = 20.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERDAT'.
FLDCAT-SELTEXT_L = 'Record Date created'.
FLDCAT-COL_POS = 1.
FLDCAT-KEY = 'X'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERNAM'.
FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'AUDAT'.
FLDCAT-SELTEXT_M = 'Document Date'.
FLDCAT-COL_POS = 3.
FLDCAT-EMPHASIZE = 'C110'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VBTYP'.
FLDCAT-SELTEXT_L = 'SD Document category'.
FLDCAT-COL_POS = 4.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'NETWR'.
FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.
FLDCAT-COL_POS = 5.
FLDCAT-OUTPUTLEN = 60.
FLDCAT-DO_SUM = 'X'.
FLDCAT-DATATYPE = 'CURR'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VKORG'.
FLDCAT-SELTEXT_L = 'Sales Organization'.
FLDCAT-COL_POS = 6.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'VKGRP'.
FLDCAT-SELTEXT_M = 'Sales Group'.
FLDCAT-COL_POS = 7.
FLDCAT-EMPHASIZE = 'C801'.
APPEND FLDCAT TO FLDCAT.
CLEAR FLDCAT.
ENDFORM.
Build Layout for ALV Grid Report
FORM BLD_LAYOUT.
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
GD_LAYOUT-CONFIRMATION_PROMPT = 'X'. This asks the confirmation before leaving the screen.
ENDFORM.
Display report using ALV grid
FORM DISPLAY_ALV_REPORT.
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
IS_LAYOUT = GD_LAYOUT
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = 'SALES DOCUMENT HEADER'
IT_FIELDCAT = FLDCAT[]
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_VBAK
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.
Retrieve data from VBAK table and populate itab IT_VBAK
FORM DATA_RETRIEVAL.
DATA LD_COLOR(1) TYPE C.
SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG
UP TO 20 ROWS
FROM VBAK
INTO TABLE IT_VBAK.
LOOP AT IT_VBAK INTO WA_VBAK.
LD_COLOR = LD_COLOR + 1.
IF LD_COLOR = 8.
LD_COLOR = 1.
ENDIF.
CONCATENATE 'C' LD_COLOR '10' INTO WA_VBAK-LINE_COLOR.
MODIFY IT_VBAK FROM WA_VBAK.
ENDLOOP.
ENDFORM.
FORM TOP_OF_PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
W_HEADER TYPE SLIS_LISTHEADER.
W_HEADER-TYP = 'H'.
W_HEADER-INFO = 'WELCOME HEADER LIST'.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'REPORT:'.
W_HEADER-INFO = SY-REPID.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'DATE:'.
CONCATENATE SY-DATUM6(2) ' / ' SY-DATUM4(2) ' / ' SY-DATUM(4) INTO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER
ENDFORM.
Reward points,if it is useful.
Thanks,
chandu. -
Display and edit currently selected row of ADF Table in ADF Form
I have an ADF Read-only Table and ADF Form, which were created from the same Data Control.
I need to be able to edit the selected row of the table in the form (just like in "Binding Data Controls to your JSF page" part of "Developing RIA Web Applications with Oracle ADF" Tutorial). However, I can't figure out how to do this :(
I found the following solution on the Web: #{bindings.DeptView1.currentRow.dataProvider.dname} - but it doesn't work, since "the class oracle.jbo.server.ViewRowImpl does not have the property dataProvider".
Sorry for the newbie question.
Thanks in advance for any help!Hi,
AFAIK, dataProvider is not supported on ADF BC, hence the error.
If you have created ADF Read only table and form from the same data control you just need to refresh the form based on table selection to show up the selected record, to do which you just need to add partialTriggers property to the panelFormLayout and set its value to the id of table
Sireesha -
WAD - input locking for selected rows in planning querie!?
hello guys,
i need some ideas - in which way i can lock data entry functionality in IP query for selected rows? some rows in the query have an indicator S (sum) and some I (input). so i have a chance for selection, which rows are input rows and which rows are sum (dsiplay) rows.
but all rows are input ready in sap standard querydefiniton and i need some ideas how i could implement an row specific inputfunctionality.
example
ITEM KEYFIGURE
line 1 Input input ready
line 2 Input input ready
line 3 Sline display only/ no input
line 4 Input input ready
dataslices are no option, because i need to change the "Sline-rows" data via planning functions.
i need ideas for web, not excel.
thx for your ideas!
Edited by: David Jahn on May 4, 2010 2:03 PMHi David,
of course, it is possible to use two structures in BI-IP, e.g. one containing the key figures (may be restricted) and another one used in the rows where one uses only characteristic values. But then the number of lines in the row structure is static. It is possible to drill-down other characteristics as ususal.
One idea is to use you characteristic containing the 'S value' as a navigation attribute and to create a row structure containing two lines, one with the restriction # and one with S and the corresponding setting for input readyness (maybe a cell definition for input readyness is needed here). Then drill-down by the base characteristic of the navigation attribute. What is not so nice then that one will get a group change: drill-down characteristic by the row structure; but the system generated characteristic relationship for navigation attributes makes the non existing combinations not input ready.
Regards,
Gregor -
How get values of columns for selected rows in SortingTable
Hi,
is possible to get values of more columns for selected rows? I have SortingTable that have 1st column loaded from list and 2nd and 3rd columns are text areas where user must write some text. I need way how to get values from all three columns for selected rows.
My table looks like this:
System name I User Account I User Password
system1 ...............jblack ............. passw1
system2 ...............pdowe..............p@ssw
system3 ...............ekie................. pas123
Column System name is loaded from list, columns User Account and User Password are Text class. How can I get values for all three columns in case that I select e.g. system1 or system1 & system2?
I read [this post|http://forums.sun.com/thread.jspa?forumID=764&threadID=5220609] but there is described selection only for one column.
Code of my SortingTable is following:
<Field name='tblDalsiSystemy'>
<Display class='SortingTable'>
<Property name='align' value='center'/>
<Property name='sortEnable' value='false'/>
<Property name='selectEnable' value='true'/>
<Property name='pageSize' value='5'/>
<Property name='pageButtonAlign' value='center'/>
<Property name='columns'>
<List>
<String>System name</String>
<String>User Account</String>
<String>User Password</String>
</List>
</Property>
</Display>
<FieldLoop for='y' in='lstSystemList'>
<Field name='SystemName'>
<Display class='SortingTable$Row'>
<Property name='key'>
<ref>lstSystemList</ref>
</Property>
</Display>
<Display class='Label'>
<Property name='align' value='center'/>
<Property name='value'>
<ref>y</ref>
</Property>
</Display>
</Field>
<Field name='UserAccount'>
<Display class='SortingTable$Row'>
</Display>
<Display class='Text'>
<Property name='size' value='10'/>
<Property name='value'>
</Property>
</Display>
</Field>
<Field name='UserPassword'>
<Display class='SortingTable$Row'>
</Display>
<Display class='Text'>
<Property name='size' value='10'/>
<Property name='value'>
</Property>
</Display>
</Field>
</FieldLoop>
</Field>Getting value is performed by:
<ref>tblDalsiSystemy.selected</ref>Any help?
Thanks
PetrHi Ivan,
thanks for your advice - it works.
Here is my final code:
<Field name='tblDalsiSystemy'>
<Display class='SortingTable'>
<Property name='align' value='center'/>
<Property name='sortEnable' value='false'/>
<Property name='selectEnable' value='true'/>
<Property name='pageSize' value='5'/>
<Property name='pageButtonAlign' value='center'/>
<Property name='columns'>
<List>
<String>System name</String>
<String>User Account</String>
<String>User Password</String>
</List>
</Property>
</Display>
<FieldLoop for='y' in='lstSystemList'>
<Field name='SystemName'>
<Display class='SortingTable$Row'>
<Property name='key'>
<ref>lstSystemList</ref>
</Property>
</Display>
<Display class='Label'>
<Property name='align' value='center'/>
<Property name='value'>
<ref>y</ref>
</Property>
</Display>
</Field>
<Field name='Account[$(y)].login'>
<Display class='SortingTable$Row'/>
<Display class='Text'>
<Property name='size' value='10'/>
<Property name='value'>
</Property>
</Display>
</Field>
<Field name='Account[$(y)].passwd'>
<Display class='SortingTable$Row'/>
<Display class='Text'>
<Property name='size' value='10'/>
<Property name='value'>
</Property>
</Display>
</Field>
</FieldLoop>
</Field>Maybe it could be helpful for somebody another :-)
Petr -
hi ,
i need help on the below scenario ,
we have a web dynpro table with different columns, now based on new business requirement one of the column need to
dynamically editable or non editable for different row.
for ex :
Field 1
Field 2 ( Dynamic field )
Field 3
Field 4
Data 11
Data 12 ( Editable with Drop down )
data 13
data 14
Data 21
Data 22 ( Non editable )
Data 23
data 24
Data 31
data 32 ( Editable with drop down )
data 33
data 34
how to achieve this ? please help on this.
Thanks in advance
Thanks
ManishManish,
there is no proper way to insert two Cell Editors in a column(except variants), have a look on below scenario, it may help.
add one more attribute to your table context node for read-only.
create dropDown as celleditor for table and bind with newly created attribute to read-only property of dropdown.
before binding data to table, check the condition then mention readonly value abap_true / false.
@ we can achieve by the use of Variants.
for ex :
Data 11
Data 12 ( Editable with Drop down)
data 13
read-only - abap_false
Data 21
Data 22 ( Non editable, dropdown )
Data 23
read-only - abap_true
Data 31
data 32 ( Editable with drop down )
data 33
read-only - abap_false -
Howto set tool tip for a row in JTable
I want to set a seperate tool tip for each of the rows in JTable. I tried getting cell renderer of all columns in a row and then setting tool tip for them. I expected that setting tool tip for a cell renderer will set tool tip for that cell. Thus setting tool tip for all the cells in a row will indirectly set tool tip for that row. But it does not happen that way. By setting a tool tip for a renderer it will use that tool tip for all those cells which use that renderer.
Is there any problem in my approach or we cannot do this in Java.
regards.Thanks.You're wellcome.
>
I just saw this method in JComponent and realized this
solution.
But then thought that for doing this i'll have to
create my JTable class for just overiding one method
thereby increasing one more level of abstraction.Well, you could override the method in an inner class if I understand you correctly in assuming that you don't want to create a JTable as new separate class. You could do this:
JTable yourtable = new JTable() {
public String getToolTipText( MouseEvent e ) {
return getToolTipForRow( rowAtPoint( e.getPoint() ));
// some where else in your class
getToolTipForRow( int row ) {
// determine your tooltip here
}I think this would be a bit nicer and slightly faster approach because as far as I understand the getToolTipText() method is called after a similar MouseEvent for every JComponent i.e. a small pause of cursor movement over the component in question. I admit that I haven't tested either approach myself but noticed that JTable actually overrides the getToolTipText( MouseEvent e) method already. In your code you determine and set the tooltip every time the mouse moves. If you override getToolTipText( MouseEvent e) you have to determine the tooltip text only when the tooltip is actually about to be shown.
Regards, JMorko -
Commit statement for selected row
Hello,
I am working on an OAF page where there is a table region.
This table region is connected to a VO and the VO to a EO.
I have connected it to a EO because the user should be able to enter data directly to the table.
I have given a single save button at the bottom so that on clicking it, it takes to a handler function in my AM.
In the handler function, I getAllFetchedRows in an array and then one by one I perform checks and then save by calling getOADBTransaction.commit after doing vo.setAttribute( ) with the corrected values.
Now my problem is that while saving I am using the same EO being used in the above table. So even though I want to save line by line after performing checks programatically, the moment getOADBTransaction.commit is called for the first row, all the rows gets saved without even going through the checks.
Is there any other way of calling the commit so that it saves only the passed row and not all the rows.
Regards
HawkerHi Gyan,
I have done exactly like that. At first I fetch what the users have entered and then validate it and then I do setAttribute with the correct value.
And after looping for all the rows I finally commit.
I was initially thinking that if I set the attribute for one row and if I go to the next row the data in the earlier row would get lost.
But it has now worked nicey.
Regards -
Setting Non-Editable property for selected Rows in jTable
Hi,
I want particular rows to be set non-editable within a jTable. For example. If I have seven rows as follows:
1
2 - (Non-editable)
3
4
5 - (Non-editable)
6
7
I want to set non-Editable property to the second & Fifth Rows(say) alone. Other Rows, I may edit.
How can I do this?
Thanks in adv.TableModel has method
boolean isCellEditable(int rowIndex,
int columnIndex)
so you need to make your table model return false for these rows.
Maybe you are looking for
-
IPOD Mini - Updating Playlists
When I try to update my IPOD Mini, I get the following error message: "Songs on the IPOD cannot be updated because all of the playlists selected for updating no longer exist" How do I fix this?
-
when trying to retract information from BIW to Funds Management, what does the following error mean: Source type \CLASS=CL_ABAP_ELEMDESCR is not compatible, for the purposes of assignment, with target type \CLASS=CL_ABAP_STRUCTDESCR Message no. RS_EX
-
I just got my new macbook today but i just found the system is not updated
I got my first macbook today but i just found the system is not updated ( the system is OS X 10.8 (12A269), is that normal? now, im trying to update the system but I got three times unsuccessful updates. Should I pay for it? If I should, how come the
-
I cannot type into one of my pdf files. The cursor only appears where there is no typing. I believe there is foul play going on on my computer, Can you fix this problem?
-
Help - How do I Add a Trendline to a Stacked Column Chart??
I have a stacked column chart (NOT a 100% stacked column chart) and need to add a line to show the year goal. I can do this in Excel, but for some reason can't figure out how to do this in SSRS. I read various tutorials, blogs and MSDN pages but no