cancel
Showing results for 
Search instead for 
Did you mean: 

Save Button in an editable ALV

Former Member
0 Kudos

Hi all,

I have an editable ALV, where I am able to change the input in one column. But how can I reach, that the changes can be saved? I created a save button in my view with the following onaction method:

METHOD onactionsave_changes .

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.

Then I implemented the event handler method on_Data_Check in the componentcontroller:

METHOD on_data_check .

DATA: node_node_dispo_tab TYPE REF TO if_wd_context_node,

elem_node_dispo_tab TYPE REF TO if_wd_context_element,

lt_dispos TYPE if_componentcontroller=>elements_node_dispo_tab.

*navigate from <CONTEXT> to <NODE_dispo_tab> via lead selection

node_node_dispo_tab = wd_context->get_child_node( name =

`NODE_DISPO_TAB` ).

  • get data from context node <NODE_DISPO_TAB>

node_node_dispo_tab->get_static_attributes_table(IMPORTING table = lt_dispos

).

  • save data to database

  • Create success message

  • get message manager

DATA: l_current_controller TYPE REF TO if_wd_controller,

l_message_manager TYPE REF TO if_wd_message_manager.

l_current_controller ?= wd_this->wd_get_api( ).

CALL METHOD l_current_controller->get_message_manager

RECEIVING

message_manager = l_message_manager.

  • report message

CALL METHOD l_message_manager->report_success

EXPORTING

message_text = 'Data was successfully saved.'.

ENDMETHOD.

But if I change Data in the ALV in my Web Dynpro I cannot save anything. If I ckicl on the Save Button, the old data is shown again and the changes are lost. How can I reach that my changes are changed in my database table? Where are my errors?

Thanks a lot!!

Ingmar

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

.

former_member182190
Active Participant
0 Kudos

Hi ,

Update the database and then commit in ur ondatacheck method.

In ur WddomodifyView again fetch data from the database n bind to the context.

Hope this is of some help.

Regards,

Ismail.

Former Member
0 Kudos

Thanks for your answer. Could you please be a little bit more detailed and help me with some code?

Thanks in advance!!

Best regards

Ingmar

Former Member
0 Kudos

I took the code above from the turorial "Editing ALV in WD4a" and I found following sentence:

Hint: In this tutorial the save functionality is only simulated to not change the flight data model content.

Now is the question, how to do a NON-simulated save functionality??

Best Regards

Ingmar