cancel
Showing results for 
Search instead for 
Did you mean: 

OVP and SAVE Method

stefan_kagelmacher
Participant
0 Kudos

Hello,

in my OVP Apllication I have included IF_FPM_TRANSACATION, so the componentcontroller has one SAVE method. Normally the method is called from edit page to save exactly one object (new or modified).

But I have on main page a list guibb with n objects. Based on this list it should be possible to save plentiful objects. So my idea at PROCESS_EVENT of guibb list:

LOOP AT it_selected_lines ASSIGNING <fs_selected_line>.

** Read main table with selected tabix.

** Bind the object to event data

    EXPORTING iv_key   = 'GO_BDM'
                       iv_value = me->go_bdm_app->go_bdm ).

  lo_fpm = cl_fpm_factory=>get_instance( ).
  lo_fpm->raise_event_by_id( iv_event_id = if_fpm_constants=>gc_event-save
                                          io_event_data = io_event->mo_event_data ).

ENDLOOP.

The data binding to actual object works fine. I thought, for every row the runtime event method SAVE is fired. But process_event is completely run through and then SAVE method is called n-times (count of table rows). And the rather problem is that SAVE method every call includes the same event with the same data binding. So I can only save the last or the first object, but always still the same through processing.

Is this normal. Should Save method called only for one object?

Thanks for answering.

Best regards.

** Call save event

  io_event->mo_event_data->set_value(

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member193369
Active Participant
0 Kudos

Hello Stefan,

if you are raising an FPM event while another event is running, it will not be executed immediately but appended to the FPM event queue. Only when the currently running event (and all others already in the queue) are finished successfully then the new event loop will be started.

Furthermore during your loop you always add the same event (same ID and same event data) to the queue, so I completely don't understand why you exepect to get different events later on in the SAVE method.

In my opinion it's not a good idea at all to raise multiple save events. You should instead add the selected lines (or objects, keys, whatever you need) to the event data of the current event (you can store there tables as well) and then during the Save method in your IF_FPM_TRANSACTION class/component save all those changed objects at once.

Best regards,

  Christian