Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 9057

Deleting Entities from a Collection

$
0
0

Hi Gurus

 

From the codes given below, i am successful in removing an entity from the collection (as seen from the debugger).

 

But as soon as i press Run on the debugger, the entity is still present (The attribute of the entity i opt to delete is being displayed in the web ui).

 

I want to permanently remove the entity from the collection.

 

Thanks in advance!

 

DATA: lr_col_wrap   TYPE REF TO cl_bsp_wd_collection_wrapper,

         lr_parent   TYPE REF TO cl_crm_bol_entity,

         lr_entity   TYPE REF TO cl_crm_bol_entity,

         lr_coll     TYPE REF TO if_bol_bo_col,

         lv_name     TYPE        string.

 

Data: lv_tdid       type TDID,

       lv_conclines  type CRMDT_CONC_TEXTLINES,

       lv_concfmt    type CRMDT_ITF_STRING.

 

   TRY.

 

* Get Collection Wrapper

       lr_col_wrap = typed_context->bttext->get_collection_wrapper( ).

       lr_entity ?= lr_col_wrap->get_current( ).

 

       CHECK lr_entity IS BOUND.

       lr_parent = lr_entity.

 

* read parent's entity

       WHILE lr_parent IS BOUND.

         lv_name = lr_parent->get_name( ).

         IF lv_name = 'BTTextH'.

           lr_entity ?= lr_parent.

           EXIT.

         ENDIF.

         lr_parent = lr_parent->get_parent( ).

       ENDWHILE.

 

       CHECK lr_parent IS BOUND.

       TRY.

           lr_coll = lr_parent->get_related_entities( iv_relation_name = 'BTTextHAll' ).

         CATCH cx_crm_genil_model_error.

       ENDTRY.

 

* get first entity

       lr_entity ?= lr_coll->get_first( ).

 

* loop and read the text

       WHILE lr_entity IS BOUND.

 

          lr_entity->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTY_AS_VALUE( exporting iv_attr_name = 'TDID'  IMPORTING ev_result = lv_tdid ).

 

                IF lv_tdid = 'S005'.

                

* remove the entity

                     lr_coll->remove( lr_entity ).

 

                     lr_entity ?= lr_coll->get_current( ).

                else.

                      lr_entity ?= lr_coll->get_next( ).

                endif.

 

       ENDWHILE.

     CATCH cx_sy_move_cast_error.

       RETURN.

 

   ENDTRY.


Viewing all articles
Browse latest Browse all 9057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>