Skip to Content
0
Former Member
Jul 20, 2010 at 07:48 AM

ICCMP_BP_SEARCH/BuPaSelectContactPerson filter for valid relationships

38 Views

Hello,

in the IC-Webclient we only want to display contact persons with vaild relationships (check validity end date) in the result list ICCMP_BP_SEARCH/BuPaSelectContactPerson.

I redefined method "DO_INIT_CONTEXT" of the impl. class for this like follows:

METHOD do_init_context.

  DATA: lv_wrapper    TYPE REF TO cl_bsp_wd_collection_wrapper,
        lv_rel_col    TYPE REF TO if_bol_bo_col,
        lr_entity     TYPE REF TO cl_crm_bol_entity,
        lv_date       TYPE        dats.

  CALL METHOD super->do_init_context.

* Feger 20.07.2010 Es sollen nur gültige AP-Beziehungen angezeigt werden

  lv_wrapper = typed_context->contactrelation->get_collection_wrapper( ).
  IF lv_wrapper->size( ) > 0.

    TRY.
        lv_rel_col ?= lv_wrapper.

        lr_entity ?= lv_rel_col->get_first( ).
        WHILE lr_entity IS BOUND.
          CALL METHOD lr_entity->if_bol_bo_property_access~get_property_as_value
            EXPORTING
              iv_attr_name = 'DATE_TO'
            IMPORTING
              ev_result    = lv_date.
          IF lv_date LT sy-datum.
            CALL METHOD lv_rel_col->remove
              EXPORTING
                iv_bo = lr_entity.
            lr_entity ?= lv_rel_col->get_next( ).
          ELSE.
            lr_entity ?= lv_rel_col->get_next( ).
          ENDIF.

        ENDWHILE.
      CATCH cx_crm_genil_model_error.
    ENDTRY.



    lv_wrapper->sort( iv_attr_name = 'NAME1'
                      iv_path_2_subobject = 'BuilGetHeaderforContactRel' ).

  ENDIF.
ENDMETHOD.

This works with two restrictions:

1. If only one contact person is in the result this coding is not processed - do not really understand why.

2. If a user do more than one search without clicking the IC "END-Button" between this coding is not processed.

Could you please give me some hinds how to solve this.

Is DO_INIT_CONTEXT maybe the wrong place?

Thank you

Kind regards

Manfred