Thursday, 13 September 2012

BOL Delete


DATA: lr_core TYPE REF TO cl_crm_bol_core.
*Get the BOL Core instance
lr_core = cl_crm_bol_core=>get_instance( ).
*Load the component set
lr_core->load_component_set( 'BP_APPL' ).
*------------------------------------------------------------
*Raise the query instance by passing the search object name
DATA:lr_query TYPE REF TO cl_crm_bol_query_service.
lr_query = cl_crm_bol_query_service=>get_instance(
                  iv_query_name = 'BuilContactPersonSearch' ).

DATA it_parms TYPE crmt_name_value_pair_tab.
DATA wa_parms TYPE crmt_name_value_pair.


wa_parms-name = 'CONP_NUMBER'.
wa_parms-value = '400788'.
APPEND wa_parms TO it_parms.

*Add the selection parameters
CALL METHOD lr_query->set_query_parameters
  EXPORTING
    it_parameters = it_parms.

*Get the result list
DATA:lr_result TYPE REF TO if_bol_entity_col.
lr_result = lr_query->get_query_result( ).

*Get the first entity in the result list
DATA:lr_entity TYPE REF TO cl_crm_bol_entity.
lr_entity ?= lr_result->get_first( ).

DATA lv_string TYPE string.
*-------------------------------------------------------
*Lock and modify the property
IF  lr_entity->lock( ) = if_genil_boolean=>true.
  lr_entity->delete( ).
*RV_STATUS = LR_CORE->ROOT_DELETE( iv_entity = LR_ENTITY ).
  lr_core->modify( ).

  DATA lv_transaction TYPE REF TO if_bol_transaction_context.
  lv_transaction = lr_core->get_transaction( ).
  lv_transaction->save( ).
  lv_transaction->commit( ).
  lr_core->modify( ).
ENDIF.

1 comment:

  1. coin casino - Best Bitcoin Casino 2021
    Coins Casino is a new and worrione exciting online casino offering more 인카지노 than 500 of febcasino the latest Bitcoin games to the gambling scene. We welcome players from all over the

    ReplyDelete