on 10-09-2008 2:46 PM
Hello!
I tried the Editing ALV tutorial and one part is not clear for me.
When pressing the save button you want to check the edited Data in an ALV grid.
METHOD onactionsave .
DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
* Check for changes
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_ref_interfacecontroller->data_check( ).
ENDMETHOD.
The tutorial now says
"Implement an event handler method for the interface event ON_DATA_CHECK with the following functionality"
Now my problem is. which events/methods are triggered to check the data? and to save the changes to the DB?
Which methods do i have to implement??
thanks!
but i don't know where to implement the ON_DATA_CHECK event trigger?
Because when i add the event in the event handler of my view, than is called onactionon_data_check! there is always the "onaction" part before.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
ON_DATA_CHECK event is triggered every time when you change the data in table.
You have to implement an Event handler method for event ON_DATA_CHECK and inside that method write a logic to validate and save to data base table.Please check below code.
You have a parameter r_param in the method.It will hold modified value.you can validate that value against check table and raise error message if it is not a valid input.check below code.
METHOD ondatacheck .
DATA: node_node_flighttab TYPE REF TO if_wd_context_node,
elem_node_flighttab TYPE REF TO if_wd_context_element,
lt_sflight TYPE if_resultview=>elements_node_flighttab.
save data only if no error has occured
CHECK r_param->t_error_cells IS INITIAL.
node_node_flighttab = wd_context->get_child_node( name = `NODE_FLIGHTTAB` ).
get data from context node <NODE_FLIGHTTAB>
node_node_flighttab->get_static_attributes_table(
IMPORTING table = lt_sflight ).
*validate value
select carrid from sflght into v_sflight where carrid = r_param-value.
if sy-subrc ne 0.
raise error message
else.
*update to the data base.
modify table zsflight from lt_sflight transporting carrid.
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried you sample code because I was having problems with inserting into my database.
I didn`t succed because of this "select carrid from sflght into v_sflight where carrid = r_param-value."
I know what is lt_sflight and probably zsflights is the database table that needs to be changed...But I don`t see any connection between these 2 and sflght and v_sflight. Should I use a READ INTO to make a connection?
Sorry, this is no answer, but I'm also interested in the ALV Edit Tutorial. Where can I find it ?
Thanks. Kind regards.
Carola
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Carola,
Below is tutorial about ALV edit.
Some other tutorials are..
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.