on ā2014 Dec 05 8:08 AM
Hi Experts,
I have a tree view in my component with OCA buttons to edit and delete
I have Issue in deleting the node I am using Confirmation popup for deletion
after deleting the node I removed the entity from collection but the node is not removed from the tree view
delete event code is as follows
DATA: lv_event TYPE string,
lv_index TYPE string,
lv_tab_index TYPE i,
lv_delete TYPE string,
lv_text TYPE string.
SPLIT htmlb_event_ex->event_defined AT '.' INTO lv_event lv_index.
gv_index1 = lv_index.
IF Gr_popup1 IS NOT BOUND.
CALL METHOD comp_controller->window_manager->create_popup_2_confirm
EXPORTING
iv_title = 'Delete'
iv_text = 'Are you sure ?'
iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_yesnocancel
RECEIVING
rv_result = gr_popup1.
Gr_popup1->set_on_close_event( iv_event_name = 'CONFIRM_POPUP_CLOSED'
iv_view = me ).
ENDIF.
gr_popup1->open( ).
CONFIRM_POPUP_CLOSED EVENT CODE
DATA: lv_tab_index TYPE i,
lr_entity TYPE REF TO cl_crm_bol_entity,
lr_entity1 TYPE REF TO cl_crm_bol_entity,
lr_mixed TYPE REF TO cl_bsp_wd_mixed_node,
lr_core TYPE REF TO cl_crm_bol_core,
lv_answer TYPE string,
lv_success TYPE boolean VALUE abap_false,
lv_transaction TYPE REF TO if_bol_transaction_context,
lr_msg TYPE REF TO cl_bsp_wd_message_service
.
lr_core ?= cl_crm_bol_core=>get_instance( ).
lv_answer = gr_popup1->get_fired_outbound_plug( ).
CASE lv_answer.
WHEN cl_gs_ptc_bspwdcomponent_cn01=>co_event_yes.
lv_tab_index = gv_index1.
lr_entity ?= me->typed_context->category->collection_wrapper->find( iv_index = lv_tab_index )..
IF lr_entity IS BOUND.
lr_entity1 ?= lr_entity->get_related_entity( iv_relation_name = 'PDResultCat' ).
IF lr_entity1 IS BOUND .
lr_entity1->delete( ).
me->gr_entity ?= lr_entity.
me->gv_flg = 'X'.
me->typed_context->category->collection_wrapper->remove( iv_bo = lr_entity ).
ENDIF.
ENDIF.
lr_core->modify( ).
* delete me->typed_context->category->node_tab INDEX gv_index1.
me->typed_context->category->refresh( ).
lr_msg = cl_bsp_wd_message_service=>get_instance( ).
CALL METHOD lr_msg->add_message
EXPORTING
iv_msg_type = 'S'
iv_msg_id = 'ZPD_MSG'
iv_msg_number = 007.
CLEAR gv_index1.
ENDCASE.
refresh method
DATA:lr_iterator TYPE REF TO if_bol_bo_col_iterator,
lr_entity TYPE REF TO cl_crm_bol_entity,
lr_entity1 TYPE REF TO cl_crm_bol_entity,
lr_root TYPE REF TO if_bsp_wd_tree_node,
lr_impl TYPE REF TO zl_zpd_tree_tree0_impl.
lr_iterator ?= me->collection_wrapper->get_iterator( ).
TRY.
lr_entity ?= lr_iterator->get_first( ).
CATCH cx_crm_genil_model_error. " Error when Accessing Object Model
ENDTRY.
WHILE lr_entity IS BOUND.
lr_entity1 ?= lr_entity->get_related_entity( iv_relation_name = 'PDResultCat' ).
lr_root ?= me->node_factory->get_proxy(
iv_bo = lr_entity1
iv_proxy_type = 'ZCL_PD_TREEBUTTON'
).
lr_root->node_key = add_root_node( iv_node = lr_root ).
lr_entity ?= lr_iterator->get_next( ).
ENDWHILE.
any help appreciated
Request clarification before answering.
Hello,
Create a Server event for the OCA Delete button. and donot call refresh button in the event handler.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.