Quantcast
Channel: SCN : All Content - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 4552

OCA button is not deleting the record from list

$
0
0

Hi,

I am trying to delete the record from list in contact history assignment block, when i click the delete button, record is not getting deleted from list, still it is available. below is the code in method on_one_click_action()....

 

 


lr_current ?= typed_context->builinteracthist->collection_wrapper->get_current( ).

   lr_entity ?= lr_current.

   SPLIT htmlb_event_ex->event_defined AT'.'INTO lv_event lv_indx.
   CASE lv_event.
     WHEN'DELETE' .
       DATA: ls_inthist TYPE CRMT_BUPA_IL_INT_HISTORY ,
             lr_inthist TYPEREFTO cl_crm_bol_entity.
       lr_core = cl_crm_bol_core=>get_instance( ).

       lr_current->get_properties( IMPORTING es_attributes = ls_inthist ).
       lr_inthist = lr_core->get_root_entity( iv_object_name = 'BTOrder'
                                               iv_object_guid = ls_inthist-guid ).

*     Lock the activity. if locking fails nothing happens
       TRY.
           IF lr_inthist->is_locked( ) = abap_false.
             CALLMETHOD lock_dependent_entity
               EXPORTING
                 ir_entity      = lr_inthist
               RECEIVING
                 rv_success     = lv_success
               EXCEPTIONS
                 entity_deleted = 1
                 OTHERS         = 2.

             IF sy-subrc NE0OR lv_success = abap_false.
               EXIT.
             ENDIF.
           ENDIF.
         CATCH cx_bol_exception cx_sy_ref_is_initial cx_sy_no_handler.
       ENDTRY.


**     Lock the entity if locking fails nothing happens
       IF lr_entity->is_locked( ) = abap_false.
         CALLMETHOD lock_dependent_entity
           EXPORTING
             ir_entity      = lr_entity
           RECEIVING
             rv_success     = lv_success
           EXCEPTIONS
             entity_deleted = 1
             OTHERS         = 2.

         IF sy-subrc NE0OR lv_success = abap_false.
           EXIT.
         ENDIF.
       ENDIF.

if lr_entity->lock( ) = abap_true.
         lr_customer_h_coll ?= lr_inthist->get_related_entities_by_bpath( iv_bpath_statement = './BTOrderHeader/BTHeaderCustExt/*' ).
         lr_customer_h_ent ?= lr_customer_h_coll->get_current( ).
         if lr_customer_h_ent isbound.
           lv_bool =  lr_customer_h_ent->IS_PROPERTY_READONLY( IV_ATTR_NAME = 'ZZ_INACTIVE' ).
           if lv_bool = abap_true.
             CALLMETHOD lr_customer_h_ent->REREAD
               EXPORTING
                 IV_INVALIDATE_CHILDREN = ABAP_FALSE.
             CALLMETHOD lr_customer_h_ent->SWITCH_TO_CHANGE_MODE
               RECEIVING
                 RV_SUCCESS = lv_bool.
           endif.

           if lv_bool = abap_false.
             lr_customer_h_ent->set_property_as_string( iv_attr_name = 'ZZ_INACTIVE'  iv_value     = 'A' ).
           endif.

           me->typed_context->BUILINTERACTHIST->collection_wrapper->remove( lr_current ).
*          lr_entity->delete( ). "exvneela change on 15-7-2013
           lr_core = cl_crm_bol_core=>get_instance( ).
           if lr_core isbound.
             lr_core->modify( ).
             lr_tx = lr_inthist->get_transaction( ).
             if lr_tx->save( ) = abap_true.
               lr_tx->commit( ).
             else.
               lr_tx->rollback( ).
             endif.
           endif.

 

          lr_entity->reread( ).

           me->typed_context->BUILINTERACTHIST->collection_wrapper->publish_current( ).

 

 

is there any problem in my code ?

 

Best Regards,

Neelam


Viewing all articles
Browse latest Browse all 4552

Trending Articles