cancel
Showing results for 
Search instead for 
Did you mean: 

Mixed Node Iteration Issue

Former Member
0 Kudos

Hi All,

I had issue  with Mixed Node iteration.

while doing  mixed node iteration am getting an null reference in GET_NEXT( ) entity. so could you guys  please help onthis issue.

Regards,

Vishwanath.

Accepted Solutions (1)

Accepted Solutions (1)

dharmakasi
Active Contributor
0 Kudos

Hi Vishwanth,

Are you separating both value and model entities before using the entity.

You can check the below code to separate model and value nodes.

Get your collection into a normal entity then assign the entity to mixed node

DATA: lr_mixed TYPE REF TO cl_bsp_wd_mixed_node ,

            current TYPE REF TO if_bol_bo_property_access,

             lr_current TYPE REF TO cl_crm_bol_entity.

     current ?= me->typed_context->entity name->collection_wrapper->get_current( ).
      lr_mixed ?= current
..
      lr_current ?= lr_mixed
->if_bsp_wd_ext_property_access~get_model_node( ).

Best Regards

Dharmakasi,

Former Member
0 Kudos

Hi Dharmakasi,

I have tried this also but still dint got solution. here we canget  current entity but problem is its not looping the next entity in collection.

regards,

vishwanath.

dharmakasi
Active Contributor
0 Kudos

Hi,

I hope you have already checked in debug that collection is having more entities and type of the entities in collection...

How you are assigning next entity to your variable inside loop?

Can you share your code?

Former Member
0 Kudos

Hi Dharmakasi,

Its resolved myself.

DATA: lr_col       TYPE REF TO if_bol_bo_col.

  DATA lr_iterator TYPE REF TO if_bol_bo_col_iterator.



  DATA :

        lr_mixed        TYPE REF TO cl_bsp_wd_mixed_node,

        lr_current      TYPE REF TO cl_crm_bol_entity,

        current         TYPE REF TO if_bol_bo_property_access.

*  DATA: lr_col      TYPE REF TO CL_CRM_BOL_ENTITY_COL.



  DATA: lv_erms_text   TYPE string.

*

**  **** Internal Table to remove entities

  DATA: lt_remove    TYPE TABLE OF REF TO cl_bsp_wd_mixed_node .



  lr_iterator ?= typed_context->wfilistnode->collection_wrapper->get_iterator( ).

  CHECK lr_iterator IS BOUND.

  current     = lr_iterator->get_first( ).

  WHILE current IS BOUND.

    lr_mixed   ?= current.

    lr_current ?= lr_mixed->if_bsp_wd_ext_property_access~get_model_node( ).

    IF lr_current IS BOUND.





      CALL METHOD lr_current->get_property_as_value

        EXPORTING

          iv_attr_name = 'WI_RHTEXT'                        "#EC NOTEXT

        IMPORTING

          ev_result    = lv_erms_text.



      IF lv_erms_text = 'ERMS decision'.

        APPEND lr_mixed TO lt_remove.

*         lr_current->Delete( ).

      ENDIF.

    ENDIF.

    current = lr_iterator->get_next( ).

  ENDWHILE.



*********   remove the entity from internal table lt_remove

******    some few cases entities were missing in loop to remove  so used this way to remove

*  CLEAR : lr_mixed.

  LOOP AT lt_remove INTO lr_mixed.

     lr_col ?= typed_context->wfilistnode->collection_wrapper.

    TRY .

      lr_col->remove( lr_mixed ).

      CATCH cx_root.

    ENDTRY.

  ENDLOOP.

Regards,

Vishwanatha.

pallavi_an
Participant
0 Kudos

Hi Vishwanatha,

When you delete an entity from collection, in WHILE loop, you have to remove that entity from collection and then use get_current( ) method.

lr_enitity = lr_col->get_first( ).

while lr_entity is bound.

if some condition satisfies.

     CALL METHOD LR_COL->REMOVE

           EXPORTING

             IV_ENTITY = LR_ENTITY.

     LR_ENTITY->DELETE( ).

     lr_entity = LR_COL->get_current( ).

else.

     lr_entity = lr_col->get_next( ).

endif.

endwhile.

Regards,

Pallavi

Answers (0)