Quantcast
Channel: SCN: Message List - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 7775

Re: How to control duplicate entry of a variable within a loop

$
0
0

Hello Bruno,

 

eventually I was able to solve my issue, by coding the message like described in the below Forum

 

http://scn.sap.com/community/crm/webclient-ui-framework/blog/2013/05/21/pass-variables-to-long-text

 

Now whenever the user try to enter a double entry by saving the following message is going to be raised. See the Image below:

Double entry with the message.png

 

The final code that the implementation of the BADI CRM_BP_UIU_SAVE is employing is the following:

 

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.
      READ TABLE lt_fore with key ZZFLD00001O = lv_jahr transporting no fields.

      IF sy-subrc is not initial.
        append ls_fore to lt_fore.

        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( ).
      ELSEIF sy-subrc is  initial.

        lo_core = cl_crm_bol_core=>get_instance( ).
        lr_message_cont = lo_core->get_global_message_cont( ).
        lr_message_cont->add_message( iv_msg_type           = 'E'

                                                         iv_msg_id               = 'ZTDS_INFO'

                                                          iv_msg_number       = '004'

                                                         iv_msg_v1               = LV_JAHR

                                                        iv_show_only_once  = abap_true ).

        EXIT.

      ENDIF.
    ENDWHILE.
  ENDIF.

  lo_core = cl_crm_bol_core=>get_instance( ).
  lo_core->modify( ).

Reason why I am going to close this discussion.

 

Many thanks for all the Support and best regards.

 

Andrea


Viewing all articles
Browse latest Browse all 7775

Trending Articles



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