on 04-23-2009 3:40 PM
Hi Experts,
Can any one help me with making ALV table editable.
I have to display table( initially empty ) in editable mode.
I have to make the whole table editable, all the dispalyed rows ( even if there is no data ) and columns.
Kindly assist.
Thanks,
Siva.
Hi All,
Thanks for the valuable inputs.
The code works.
However, it shows the row editable only when append row is clicked.
Or, only if the data is available , its editable.
I need to make all the rows editable, even if its empty.
Its like i have to show a cloumn with 10 empty rows.
Kindly assist.
Thanks,
Siva.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
Append a few empty rows to your internal table and bind it. You can do this in WDDOINIT method.
This way when u run the application you would see editable rows in your table layout.
Data: wa_att type if_viewname=>element_viewname,
tab_att type if_viewname=>elements_viewname.
data: l_node typre ref to if_wd_context_node.
l_node = wd_context->get_child_node( 'Node Name' ).
append wa_att to tab_att.
l_node->bind_table( tab_att ).
Using this code you will see one editable row in your table layout. Similarly you can add multiple rows.
Try this, hope it helps.
Regards.
Hi,
there are few ways where you can prompt the user to add records into ur ALV table, you could create a button that pop up a screen and allow users to enter data and save it into your table. second a method is to use
the standard ALV insert/append row, read the user input and insert it into your table.
however if you just wanna display bunch of editable records, you have to have rows in your table, I dont know what sort of table are you creating, and how often it is
gonna be used, but If I were you i would create bunch of empty rows using transaction se16 ( each row must have a unique Primary key though). display those empty rows in ur ALV table, and make them editable.
I hope that helps
regards,
Abdul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sivasankar,
I think i got what you are trying to say. the ALV table layout you see that looks like rows are not
actually editable rows, you have to insert/append rows to be able to edit them.
There might be a way where you can insert number of rows into your ALV in the Initial screen
here is a screenshot of what I'm talking about.
[ALV_TABLE|http://img122.imageshack.us/img122/8881/alvtable.png]
Regards,
Abdul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Set the read only property if the ALV to false as follows
*Set the table Editable
l_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
Create "Input field" Cell Editor for all the columns in the ALV
* set cell editor for input fields (~make column editable)
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
lr_column_settings ?= l_value.
lr_column = lr_column_settings->get_columns( 'Attribute Name' ).
CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'Attribute Name.
lr_column->set_cell_editor( lr_input_field ).
Regards,
Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sivasankar,
here is what I did to make my ALV table editable, its fairly simple
1. get the component reference ( abap code wizard)
2. get the model
3. create input objects and assign them to columns
4. set the table on editable mode
5 (OPTIONAL) disable some ALV standard buttons
Here is an example that might help ( place this code inside WDDOINIT method 😞
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
lr_columns type ref to cl_salv_wd_column.
** u can get the component reference and model from the code wizard
create component
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
get model
DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
lo_INTERFACECONTROLLER = wd_this->wd_cpifc_alv( ).
DATA lo_value TYPE ref to cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
).
*** here you create an input field and assign it to your columns*
*** in your case you should create input fields for all your column*
*** make sure you enter the column name correct,otherwise you will get a Access NULL Error*
set cell editor for input fields (~make columns editable )
lr_column_settings ?= lo_value.
lr_columns = lr_column_settings->get_column( 'STATUS' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'STATUS'.
lr_columns->set_cell_editor( lr_input_field ).
lr_columns = lr_column_settings->get_column( 'COMMENTS' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'COMMENTS'.
lr_columns->set_cell_editor( lr_input_field ).
set read only mode to false (and display edit toolbar)
data: lr_table_settings type ref to if_salv_wd_table_settings.
lr_table_settings ?= lo_value.
lr_table_settings->set_read_only( abap_false ).
*** this is optional, if you would like to disable some buttons in the standard ALV menu bar*
set check button to disable
lo_value->if_salv_wd_std_functions~SET_EDIT_CHECK_AVAILABLE( abap_false ).
Regards,
Abdul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Regards,
Abdul
Edited by: Abdul kourani on Apr 23, 2009 5:34 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.