on 02-24-2014 5:11 AM
Hi Experts,
I have Cancel and back buttons on a table view.
When i try to edit an existing entry and then if i click back, the entry is getting saved with the edited value. itz fine.
But, if i click on cancel after editing, the new value should be restored back to the old value.
In my case, if i click on cancel, the entire entity is getting deleted from the view.
Here is my code for the event eh_oncancel.
DATA:
lr_coco TYPE REF TO cl_erp_note_bspwdcomponen_impl,
lr_iterator TYPE REF TO if_bol_bo_col_iterator,
lr_entity TYPE REF TO cl_crm_bol_entity.
lr_entity ?= me->typed_context->erptext->collection_wrapper->get_current( ).
CHECK lr_entity IS BOUND.
lr_iterator = me->typed_context->erptext->collection_wrapper->get_iterator( ).
cl_crm_uiu_erp_order_tools=>clear_and_delete_entity( ir_entity = lr_entity
ir_iterator = lr_iterator ).
IF lr_entity->alive( ) = abap_false.
me->typed_context->erptext->collection_wrapper->remove( lr_entity ).
lr_coco ?= me->comp_controller.
CHECK lr_coco IS BOUND.
lr_coco->typed_context->erptextset->collection_wrapper->publish_current( ).
ENDIF.
op_to_list( ).
Please suggest the way of restoring the old value, when i cancel the edited data.
Thanks....
Hi bkvs Sk,
As it is standard implemented menthod,
Can you please debug the EH_ONCancle method, check when the entity got deleted in both conditions
1. when cancel the edited values of existing entity
2. when cancel the newly added values.
And also check the whether the if condition get executed or not.
Thanks and regards,
Rajyalakshmi ch
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try using the below code for the event eh_cancel.
DATA lr_entity TYPE REF TO cl_crm_bol_entity.
DATA lr_tx TYPE REF TO if_bol_transaction_context.
lr_entity ?= me->typed_context->node->collection_wrapper->get_current( ).
lr_tx = lr_entity->get_transaction( ).
lr_tx->revert( iv_suppress_buffer_sync = abap_true ).
me->view_group_context->reset( ).
Regards,
Chiru
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bkvs Sk,
In your method can you please replace the below Piece of code
cl_crm_uiu_erp_order_tools=>clear_and_delete_entity( ir_entity = lr_entity
ir_iterator = lr_iterator ).
WIth the below code.
DAta: lr_cn TYPE REF TO cl_bsp_wd_context_node.
lr_cn = me->get_context_node( 'ERPTEXT' ).
cl_crm_uiu_bt_tools=>revert( lr_cn ).
Thanks & Regards,
Rajya lakshmi CH.
Hello,
You can check the implementation in cancel event of below view.
BP_CONT/BPCONTOverview or BP_HEAD/BPHEADOverview
Especially how ON EDIT entity is locked and from event handlers in the above views how method CL_CRM_BOL_CUSTOM_TX_CTXT=>ADD_TX_CONTEXT( ) is called. Then on CANCEL
CL_CRM_BOL_CUSTOM_TX_CTXT=>IF_BOL_TRANSACTION_CONTEXT~REVERT () is called.
If you refer above class you will get more idea.
Eg:
On EDIT: add the entities which are chaged
DATA: my_tx_context TYPE REF TO cl_crm_bol_custom_tx_ctxt.
CREATE OBJECT my_tx_context.
*
// 2. Add some single BO transactions
DATA: lv_entity1 TYPE REF TO cl_crm_bol_entity,
lv_entity2 TYPE REF TO cl_crm_bol_entity,
lv_tx_ctxt TYPE REF TO if_bol_transaction_context.
...
lv_tx_ctxt = lv_entity1->get_transaction( ).
my_tx_context->add_tx_context( lv_tx_ctxt ).
lv_tx_ctxt = lv_entity2->get_transaction( ).
my_tx_context->add_tx_context( lv_tx_ctxt ).
EN CANCEL
my_tx_context->revert().
me->typed_context->builheader->collection_wrapper->publish_current( ).
me->view_group_context->reset( ).
Regards
Ashik
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
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.