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

Re: Tree table

$
0
0

Hi,

 

 

You have to create context node with Table view first then you should change the TV super class of context node to cl_bsp_wd_context_node_tree.

 

This will be the parent class. You have to create class separately cl_bsp_wd_tree_node_proxy and you need to call this class in super/parent class that is cl_bsp_wd_context_node_tree.in REFRESH method

 

You have to call this refresh method in do_prepare_out method of IMPL class.

 

 

CALL METHOD super->refresh
    .
  DATA:   lr_root          TYPE REF TO if_bsp_wd_tree_node,
         lr_ent           TYPE REF TO cl_bsp_wd_value_node,
         lr_tree           TYPE REF TO ztreeview,
         lr_first_level_node TYPE REF TO zl_ztreevie_tree_cn02.

  DATA: lt_tree TYPE TABLE OF ztreeview,
        ls_tree TYPE ztreeview.

 

  lt_tree = ZL_ZTREEVIE_TREE_IMPL=>gt_tree.
  DELETE lt_tree WHERE parent_id IS NOT INITIAL.

  LOOP AT lt_tree INTO ls_tree.
    CREATE DATA lr_tree.
    CREATE OBJECT lr_ent
      EXPORTING
        iv_data_ref = lr_tree.

    lr_ent->set_properties( EXPORTING is_attributes = ls_tree ).
    lr_root = me->node_factory->get_proxy(
                                  iv_bo         = lr_ent
                                  iv_proxy_type = 'ZL_ZTREEVIE_TREE_CN02' )."this is class you should create with cl_bsp_wd_tree_node_proxy
    lr_first_level_node ?= lr_root.
      lr_root->expand_node( ).
    lr_root->node_key = add_root_node( lr_root ).

  ENDLOOP.

 

In child class cl_bsp_wd_tree_node_proxy put code in get_children to get children


**for first node

METHOD if_bsp_wd_tree_node~get_children.

  DATA:    lr_root_node  TYPE REF TO if_bsp_wd_tree_node,
           lr_ent        TYPE REF TO cl_bsp_wd_value_node,
           lr_swf        TYPE REF TO zcl_docflow_cntxt_node,
           ls_swf          TYPE zcl_docflow_cntxt_node,
           ls_orderadm_h   TYPE crmt_orderadm_h_wrk,
           lv_process_type TYPE crmt_process_type,
           lv_curr_guid    TYPE crmt_object_guid,
           lv_guid         TYPE crmt_object_guid,
           lv_object_id    TYPE crmt_object_id,
           ls_docflow     TYPE zcl_docflow_cntxt_node,
           lt_docflow     TYPE zcl_docflow_cntxt_node_t.


  DATA: lr_entity   TYPE REF TO cl_crm_bol_entity,
        lr_coll_wr  TYPE REF TO cl_bsp_wd_collection_wrapper,
        lr_iterator TYPE REF TO if_bol_bo_col_iterator,
        lr_root     TYPE REF TO if_bsp_wd_tree_node.

  DATA: lv_bo_coll TYPE REF TO if_bol_bo_col,
        lr_child   TYPE REF TO if_bsp_wd_tree_node,
        lr_node    TYPE REF TO ZL_ZTREEVIE_TREE_CN03',
        lr_me      TYPE REF TO if_bol_bo_property_access.

  TRY.
      lr_me ?= me->bo.
      lv_curr_guid = lr_me->get_property_as_string( iv_attr_name ='GUID' ).

      CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'
        EXPORTING
          iv_orderadm_h_guid = lv_curr_guid
        IMPORTING
          ev_process_type    = lv_process_type.

     
      CHECK lv_curr_guid IS NOT INITIAL.

        IF lv_process_type EQ 'Z002'.
          CALL METHOD me->fetch_swf_sub_doc
          EXPORTING
            iv_guid = lv_curr_guid
          IMPORTING
            et_docflow = lt_docflow.
        ENDIF.

      LOOP AT lt_docflow INTO ls_docflow.
        CREATE DATA lr_swf.
        CREATE OBJECT lr_ent
          EXPORTING
            iv_data_ref = lr_swf.
        ls_swf-guid         = ls_docflow-guid.
        lr_ent->set_properties( EXPORTING is_attributes = ls_swf ).

        lr_child ?= me->node_factory->get_proxy( iv_bo           = lr_ent
                                                 iv_parent_proxy = me
                                                 iv_proxy_type   = ''ZL_ZTREEVIE_TREE_CN03').:here one more child class if u want child
        lr_node ?= lr_child.
        lr_node->gv_curr_id = gv_curr_id.
        APPEND lr_child TO rt_children.
      ENDLOOP.
    CATCH cx_sy_move_cast_error cx_sy_ref_is_initial.
  ENDTRY.

ENDMETHOD.

 

**for second node

same code in class ''ZL_ZTREEVIE_TREE_CN03' get_children you have to put for second node code.

 

Regards,

Deepika


Viewing all articles
Browse latest Browse all 7775

Trending Articles



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