on 09-16-2014 10:46 AM
Hello All,
I have added 3 fields in Sales Order creation form called "Reference" 'Reference ID" and "Reference Desc".These fields are already available in Daily Activities creation page.I copied the same logic to Sales order component .
But i am getting an exception while crearting the sales order.
Exception Class CX_BOL_EXCEPTION - Access Previously Deleted Entity
Method: CL_CRM_BOL_CORE=>REREAD_ENTITY
Source Text Row: 137
Here is my piece of code in Do_Prepare_output method ,which i copied from Daily Activities component.
CALL METHOD super->do_prepare_output.
lr_docflowset ?= me->ztyped_context->btdocflowset->collection_wrapper->get_current( ).
lr_docflow ?= me->ztyped_context->btdocflow->collection_wrapper->get_current( ).
* refresh the partner data (necessary after deletion!)
* me->typed_context->btpartnerset->collection_wrapper->publish_current( ).
* refresh the text (necessary after empty text!)
me->typed_context->btadminh->collection_wrapper->publish_current( ).
* lr_ent = me->ztyped_context->btadminh->collection_wrapper->get_current( ).
* lr_wrapper_template = me->typed_context->btpartneremprep->get_collection_wrapper( ).
* me->typed_context->btactivityh->set_activityh_collection( iv_collection = lr_wrapper_template ).
*
* Get current AdminH-Entity
lr_entity ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
IF lr_entity IS BOUND.
lr_entity->get_properties( IMPORTING es_attributes = ls_btadminh ).
* IF NOT ls_btadminh IS INITIAL.
* me->typed_context->btdateactpln->gv_template = ls_btadminh-template_type.
* me->typed_context->btpartnercontact->gv_template = ls_btadminh-template_type.
* me->typed_context->btpartneractpart->gv_template = ls_btadminh-template_type.
* ENDIF.
* refresh the text (necessary after empty text!)
lr_ent ?= lr_entity.
* lv_collection = lr_ent->get_related_entities( iv_relation_name = 'BTHeaderTextSet' ).
* lr_text_ent = lv_collection->get_first( ).
* me->typed_context->bttext->on_new_focus( lr_text_ent ).
ENDIF.
**To get the process-type for the category DDLB.
lr_comp ?= me->comp_controller.
* Get current AdminH-Entity
lr_entity ?= lr_comp->typed_context->btadminh->collection_wrapper->get_current( ).
IF lr_entity IS BOUND.
lr_entity->get_property_as_value( EXPORTING iv_attr_name = 'PROCESS_TYPE'
IMPORTING ev_result = ptype ).
ENDIF.
**End code.
*
* IF me->typed_context->btpartneremprep->gv_check = 'X'.
*
* lv_msg_service = me->view_manager->get_message_service( ).
*
* CALL METHOD lv_msg_service->add_message
* EXPORTING
* iv_msg_type = 'I'
* iv_msg_id = 'CRM_UIU_ACTIVITY'
* iv_msg_number = '000'.
* ENDIF.
IF gv_act_copy = 'X'.
* Here delete the doc flow entity will not help clearing the
* reference object type value as the entity will be rebuilt in the
* on_new_focus (with initial data in the reference data structure).
* So we simply clear the gloval variables containing still the values
* from the activity copied. The getter methods will do the rest.
IF lr_docflow IS BOUND.
me->ztyped_context->btdocflow->init_global_ref_var( ).
ENDIF.
ENDIF.
IF gv_invalid_ref EQ 'X'.
IF lr_docflow IS BOUND.
lr_docflow->delete( ).
lr_core = cl_crm_bol_core=>get_instance( ).
lr_core->modify( ).
IF lr_docflowset IS BOUND.
me->ztyped_context->btdocflow->on_new_focus(
focus_bo = lr_docflowset ).
ENDIF.
ENDIF.
ENDIF.
IF gv_new_objref EQ 'X'.
me->ztyped_context->btdocflow->set_objtypea( attribute_path = 'OBJTYPEA'
value = ' ' ).
IF lr_docflowset IS BOUND.
me->ztyped_context->btdocflow->on_new_focus(
focus_bo = lr_docflowset ).
ENDIF.
ENDIF.
item_reference( ).
CLEAR gv_invalid_ref.
CLEAR gv_new_objref.
CLEAR gv_act_copy.
when i remove IF gv_invalid_ref EQ 'X'. condtion ,this error is not coming,but the main functionality is missing.
I read the note-1515327,which is not suitable for my crm version.
can any body suggest me please?
Regards,
Kiran
Hi Kiran,
This error shall be avoided by checking whether the entity is alive before making any changes. I am not sure will this solve your issue, but you can avoid the runtime error "Access Previously Deleted Entity".
IF lr_docflow IS BOUND.
IF lr_doc_flow->alive( ) eq abap_true.
lr_docflow->delete( ).
ENDIF.
ENDIF.
Regards,
Karthi M R.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Karthi M R,
Thanks for you reply.
As i explained earlier, if i write below piece of code
IF lr_docflow IS BOUND.
lr_docflow->delete( ).
lr_core = cl_crm_bol_core=>get_instance( ).
lr_core->modify( ).
IF lr_docflowset IS BOUND.
me->ztyped_context->btdocflow->on_new_focus(
focus_bo = lr_docflowset ).
ENDIF.
ENDIF.
I can get rid of the exception,but basic functionality is missing.
Regards,
Kiran
User | Count |
---|---|
8 | |
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.