Hi all gurus,
I'm working on an SRM 7 system, specifically on the WD Component /SAPSRM/WDC_CTR_DOTC_IT, view V_CTR_DODC_ITEMS.
In the view there's a table showing items of a contract; we created a custom button ("item deletion") which simply triggers a method that sets the field ZZ_DEL_IND value to 'X' for the selected line(s).
Here's the method code:
METHOD onactionzdelete . DATA lv_action TYPE /sapsrm/pdo_action_type. DATA lo_transaction_context TYPE REF TO /sapsrm/cl_transaction_context. * Get instance of transaction object lo_transaction_context ?= /sapsrm/cl_transaction_context=>/sapsrm/if_transaction_context~get_instance( ). * Set action id lv_action = 'DELETE_ITEM'. lo_transaction_context->set_current_action( iv_current_action = lv_action ). * start ZZDEL_IND management DATA : lon_ctr_item TYPE REF TO if_wd_context_node. DATA : lt_elem_set TYPE wdr_context_element_set. DATA : ls_element TYPE REF TO if_wd_context_element. DATA : deleted TYPE abap_bool. CALL METHOD wd_context->get_child_node EXPORTING name = 'CTR_ITEM' RECEIVING child_node = lon_ctr_item. * Get the selected elements of the item table lt_elem_set = lon_ctr_item->get_selected_elements( abap_true ). * for each selected element, set ZZ_DEL_IND value * Get the static attributes of all SELECTED elements into an internal table LOOP AT lt_elem_set INTO ls_element. CALL METHOD ls_element->set_attribute EXPORTING value = abap_true name = 'ZZ_DEL_IND'. CALL METHOD ls_element->set_changed_by_client EXPORTING flag = abap_true. ENDLOOP. CALL METHOD wd_comp_controller->mo_bom_ctr->/sapsrm/if_cll_bo_mapper~fire_event_refresh( ). ENDMETHOD.
Now, the problem:
- if I select a single row and press the button, ZZ_DEL_IND is set correctly for the selected row;
- if I select all the positions using the standard button SELECT->SELECT ALL , ZZ_DEL_IND is set correctly for all the selected rows;
BUT...
- if I select more than a single position (holding CTRL key down), ZZ_DEL_IND is NOT set.
In debug, I've seen that the problems are in the fire_event_refresh( ), which in case of single selection or all positions selected triggers correctly an update process, while in case of multiple selection "by hand" does not.
In details: /sapsrm/if_cll_bo_mapper~fire_event_refresh triggers a method:
me->/sapsrm/if_cll_xo_mapper~fire_event_update( )
which itself launches the update process:
me->fire_event_update( IMPORTING ev_update_performed = ev_update_performed )
Here, the method extracts all the mappers for the WD and loops over them to check for something changed:
LOOP AT lt_mapper ASSIGNING <ls_mapper>. CLEAR: lv_exception_occured, lv_update_performed. IF <ls_mapper>-mapper->is_ui_changed_by_client( ) EQ abap_true. ....
And that's the problem; when processing the mapper -> (in debug), I can see that:
- when a single row is selected, or all the rows are selected via "SELECT ALL" standard method, then the mapper results changed by client (the above condition is then satisfied)...
- while in case of multiple selection , is_ui_changed_by_client( ) = abap_false.
Has anyone suggestions on how to overcome this problem? I guess it deals with multiple selection process.
Thanks in advance