Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Exception Class CX_BOL_EXCEPTION - Access Previously Deleted Entity Method: CL_CRM_BOL_CORE=>REREAD_ENTITY Source Text Row: 137

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 


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 ).


**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 ).


**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


*        iv_msg_type   = 'I'

*        iv_msg_id     = 'CRM_UIU_ACTIVITY'

*        iv_msg_number = '000'.


  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( ).



  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.


                   focus_bo = lr_docflowset ).




  IF gv_new_objref EQ 'X'.

    me->ztyped_context->btdocflow->set_objtypea( attribute_path = 'OBJTYPEA'

                                                       value = ' ' ).

    IF lr_docflowset IS BOUND.


                 focus_bo = lr_docflowset ).



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?



Former Member
Former Member replied

Resolved my problem by commenting the line of code "  lr_docflow->delete( )."



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question