Thursday, August 27, 2015

CRM Web UI GET_PARENT method



If you need parent entities, then use GET_PARENT method

Using GET_PARENT method:

    DATAcurrent TYPE REF TO if_bol_bo_property_access.
    DATAdref    TYPE REF TO data.


    DATAlr_current    TYPE REF TO cl_crm_bol_entity,
          lr_bt_statush TYPE REF TO cl_crm_bol_entity,
          lr_bt_adminh  TYPE REF TO cl_crm_bol_entity.
    DATAlv_process TYPE CRMT_PROCESS_TYPE_DB.


    if iterator is bound.
      current iterator->get_current).
    else.
      current collection_wrapper->get_current).
    endif.

    lr_current ?= current.

    TRY.
      lr_bt_statush ?= lr_current->get_parent).

      CATCH cx_crm_genil_model_error .
    ENDTRY.

    TRY.
      lr_bt_adminh ?= lr_bt_statush->get_parent).

      CATCH cx_crm_genil_model_error .
    ENDTRY.

    TRY.

    lr_bt_adminh->get_property_as_value(  EXPORTING IV_ATTR_NAME 'PROCESS_TYPE'
                                            IMPORTING EV_RESULT lv_process  ).

      CATCH cx_root.
    ENDTRY.

No comments:

Post a Comment