on 03-08-2007 12:27 PM
Hi ,
I have enabled the button to append rows at the end of an alv in webdynpro. But do i require to code separately to actually insert the row or is enabling this button enough? Clicking the button does not insert a row. Could someone help me in appending and deleting rows from the alv grid in webdynpro?
also i need to check what data has been changed and then save it in the database tables? any pointers?
regards,
Priyank
Hi Priyank,
Ideally this should have worked. But since it is not working i would suggest you one very crude of doing this, which hopefully will work ;-).
Every action triggers ON_FUNCTION event of ALV so create a event handler for this event in your view and check for the event that has triggered this, you can read the importing parameters value for same, and based on the event/function call the local method which will add one more entry to the table and bind it to the context node to which ALV has been bound to, similarly you may perform other operations as well. Bt the way did you try enabling "Lead select" for your ALV ? that might be the reason, although this sounds weired.
I hope atleast this helps.
Regards,
Anoop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Priyank,
For row selection you can use :
if_salv_wd_table_settings~set_row_selectable( value = abap_true ).
and for addition and deletion of rows all you need to do is insert blank entry into your internal table and then again bind it to the node( the node which acts as data entry node for ALV) .. and for deletion remove the entry from internal table by selecting it based on index and then bind it to the node ..
In case you have any further query then I might not respond before Monday but dont worry there are too many gurus here to help you out
Have a nice weekend ..
Just incase you forgot the developerd mantra .. well it goes something like this
"Work hard and party HARDER" 😄
Regards,
Anoop
....And for data check you may use the following standard method which triggers a event and can be handled by you ..
REFERENCE->if_salv_wd_table_settings~set_data_check( value =
if_salv_wd_c_table_settings=>data_check_on_cell_event ).
I hope this helps.
Regards,
Anoop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anoop,
Thanks for the reply.
I mentioned that i was able to see the buttons for insert and append row but i could not see a row being appended into the alv grid.
Following is my code for the method DOINIT, please suggest what i can change to make this working.
**********************
METHOD wddoinit .
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table ,
lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lr_column_header TYPE REF TO cl_salv_wd_column_header,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
lv_bool TYPE boolean.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
DATA:
l_value TYPE REF TO cl_salv_wd_config_table.
l_value = l_ref_interfacecontroller->get_model(
).
lr_table_settings ?= l_value.
lr_table_settings->set_read_only( abap_false ).
lr_table_settings->set_enabled( abap_true ).
**set individual fields as editable
***Set field SAFRA as editable
lr_column_settings ?= l_value.
**ITEM
lr_column = lr_column_settings->get_column( 'ZITEM' ).
CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'ZZSAFRA'.
lr_column->set_cell_editor( lr_input_field ).
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( 'ITEM' ).
**SAFRA
lr_column = lr_column_settings->get_column( 'ZZSAFRA' ).
CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'ZZSAFRA'.
lr_column->set_cell_editor( lr_input_field ).
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( 'SAFRA' ).
**ZZINSAFRA editable
lr_column = lr_column_settings->get_column( 'ZZINSAFRA' ).
CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'ZZINSAFRA'.
lr_column->set_cell_editor( lr_input_field ).
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( 'Data Inicio' ).
**ZZFIMSAFRA editable
lr_column = lr_column_settings->get_column( 'ZZFIMSAFRA' ).
CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'ZZFIMSAFRA'.
lr_column->set_cell_editor( lr_input_field ).
lr_column_header = lr_column->get_header( ).
lr_column_header->set_text( 'Data Fim' ).
**invisible columns
l_value->if_salv_wd_column_settings~delete_column( 'MANDT' ).
l_value->if_salv_wd_column_settings~delete_column( 'BUKRS' ).
l_value->if_salv_wd_column_settings~delete_column( 'ERNAM' ).
l_value->if_salv_wd_column_settings~delete_column( 'AEDAT' ).
l_value->if_salv_wd_std_functions~set_pdf_allowed( abap_false ).
l_value->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_true ).
l_value->if_salv_wd_std_functions~is_edit_append_row_allowed( RECEIVING value = lv_bool ).
ENDMETHOD.
***************************************
regards,
Priyank
Hi Priyank.
Did you checked the https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/webcontent/uuid/60ea94e5-0901-0010-c3bb-aad5ea9620d8">tutorials [original link is broken] [original link is broken] for ALV out?
Especially the tutorial about events should be interesting for you.
Cheers,
Sascha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sascha,
Thanks for the reply. I did check the tutorials but i could only find how to enable the append row button (by setting the read only to false for the alv). But once i click on the append row button that is now visible, there is no row appended to it. Could you please tell me how i can achieve this?
Hi Priyank,
You were not able to see the buttons since you had not made the ALV "editable" by setting the default "read-only" flag to false.. well even i was facing this issue but now with his help i have been able to get the buttons and make my alv editable .. the code here is generic and you need to look out for the reference to component rest all remains same ..
copy this code in WDDOINIT ..
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_use_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
DATA:
lr_if_controller TYPE REF TO iwci_salv_wd_table,
lr_cmdl TYPE REF TO cl_salv_wd_config_table,
lr_column TYPE REF TO cl_salv_wd_column,
lt_column TYPE salv_wd_t_column_ref,
ls_column TYPE salv_wd_s_column_ref,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
get reference to the ALV model
lr_if_controller = wd_this->wd_cpifc_use_alv( ). "supposed your reference is called alv
lr_cmdl = lr_if_controller->get_model( ).
lr_cmdl->if_salv_wd_table_settings~set_read_only( value =
abap_false ).
lr_cmdl->if_salv_wd_table_settings~set_enabled( value =
abap_true ).
lr_cmdl->if_salv_wd_table_settings~set_data_check( value =
if_salv_wd_c_table_settings=>data_check_on_cell_event ).
lt_column = lr_cmdl->if_salv_wd_column_settings~get_columns( ).
LOOP AT lt_column INTO ls_column.
lr_column = lr_cmdl->if_salv_wd_column_settings~get_column(
ls_column-id ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = ls_column-id.
lr_column->set_cell_editor( lr_input_field ).
lr_input_field->set_read_only( value = abap_false ).
lr_input_field->set_enabled( value = abap_true ).
ENDLOOP.
disable print button
lr_cmdl->if_salv_wd_std_functions~set_pdf_allowed( abap_false ).
DATA: lv_bool TYPE boolean.
lr_cmdl->if_salv_wd_std_functions~set_edit_append_row_allowed(
EXPORTING
value = ABAP_TRUE
).
lr_cmdl->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_true ).
lr_cmdl->if_salv_wd_std_functions~is_edit_append_row_allowed( RECEIVING
value = lv_bool ) .
ENDMETHOD.
I must say this will not resolve your issue 100% but yes i am sure once you have pasted this code you on your own will be able to resolve the same .. it will just require some minor settings to be done ..
Hope this helps. If your query is resolved please close this thread after awarding points to deserving posts.
Regards,
Anoop
User | Count |
---|---|
85 | |
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.