Hi Viktor,
Please find the below code.
METHOD eh_onaction.
*CALL METHOD SUPER->EH_ONACTION
* EXPORTING
* IV_EVENT_NAME = IV_EVENT_NAME.
DATA: lv_action_set TYPE REF TO cl_crm_bol_entity,
lv_actions TYPE REF TO if_bol_entity_col,
lv_action TYPE REF TO cl_crm_bol_entity,
lv_entity TYPE REF TO cl_crm_bol_entity,
lr_ent2 TYPE REF TO cl_crm_bol_entity,
lr_core TYPE REF TO cl_crm_bol_core,
lr_col TYPE REF TO if_bol_entity_col,
lr_marked TYPE REF TO if_bol_bo_col,
lr_cucompl TYPE REF TO cl_bt120h_c_bspwdcomponen_impl,
lv_ttype TYPE string,
lv_msgv TYPE symsgv,
lr_msg_srv TYPE REF TO cl_bsp_wd_message_service,
lv_dummy TYPE c LENGTH 1. "#EC NEEDED
lr_core = cl_crm_bol_core=>get_instance( ).
lr_marked = me->typed_context->btadmini->collection_wrapper->get_marked( ).
IF lr_marked IS BOUND.
IF lr_marked->size( ) = 1.
lv_entity ?= lr_marked->get_first( ).
CHECK lv_entity IS BOUND.
lv_action_set = lv_entity->get_related_entity( iv_relation_name = 'BTItemAction' ).
IF lv_action_set IS BOUND.
TRY.
lv_action_set->execute( iv_method_name = 'ACIDetermine' ).
CATCH cx_crm_genil_model_error
cx_crm_bol_meth_exec_failed.
ENDTRY.
lv_actions = lv_action_set->get_related_entities( iv_relation_name = 'ACIInactiveActionRel' ).
IF lv_actions IS BOUND.
lv_action ?= lv_actions->get_first( ).
WHILE lv_action IS BOUND.
lv_ttype = lv_action->get_property_as_string( 'TTYPE' ).
IF lv_ttype = iv_event_name.
TRY.
lv_action->execute( iv_method_name = 'ACIActivate' ).
lv_entity->set_property( iv_attr_name = 'MODE' iv_value = '' ).
CATCH cx_crm_genil_model_error
cx_crm_bol_meth_exec_failed.
ENDTRY.
lr_ent2 ?= me->typed_context->btitems->collection_wrapper->get_current( ).
lr_col ?= lr_ent2->get_related_entities( iv_relation_name = 'BTOrderItemAll' iv_mode = cl_crm_bol_entity=>bypassing_buffer ).
IF lv_ttype = 'ZSUBST_DEL'.
DATA : lr_btadmini TYPE REF TO cl_crm_bol_entity,
lv_serial TYPE string,
lv_itemno TYPE crmt_item_no,
lr_iterator TYPE REF TO if_bol_entity_col_iterator.
CALL METHOD lr_col->get_iterator
RECEIVING
rv_result = lr_iterator.
CALL METHOD lr_iterator->get_first
RECEIVING
rv_result = lr_btadmini.
WHILE lr_btadmini IS BOUND.
CALL METHOD lr_btadmini->if_bol_bo_property_access~get_property_as_value
EXPORTING
iv_attr_name = 'NUMBER_INT'
IMPORTING
ev_result = lv_itemno.
IF lv_itemno = '30'.
IF lr_btadmini IS BOUND.
CALL METHOD lr_btadmini->set_property
EXPORTING
iv_attr_name = '/RCRM/F005V'
iv_value = ' '.
***today changeSeptmber 2nd 2015
CALL METHOD lr_btadmini->set_property
EXPORTING
iv_attr_name = '/RCRM/F005T'
iv_value = '1000'.
****today chnge septmber 2nd 2015
CALL METHOD lr_col->add
EXPORTING
iv_entity = lr_btadmini.
EXIT.
ENDIF.
ENDIF.
CALL METHOD lr_iterator->get_next
RECEIVING
rv_result = lr_btadmini.
ENDWHILE.
ENDIF.
*****************return solc set 1000 defualt septmber 2nd 2015
IF lv_ttype = 'YCREATERTNREQ1'.
CALL METHOD lr_col->get_iterator
RECEIVING
rv_result = lr_iterator.
CALL METHOD lr_iterator->get_first
RECEIVING
rv_result = lr_btadmini.
WHILE lr_btadmini IS BOUND.
CALL METHOD lr_btadmini->if_bol_bo_property_access~get_property_as_value
EXPORTING
iv_attr_name = 'NUMBER_INT'
IMPORTING
ev_result = lv_itemno.
IF lv_itemno = '20'.
IF lr_btadmini IS BOUND.
CALL METHOD lr_btadmini->set_property
EXPORTING
iv_attr_name = '/RCRM/F005T'
iv_value = '2999'.
CALL METHOD lr_col->add
EXPORTING
iv_entity = lr_btadmini.
EXIT.
ENDIF.
ENDIF.
CALL METHOD lr_iterator->get_next
RECEIVING
rv_result = lr_btadmini.
ENDWHILE.
ENDIF.
*********** return sloc value should set 1000 Septbmber 2nd 2015
*****************************************
me->typed_context->btadmini->collection_wrapper->set_collection( lr_col ).
me->typed_context->btadmini->collection_wrapper->find( iv_bo = lv_entity ).
lr_cucompl ?= me->comp_controller.
lr_cucompl->force_save = abap_true.
EXIT.
ENDIF.
lv_action ?= lv_actions->get_next( ).
ENDWHILE.
ENDIF.
lv_actions = lv_action_set->get_related_entities( iv_relation_name = 'ACIActiveUnprocessedActionRel' ).
IF lv_actions IS BOUND.
lv_action ?= lv_actions->get_first( ).
WHILE lv_action IS BOUND.
DATA lv_dispatch TYPE i.
lv_ttype = lv_action->get_property_as_string( 'TTYPE' ).
lv_dispatch = lv_action->get_property_as_string( 'DISPATCH' ).
IF lv_ttype = iv_event_name AND lv_dispatch = 3. "immediate only
TRY.
lv_action->execute( iv_method_name = 'ACIExecute' ).
lv_entity->set_property( iv_attr_name = 'MODE' iv_value = '' ).
CATCH cx_crm_genil_model_error
cx_crm_bol_meth_exec_failed.
lv_msgv = lv_action->get_property_as_string( 'TTYPEDESCR' ).
MESSAGE e028(crm_complaint) WITH lv_msgv INTO lv_dummy. "#EC *
lr_msg_srv = me->view_manager->get_message_service( ).
IF lr_msg_srv IS BOUND.
lr_msg_srv->add_message( iv_msg_type = sy-msgty
iv_msg_id = sy-msgid
iv_msg_number = sy-msgno
iv_msg_v1 = sy-msgv1
iv_important_info = abap_true ).
ENDIF.
TRY.
lv_action->execute( iv_method_name = 'ACIDeactivate' ).
CATCH cx_crm_genil_model_error
cx_crm_bol_meth_exec_failed.
EXIT.
ENDTRY.
EXIT.
ENDTRY.
lr_ent2 ?= me->typed_context->btitems->collection_wrapper->get_current( ).
lr_col ?= lr_ent2->get_related_entities( iv_relation_name = 'BTOrderItemAll' iv_mode = cl_crm_bol_entity=>bypassing_buffer ).
me->typed_context->btadmini->collection_wrapper->set_collection( lr_col ).
me->typed_context->btadmini->collection_wrapper->find( iv_bo = lv_entity ).
lr_cucompl ?= me->comp_controller.
lr_cucompl->force_save = abap_true.
EXIT.
ENDIF.
lv_action ?= lv_actions->get_next( ).
ENDWHILE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
Thanks & Regards
Kalpana