Quantcast
Channel: SCN : All Content - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 4552

How to control duplicate entry of a variable within a loop

$
0
0

Hello SAP Gurus,

 

I have a simple question, which is a little bit embarassing.

But since I have never done this kind of code, I have just thought to ask within this Forum.

My requirement is to check that no duplicate entries will be within a table view component. This table view can have multiple entries.

 

Therefore I have coded the badi CRM_BP_UIU_SAVE on the method ON_SAVE_EVENT in order to create and control the Loop. Below there is my code.

 

lv_collection = gv_access_header->get_related_entities( iv_relation_name = 'ZEXT_BOL_RELAT00000E' ).
  IF lv_collection IS BOUND AND lv_collection->size( ) > 0.
    lv_iterator = lv_collection->get_iterator( ).
    lr_relation2 ?= lv_iterator->get_first( ).

    WHILE lr_relation2 IS BOUND.
      lr_relation2->get_properties( importing ES_ATTRIBUTES = ls_fore ).

      LV_JAHR =   ls_fore-ZZFLD00001O.
      LV_LOBOUT = ls_fore-ZZFLD00001S.
      LV_LOBCON = ls_fore-ZZFLD00001T.
      LV_LOBSYS = ls_fore-ZZFLD00001U.
      LV_LOBSUM = LV_LOBOUT + LV_LOBCON + LV_LOBSYS.

      lr_relation2->SET_PROPERTY( IV_ATTR_NAME = 'ZZFLD00001V'
                                             IV_VALUE =  LV_LOBSUM ).

      lr_relation2 ?= lv_iterator->get_next( ).
    ENDWHILE.

    lo_core = cl_crm_bol_core=>get_instance( ).

    lo_core->modify( ).

  ENDIF.

 

Now I have to control that the variable LV_JAHR does not have the same value every time that more lines in the table view are added.

 

How can I get this result? Am I supposed to use an index?

 

Thank you so much for the patience and understanding.

 

Best Regards,

 

Andrtea


Viewing all articles
Browse latest Browse all 4552

Trending Articles



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