tree control in web ui

Upload: nizamshaik

Post on 02-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 Tree Control in WEB UI

    1/109

    Tree Control in WEB UI

  • 8/11/2019 Tree Control in WEB UI

    2/109

  • 8/11/2019 Tree Control in WEB UI

    3/109

    methoddo_prepare_output.

    data: l_v_comp typecrmt_genil_appl.

    data: l_i_category_guid typecomt_guid_sort_tab,

    l_s_category_guid likelineofl_i_category_guid.

    data: l_o_core typereftocl_crm_bol_core,

    l_o_entity typereftocl_crm_bol_entity,

    l_o_ppr_collection typereftocl_bsp_wd_collection_wrapper.

    gr_cuco ?= me->get_custom_controller !glb!cl_cgtgd_list_constants=>lstitm_cuco ".

    if!glb!cl_crmcmp_l_lstmainw_impl=>gv_new = abap_true.

    l_o_ppr_collection = gr_cuco->typed_conte#t->ppritem->get_collection_wrapper ".

    l_o_ppr_collection->clear ".

    endif.

    if!glb!cl_crmcmp_l_lstmainw_impl=>gv_new = abap_true or!glb!cl_crmcmp_l_condrec_impl=

    v_overview = abap_true or!$%&!'%_'()_'*+(''*+_/)0%=>g_v_hier_change = abap_true.

    clear!glb!cl_lst_ppri_cucomain_impl=>gt_categlisted_guids.

    clear!glb!cl_lst_ppri_cucomain_impl=>g_i_base_categ_guid.

    clear!glb!cl_lst_ppri_cucomain_impl=>gt_lsited_prod_guids.

    clear!glb!cl_lst_ppri_cucomain_impl=>gt_lsited_prod_guids_read.

    cleartyped_conte#t->hierarchy->gt_selrow_key_table.

    get_buttons ".

    me->typed_conte#t->hierarchy->collection_wrapper->clear ".

    typed_conte#t->hierarchy->refresh ".

    typed_conte#t->hierarchy->build_table ".

    gr_cuco->e#ecute_smartsearch ".

  • 8/11/2019 Tree Control in WEB UI

    4/109

    endif.

    if !glb!cl_lst_ppri_cucomain_impl=>gt_category_guids isnotinitialandgv_list isin

    ial.

    l_i_category_guid = !glb!cl_lst_ppri_cucomain_impl=>gt_category_guids.

    loopatl_i_category_guid intol_s_category_guid.

    ** Get the instance of bol core services

    try.

    l_o_core = cl_crm_bol_core=>get_instance ". l_v_comp = te#t-112.

    l_o_core->load_component_set iv_component_set_name = l_v_comp ".

    catchc#_crm_genil_general_error.

    endtry.

    try.

    * create a category object from the guid.

    l_o_entity = l_o_core->get_root_entity

    iv_ob3ect_name = if_prcat_ap_bol_model=>gc_category_ob3

    iv_ob3ect_guid = l_s_category_guid ".

    catchc#_crm_genil_model_error.

    endtry.

    checkl_o_entity isbound.

    * Add the hierarchy to the hierarchy collection wrapper

    me->typed_conte#t->hierarchy->collection_wrapper->add l_o_entity ".

    * Read the whole tree structure

    typed_conte#t->hierarchy->refresh ".

    * Build the table used by the ui tag

    typed_conte#t->hierarchy->build_table ".

    endloop.

    endif.

    cleargv_list.

    endmethod.

    /GLB/CL_LST_PPRI_CUCOMAIN_IMPL is the class of Custom Controller

  • 8/11/2019 Tree Control in WEB UI

    5/109

  • 8/11/2019 Tree Control in WEB UI

    6/109

    757: l_v_inde# 580sytabi#,

    l_v_hit 580 abap_bool.

    data: l_o_tree_event 580(5*cl_thtmlb_tree,

    l_o_category 580(5*cl_crm_bol_entity,

    l_o_tree_node 580(5* cl_bsp_wd_tree_node_pro#y.

    5(8.

    l_o_tree_event ?= htmlb_event_e#.

    me->typed_conte#t->hierarchy->eh_on_row_selection iv_htmlb_event_e# = l_o_tree_eve

    ".

    * Get the selected row index

    l_v_inde# = l_o_tree_event->row_inde#.

    * f the index is valid

    /l_v_inde# /9+*5/+/5/7%7+l_v_inde# > 1.

    * get node by index

    5(8.

    l_o_tree_node ?= me->typed_conte#t->hierarchy->get_node_by_inde# l_v_inde# "* get the hit information

    '7%%)56*l_o_tree_node->$5_97('6_(9;%5"

  • 8/11/2019 Tree Control in WEB UI

    7/109

    '75'6c#_sy_move_cast_error. %&'$ () A(D+'R.

    +5(8.

    +)56*.

    )56*eh_onnodee#pand.

    757: l_o_event 580(5*cl_thtmlb_tree.

    l_o_event ?= htmlb_event_e#.

    typed_conte#t->hierarchy->e#pand_node l_o_event->row_key ".

    typed_conte#t->hierarchy->build_table ".

    gv_list = abap_true.

    +)56*.

    )56*eh_onnodecollapse.

    757: l_o_event 580(5*cl_thtmlb_tree.

    l_o_event ?= htmlb_event_e#. typed_conte#t->hierarchy->collapse_node l_o_event->row_key ".

    typed_conte#t->hierarchy->build_table ".

    gv_list = abap_true.

    +)56*.

    methodeh_onne#tlevel.

    757: l_o_node 580bsp_wd_tree_node_ref.

    757: l_i_nodes 580crmt_bsp_treetable_node_tab, l_s_node %/%/+*l_i_nodes,

    l_i_node_collapse 580crmt_bsp_treetable_node_tab,

    l_s_node_collapse %/%/+*l_i_node_collapse,

    l_i_child_ref 580bsp_wd_tree_node_tab,

    l_s_child_ref %/%/+*l_i_child_ref.

    l_i_nodes = me->typed_conte#t->hierarchy->node_tab.

    %**075l_i_nodes /+5*l_s_node A6(is_e#panded = abap_false 7+is_leaf = abap_false

    typed_conte#t->hierarchy->e#pand_node l_s_node-node_key ".

    700+l_s_node 5*l_i_node_collapse.

    +%**0.

    *collapse the next level nodes.

    '6'l_i_node_collapse /9+*5/+/5/7%.

    %**075l_i_node_collapse /+5*l_s_node_collapse.

    l_o_node = typed_conte#t->hierarchy->get_node_by_key l_s_node_collapse-node_key ".

    /l_o_node /9&*;+.

    l_i_child_ref = typed_conte#t->hierarchy->get_children_nl l_o_node ".

    %**075l_i_child_ref /+5*l_s_child_ref.

    / l_s_child_ref->is_e#panded " = abap_true.

    l_s_child_ref->collaps_node ".

    +/.

  • 8/11/2019 Tree Control in WEB UI

    8/109

    +%**0.

    +/.

    +%**0.

    * Build the table used by the ui tag

    typed_conte#t->hierarchy->build_table ".

    gv_list = abap_true.

    !glb!cl_lst_itemlisted_impl=>gv_listop = abap_true.

    endmethod.

    methodeh_onmultiselect.

    data: l_v_inde# typesytabi#,

    l_v_key typestring.

    data: l_s_nodetab typecrmt_bsp_treetable_node .

    data: l_o_tree_event typereftocl_thtmlb_tree,

    l_o_tree_node typerefto cl_bsp_wd_tree_node_pro#y.

    try.

    l_o_tree_event ?= htmlb_event_e#.

    * Get the selected row index

    l_v_inde# = l_o_tree_event->row_inde#.

    * f the index is valid

    ifl_v_inde# isnotinitialandl_v_inde# > 1.

    * get node by index

    try.

    l_o_tree_node ?= me->typed_conte#t->hierarchy->get_node_by_inde# l_v_inde# "

    * get the hit information

    catchc#_sy_dyn_call_illegal_method c#_sy_move_cast_error. endtry.

    l_v_key = l_o_tree_node->if_bsp_wd_tree_nodeBnode_key .

    readtabletyped_conte#t->hierarchy->gt_selrow_key_table

    froml_v_key transportingnofields.

    ifsy-subrc e41.

    deletetyped_conte#t->hierarchy->gt_selrow_key_table inde#sy-tabi# .

    else.

    appendl_v_key totyped_conte#t->hierarchy->gt_selrow_key_table .

    endif.

    else.

    * index is ,- chec the /AR0A++ 1 2(/AR0A++ $A3' ifl_o_tree_event->gv_markall e4cl_thtmlb_table_view=>c_rows_unmark_all.

    * unmar everything.

    cleartyped_conte#t->hierarchy->gt_selrow_key_table .

    elseifl_o_tree_event->gv_markall e4cl_thtmlb_table_view=>c_rows_mark_all .

    loopattyped_conte#t->hierarchy->node_tab intol_s_nodetab.

    appendl_s_nodetab-node_key totyped_conte#t->hierarchy->gt_selrow_key_tabl

    .

    endloop.

    endif.

    endif.

  • 8/11/2019 Tree Control in WEB UI

    9/109

    catchc#_sy_move_cast_error. %&'$ () A(D+'R.

    endtry.

    gv_list = abap_true.

    !glb!cl_lst_itemlisted_impl=>gv_listop = abap_true.

    endmethod.

    )56*eh_onlist.

    * to retrieve the selected entities in the result tree

    757:l_v_category_guid 580comt_hierarchy_guid,

    l_v_prod_guid 580comt_product_guid,

    l_v_siCe 580i.

    757: l_s_key 580string ,

    l_i_nodes 580bsp_wd_tree_node_tab,

    l_v_node %/%/+*l_i_nodes,

    l_s_products 580lstruc_categ_prod,

    l_i_category 580comt_category_api_e#p_tab,

    l_s_category %/%/+*l_i_category.

    757:l_o_category 580(5*cl_crm_bol_entity, l_o_model_ent 580(5*cl_crm_bol_entity,

    l_o_ppritem 580(5*cl_crm_bol_entity,

    l_o_cuco 580(5*!glb!cl_lst_ppri_cucomain_impl.

    '%7(typed_conte#t->hierarchy->gt_products.

    %**075typed_conte#t->hierarchy->gt_selrow_key_table /+5*l_s_key.

    * Get the corresponding entity

    l_o_category ?= me->typed_conte#t->hierarchy->get_bo l_s_key ".

    '6'l_o_category /9&*;+.

    /l_o_category->get_name " if_prcat_ap_bol_model=>gc_category_ob3.

    '7%%)56*l_o_category->get_property_as_value

    category_guid

    /)0*(5/+$

    ev_result = l_v_category_guid.

    (757&%!glb!cl_lst_itemnotlisted_cn11=>gt_children 5(7+90*(5/+$+*/%9A/56

    &%8table_line = l_v_category_guid.

    /sy-subrc D> 1.

    l_v_node = typed_conte#t->hierarchy->get_node_by_key l_s_key ".

    /l_v_node /9&*;+. 700+l_v_node 5*l_i_nodes.

    typed_conte#t->hierarchy->get_children l_i_nodes ".

    +/.

    '7%%;+'5/*+'*)_'75$*(8_(7_6/$6(%%9

  • 8/11/2019 Tree Control in WEB UI

    10/109

    get_property_as_value

    product_guid

    /)0*(5/+$

    ev_result = l_v_prod_guid.

    (757&%typed_conte#t->hierarchy->gt_products 5(7+90*(5/+$+*/%9A/56 8p

    duct_guid = l_v_prod_guid.

    /sy-subrc D> 1.

    l_v_node = typed_conte#t->hierarchy->get_node_by_key l_s_key ". /l_v_node /9&*;+.

    700+l_v_node 5*l_i_nodes.

    typed_conte#t->hierarchy->get_children l_i_nodes ".

    +/.

    +/.

    +/.

    +%**0.

    gv_list = abap_true.

    ** get custom controller for header entity

    l_o_cuco ?= me->get_custom_controller !glb!cl_cgtgd_list_constants=>lstitm_cuco ". %&'

    ()4'54

    l_o_ppritem ?= l_o_cuco->typed_conte#t->ppritem->collection_wrapper->get_current ".

    /l_o_ppritem /9/+/5/7%.

    l_o_cuco->handle_new_ppr_header ".

    l_o_ppritem ?= l_o_cuco->typed_conte#t->ppritem->collection_wrapper->get_current ".

    '$ ()4'54

    +/.

    9*(5typed_conte#t->hierarchy->gt_products.

    %57@7'+5;0%/'759(*)typed_conte#t->hierarchy->gt_products.

    %**075typed_conte#t->hierarchy->gt_products /+5*l_s_products.

    (757&%!glb!cl_lst_ppri_cucomain_impl=>gt_lsited_prod_guids 5(7+90*(5/+$+*/%

    A/5657&%8table_line = l_s_products-product_guid.

    /sy-subrc D> 1.

    * create new entity for target node

    l_o_model_ent = l_o_ppritem->create_related_entity !glb!cl_cgtgd_list_constants=>p

    itemrel ". %&'$ ()4'54

    '6'l_o_model_ent /9&*;+.

    l_o_model_ent->set_property

  • 8/11/2019 Tree Control in WEB UI

    11/109

    roduct_ref_guid

    iv_value = l_s_products-product_guid ".

    '$ ()4'54

    l_o_cuco->typed_conte#t->ppritemprod->collection_wrapper->add l_o_model_ent ".

    700+l_s_products-product_guid 5*!glb!cl_lst_ppri_cucomain_impl=>gt_lsited_prod_

    ids.

    +/.

    +%**0.

    /!glb!cl_lst_ppri_cucomain_impl=>g_i_base_categ_guid /9+*5/+/5/7%.

    %**075!glb!cl_lst_ppri_cucomain_impl=>g_i_base_categ_guid /+5*l_v_category_guid. 700+l_v_category_guid 5* !glb!cl_lst_ppri_cucomain_impl=>gt_categlisted_guids.

    +%**0.

    +/.

    9*(5!glb!cl_lst_ppri_cucomain_impl=>gt_lsited_prod_guids.

    %57@7'+5;0%/'759(*)!glb!cl_lst_ppri_cucomain_impl=>gt_lsited_prod_guids.

    9*(5!glb!cl_lst_ppri_cucomain_impl=>gt_categlisted_guids.

    %57@7'+5;0%/'759(*) !glb!cl_lst_ppri_cucomain_impl=>gt_categlisted_guids.

    me->typed_conte#t->hierarchy->refresh ".

    me->typed_conte#t->hierarchy->build_table ".

    * deselect the hierarchy node

    '%7( typed_conte#t->hierarchy->gt_selrow_key_table.

    +)56*.

    )56*eh_oncollapse.

    757: l_i_nodes 580crmt_bsp_treetable_node_tab,

    l_s_node %/%/+*l_i_nodes.

    l_i_nodes = me->typed_conte#t->hierarchy->node_tab. %**075l_i_nodes /+5*l_s_node A6(parent_key = abap_false.

    typed_conte#t->hierarchy->collapse_node l_s_node-node_key ".

    +%**0.

    * Build the table used by the ui tag

    typed_conte#t->hierarchy->build_table ".

    gv_list = abap_true.

    !glb!cl_lst_itemlisted_impl=>gv_listop = abap_true.

    endmethod.

    method$5_6_);%5/_)*.

    rv_vh_ms_mode = abap_true.

    endmethod.

    methodget_buttons.

    data: l_s_button typecrmt_thtmlb_button,

    l_s_attributes type!2cn!ws_ed_22Elst112.

  • 8/11/2019 Tree Control in WEB UI

    12/109

    clearg_i_button.

    clearl_s_button.

    l_s_button-te#t= te#t-11G.

    l_s_button-on_click = te#t-11H.

    l_s_button-enabled = abap_true.

    appendl_s_button tog_i_button.

    clearl_s_button.

    l_s_button-te#t= te#t-11E.

    l_s_button-on_click = te#t-11E. l_s_button-enabled = abap_true.

    appendl_s_button tog_i_button.

    clearl_s_button.

    l_s_button-te#t= te#t-11F.

    l_s_button-on_click = te#t-11I.

    l_s_button-enabled = abap_true.

    appendl_s_button tog_i_button.

    endmethod.

  • 8/11/2019 Tree Control in WEB UI

    13/109

    Class ! /GLB/CL_C"TMLB_#ML_PRO$I%&R

    method'7%';%75_5(_/++5.

    data: lv_node typecrmt_thtmlb_treetable_node,

  • 8/11/2019 Tree Control in WEB UI

    14/109

    lv_original typecrmt_thtmlb_treetable_node,

    lv_parent typecrmt_thtmlb_treetable_node,

    lv_indent typestring.

    * read node ey

    readtableir_tree_model->node_tab inde#iv_inde# intolv_node.

    lv_original = lv_node.

    whilelv_node-parent_key isnotinitial.

    * go up in the tree to the root node concatenatelv_indent --intolv_indent respecting blanks.

    readtableir_tree_model->node_tab intolv_parent

    withkeynode_key = lv_node-parent_key.

    lv_node = lv_parent.

    endwhile.

    iflv_original-is_leaf isinitial.

    iflv_original-is_e#panded isinitial.

    concatenatelv_indent >intolv_indent.

    else.

    concatenatelv_indent vintolv_indent.

    endif. else.

    concatenatelv_indent ointolv_indent.

    endif.

    concatenateJ Jlv_indent intolv_indent.

    rv_return = lv_indent.

    endmethod.

    method$5_

  • 8/11/2019 Tree Control in WEB UI

    15/109

    757: %_(95 58095(/+$.

    * !" change to 5/l name convention 6 e.g. %1% becomes %#!% 7

    %_(**5_+* = '%_7&70_J/+5*%_(0%7'(.

    (0%7'JD!757>D!as#:values>D!as#:abap>J

    /+%_

  • 8/11/2019 Tree Control in WEB UI

    16/109

    )56*'(75_'(_%.

    757: %_J

    %_'(%

    /+5*%_

  • 8/11/2019 Tree Control in WEB UI

    17/109

    J>J

    %_'(%

    /+5*%_J

    %_'(%

    J D#s:comple#5ype>J

    %_'(%

    J D#s:se4uence>J

    %_'(%

    J D#s:element name=KJ

    %_/'_95(;'_95(

    JK>J

    %_'(%

    J D#s:comple#5ype>J

    %_'(% J D#s:se4uence>J

    /+5*%_-+7).

    %_+7) = '%_7&70_J

    %_'(%

    /+5*%_

  • 8/11/2019 Tree Control in WEB UI

    18/109

    +/.

    +%**0.

    /+*5/_0_95(;'5;( /9/+/5/7%.

    '*+'75+75

    %_J

    %_'(%

    J D!#s:comple#5ype>J

    %_'(% J D!#s:element>J

    %_'(%

    J D!#s:se4uence>J

    %_'(%

    J D!#s:comple#5ype>J

    %_'(%

    J D!#s:element>J

    %_'(%

    /+5*%_

  • 8/11/2019 Tree Control in WEB UI

    19/109

    )56*'(75_'*)0*++5.

    %_/'_95(;' = /_95(;'+7).

    ** !" get field of ddic structure

    * $A++ ;2($4)( ?

    * )4'R3 > @.

    *

    //_+*_

  • 8/11/2019 Tree Control in WEB UI

    20/109

    JD#s:schema #mlns:#s=Khttp:!!www.wF.org!E112!J

    %_'(%

    /+5*%_J

    %_'(%

    J D#s:comple#5ype>J

    %_'(%

    J D#s:se4uence>J

    %_'(%

    J D#s:element name=KJ

    * +8#DD$#34R2$#34R

    JitemJ

    JK>J

    %_'(% J D#s:comple#5ype>J

    %_'(%

    J D#s:se4uence>J

    /+5*%_-+7).

    %_+7) = '%_7&70_J

    %_'(% /+5*%_

  • 8/11/2019 Tree Control in WEB UI

    21/109

    %_'(%

    /+5*%_J

    %_'(%

    J D!#s:element>J

    %_'(%

    J D!#s:se4uence>J

    %_'(%

    J D!#s:comple#5ype>J

    %_'(%

    J D!#s:element>J

    %_'(%

    /+5*%_

  • 8/11/2019 Tree Control in WEB UI

    22/109

    757: %_+7) 58095(/+$.

    757: %_/%+7) 58095(/+$.

    /%-98)&*%9: D%9_/%> 580/%/+*.

    %_/'_95(;' = /_95(;'+7).

    5(7+9%75%_/'_95(;' 5*;00('79. %&'$ 4RA(3+A(G

    * !" create top level 5/+

    '*+'75+75

    JD?#ml version=K2.1K encoding=KJ

    Jutf-IJ

    JK?>J

    %_'(%

    JD?mso-application progid=K#cel.9heetK?>J

    %_'(%

    JDAorkbook #mlns=Kurn:schemas-microsoft-com:office:spreadsheetKJ

    J #mlns:o=Kurn:schemas-microsoft-com:office:officeKJ

    J #mlns:#=Kurn:schemas-microsoft-com:office:e#celKJ

    J #mlns:ss=Kurn:schemas-microsoft-com:office:spreadsheetKJ J #mlns:html=Khttp:!!www.wF.org!5(!('-htmlG1KJ

    J #mlns:#E=Khttp:!!schemas.microsoft.com!office!e#cel!E11F!#mlKJ

    J #mlns:#sd=Khttp:!!www.wF.org!E112!J

    %_'(%

    /+5*%_5*_

  • 8/11/2019 Tree Control in WEB UI

    23/109

    '*+'75+75

    %_J

    %_'(%

    /+5*%_.

    '*+'75+75

    %_J

    %_'(%

    J D0ane>J

    %_'(%

    J D+umber>2D!+umber>J %_'(%

    J D7ctive'ol>2D!7ctive'ol>J

    %_'(%

    J D!0ane>J

    %_'(%

    J D!0anes>J

    %_'(%

    J D0rotect*b3ects>alseD!0rotect*b3ects>J

    %_'(%

    J D0rotect9cenarios>alseD!0rotect9cenarios>J

    %_'(%

  • 8/11/2019 Tree Control in WEB UI

    24/109

    J D!Aorksheet*ptions>J

    %_'(%

    J D!Aorksheet>J

    %_'(%

    /+5*%_J

    /+5*%_%single% x@:D>%

    JD#E:ntry #E:5ype=KtableK #E:/=KJ

    %_/

    JK>J

    %_'(%

    JD#E:(ange>J* 3heet?CR@$

    * +8#(D'5

    J9heet2L(E'2:(E1'J%_'*%;)+9

    JD!#E:(ange>J

    JD#E:6eader(ange>(2'2D!#E:6eader(ange>J %only for table range

    %_'(%

    JD#:ilter*n>5rueD!#:ilter*n>J

    %_'(%

  • 8/11/2019 Tree Control in WEB UI

    25/109

    JD#E:!J

    %_+7) $'_/5)9

    J!J

    %_+7)

    JD!#E:J

    %_'(%

    /+5*%_.

    * !" change to 5/l name convention 6 e.g. %1% becomes %#!% 7 %_/%+7) = D%9_/%>-/%+7).

    %_/%+7) = '%_7&70_

  • 8/11/2019 Tree Control in WEB UI

    26/109

    J D#E:7ggregate>+oneD!#E:7ggregate>J

    %_'(%

    JD!#E:ield>J

    %_'(%

    /+5*%_J

    %_'(%

    JD!Aorkbook>J

    %_'(% /+5*%_$5_&;( ".

    %_'*+ = '%_7&70_'*+_

  • 8/11/2019 Tree Control in WEB UI

    27/109

    method'(75_

  • 8/11/2019 Tree Control in WEB UI

    28/109

    ifnotiv_generate_header isinitial.

    * !" get field of ddic structure

    * $A++ ;2($4)( ?

    * )4'R3 > @. endif.

    * !" change to 5/l name convention 6 e.g. %1% becomes %#!% 7

    lv_ddic_struc_str = lv_ddic_struc.

    lv_ddic_struc_str = cl_abap_#ml_name_converter=>to_#ml_name lv_ddic_struc_str ".

    concatenate

    lv_#ml

    JDAorksheet ss:+ame=K9heet2K>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    ifnotiv_generate_header isinitial.

    * !" create column headers from field names

    lv_columns = lines it_structdescr ".

    condenselv_columns no-gaps.

    concatenate

    lv_#ml

    J D5able ss:#panded'olumn'ount=KJ

    lv_columns

    JK ss:#panded(ow'ount=KEK #:ull'olumns=K2K #:ull(ows=K2K>J

    lv_crlf

    J D(ow>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    loopatit_structdescr assigningDls_field>.

    concatenate

    lv_#ml

    J D'ell>Data ss:5ype=K9tringK>J

    Dls_field>-name

    JD!ata>D!'ell>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54 endloop.

    concatenate

    lv_#ml

    J D!(ow>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    concatenate

    lv_#ml

    J D!5able>J

  • 8/11/2019 Tree Control in WEB UI

    29/109

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    endif.

    concatenate

    lv_#ml

    J DAorksheet*ptions #mlns=Kurn:schemas-microsoft-com:office:e#celK>J

    lv_crlf

    J D9elected!>J

    lv_crlf J D0anes>J

    lv_crlf

    J D0ane>J

    lv_crlf

    J D+umber>2D!+umber>J

    lv_crlf

    J D7ctive'ol>2D!7ctive'ol>J

    lv_crlf

    J D!0ane>J

    lv_crlf

    J D!0anes>J

    lv_crlf J D0rotect*b3ects>alseD!0rotect*b3ects>J

    lv_crlf

    J D0rotect9cenarios>alseD!0rotect9cenarios>J

    lv_crlf

    J D!Aorksheet*ptions>J

    lv_crlf

    J D!Aorksheet>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    * !" include 5/+ schema from structure

    lv_#sd = cl_chtmlb_#ml_provider=>create_#sd_dynamic iv_strucname = iv_strucname

    iv_no_#ml_declaration =

  • 8/11/2019 Tree Control in WEB UI

    30/109

    lv_id = 2.

    condenselv_id.

    * !" change to 5/l name convention 6 e.g. %1% becomes %#!% 7

    lv_name = lv_ddic_struc_str.

    * +8#(A/' > $+#ABA=#5/+#(A/'#$)(8'R4'R>"4)#5/+#(A/'6 +8#(A/' 7.

    concatenate

    lv_#ml* x@:'ntry x@:4ype>%single% x@:D>%

    JD#E:ntry #E:5ype=KtableK #E:/=KJ

    lv_id

    JK>J

    lv_crlf

    JD#E:(ange>J

    * 3heet?CR@$

    * +8#(D'5

    J9heet2L(E'2:(E1'Jlv_columns

    JD!#E:(ange>J JD#E:6eader(ange>(2'2D!#E:6eader(ange>J %only for table range

    lv_crlf

    JD#:ilter*n>5rueD!#:ilter*n>J

    lv_crlf

    JD#E:!J

    lv_name gc_items

    J!J

    * +8#(A/'

    JitemJ

    JD!#E:J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    loopatit_structdescr assigningDls_field>.

    * !" change to 5/l name convention 6 e.g. %1% becomes %#!% 7

    lv_fieldname = Dls_field>-name.

    lv_fieldname = cl_abap_#ml_name_converter=>to_#ml_name lv_fieldname ".

    lv_inde# = sy-tabi#.

    * !" define range for a table mapping

    data: lv_range typestring.

    iflv_inde# = 2. lv_range = ('.

    else.

    data: lv_inde#E typestring.

    lv_inde#E = lv_inde# - 2.

    condenselv_inde#E.

    concatenate

    ('M

    lv_inde#E

    N

    intolv_range.

    endif.

  • 8/11/2019 Tree Control in WEB UI

    31/109

    lv_id = sy-tabi#.

    condenselv_inde# no-gaps.

    condenselv_id no-gaps.

    concatenate

    lv_#ml

    JD#E:ield #E:/=KJ

    lv_fieldname

    JK>J lv_crlf

    JD#E:(ange>J %only for table mappings

    lv_range

    JD!#E:(ange>J

    lv_crlf

    JD#E:J

    lv_fieldname

    JD!#E:J

    lv_crlf J D#E:stringD!#E:J

    lv_crlf

    J Dss:'ell>J

    lv_crlf

    J D!ss:'ell>J

    lv_crlf

    J D#E:7ggregate>+oneD!#E:7ggregate>J

    lv_crlf

    JD!#E:ield>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    endloop.

    concatenate

    lv_#ml

    JD!#E:ntry>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    concatenate

    lv_#ml

    J D!#E:)ap>J lv_crlf

    J D!#E:)ap/nfo>J

    lv_crlf

    JD!Aorkbook>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    * !" convert to 24;!9

    data: lv_conv_out typereftocl_abap_conv_out_ce.

    data: lv_conv typereftocl_abap_conv_#E#_ce.

    data: lv_#ml_bin type#string.

  • 8/11/2019 Tree Control in WEB UI

    32/109

    lv_conv_out = cl_abap_conv_out_ce=>create ".

    lv_conv_out->write e#portingdata= lv_#ml ".

    lv_#ml_bin = lv_conv_out->get_buffer ".

    lv_conv = cl_abap_conv_#E#_ce=>create

    out_encoding = ;5-I

    ignore_cerr = get_out_buffer ".

    endmethod.

    )56*$5_9'(/&_&8_757 /_757 ".

    '79%_757_9'(->580_/+.

    A6+'%_7&70_7579'(=>580/+_57&%.

    * !!" passed data is table

    %_57&%_9'( ?= %_757_9'(.

    %_757_67( = %_57&%_9'(->$5_57&%_%/+_580 ".

    %_(**5_+* = %_757_67(->$5_(%75/_+7) ".

    +'79.

    * !" change to 5/l name convention 6 e.g. %1% becomes %#!% 7

    %_(**5_+* = '%_7&70_

  • 8/11/2019 Tree Control in WEB UI

    33/109

    $'_/5)9

    /+5*%_(**5_+*.

    * !" create 5/ 6in system codepage7

    * 68A+2'#A(D+(G disables validty chec for values in iv#data and prevents 5/+#$)(8'R3

    (#()#(2/B'R exception7

    '7%%5(7+9*()75/*+ /

    *05/*+9 7%;_67+%/+$ = )*

    9*;(' 757= /_757

    (9;%5 '(75 ".

    %_'*+_*;5->A(/5 '(75

    *;5_+'*/+$ = ;5-I

    /$+*(_'(( =

  • 8/11/2019 Tree Control in WEB UI

    34/109

    )56*$5_'9_(*)_(;+ 0(*$+7) = '()_

  • 8/11/2019 Tree Control in WEB UI

    35/109

    method'(75_cr_lf.

    data: lt_fieldinfo typetableoffieldinfo.

    data: lv_ddic_struc typetabname.

    data: lv_#ml typestring.

    data: lv_#sd typestring.

    data: lv_inde# typestring.

    data: lv_id typestring.

    data: lv_columns typestring.

    data: lv_encoding typete#t211.

    data: lv_ddic_struc_str typestring.

    data: lv_name typestring.

    data: lv_fieldname typestring. data: lt_structdescr typecl_abap_structdescr=>component_table.

    data: ls_structdescr typeabap_componentdescr.

    field-symbols: Dls_field> typechtmlb_tv_comp_descr.

    lv_ddic_struc = iv_strucname.

    translatelv_ddic_struc touppercase. %&'$ 4RA(3+A(G

    * !" create top level 5/+

    concatenateJD?#ml version=K2.1K encoding=Kutf-IK?>J

    lv_crlf

    JD?mso-application progid=K#cel.9heetK?>J

    lv_crlf

    JDAorkbook #mlns=Kurn:schemas-microsoft-com:office:spreadsheetKJ

    J #mlns:o=Kurn:schemas-microsoft-com:office:officeKJ

    J #mlns:#=Kurn:schemas-microsoft-com:office:e#celKJ

    J #mlns:ss=Kurn:schemas-microsoft-com:office:spreadsheetKJ

    J #mlns:html=Khttp:!!www.wF.org!5(!('-htmlG1KJ

    J #mlns:#E=Khttp:!!schemas.microsoft.com!office!e#cel!E11F!#mlKJ

    J #mlns:#sd=Khttp:!!www.wF.org!E112!J

    lv_crlf intolv_#ml. %&'$ ()4'54

    * !" change to 5/l name convention 6 e.g. %1% becomes %#!% 7

    lv_ddic_struc_str = lv_ddic_struc.

    lv_ddic_struc_str = cl_abap_#ml_name_converter=>to_#ml_name lv_ddic_struc_str ".

    concatenate lv_#ml

    JDAorksheet ss:+ame=K9heet2K>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

  • 8/11/2019 Tree Control in WEB UI

    36/109

    * !" create column headers from field names

    lv_columns = lines it_structdescr ".

    condenselv_columns no-gaps.

    concatenate

    lv_#ml

    J D5able ss:#panded'olumn'ount=KJ

    lv_columns

    JK ss:#panded(ow'ount=KEK #:ull'olumns=K2K #:ull(ows=K2K>J

    lv_crlf J D(ow>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    * column title

    loopatit_structdescr assigningDls_field>.

    appendDls_field>-abap tolt_structdescr.

    concatenate

    lv_#ml

    J D'ell>Data ss:5ype=K9tringK>J

    Dls_field>-column_title

    JD!ata>D!'ell>J

    lv_crlf intolv_#ml. %&'$ ()4'54

    endloop.

    concatenate

    lv_#ml

    J D!(ow>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    concatenate

    lv_#ml

    J D!5able>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    concatenate

    lv_#ml

    J DAorksheet*ptions #mlns=Kurn:schemas-microsoft-com:office:e#celK>J

    lv_crlf

    J D9elected!>J

    lv_crlf

    J D0anes>J

    lv_crlf J D0ane>J

    lv_crlf

    J D+umber>2D!+umber>J

    lv_crlf

    J D7ctive'ol>2D!7ctive'ol>J

    lv_crlf

    J D!0ane>J

    lv_crlf

    J D!0anes>J

    lv_crlf

    J D0rotect*b3ects>alseD!0rotect*b3ects>J

  • 8/11/2019 Tree Control in WEB UI

    37/109

    lv_crlf

    J D0rotect9cenarios>alseD!0rotect9cenarios>J

    lv_crlf

    J D!Aorksheet*ptions>J

    lv_crlf

    J D!Aorksheet>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    * !" include 5/+ schema from structure

    lv_#sd = cl_chtmlb_#ml_provider=>create_#sd_dynamic iv_strucname = iv_strucname

    iv_no_#ml_declaration = "4)#5/+#(A/'6 +8#(A/' 7.

    concatenate

    lv_#ml

    * x@:'ntry x@:4ype>%single% x@:D>% JD#E:ntry #E:5ype=KtableK #E:/=KJ

    lv_id

    JK>J

    lv_crlf

    JD#E:(ange>J

    * 3heet?CR@$

    * +8#(D'5

    J9heet2L(E'2:(E1'Jlv_columns

    JD!#E:(ange>J

  • 8/11/2019 Tree Control in WEB UI

    38/109

    JD#E:6eader(ange>(2'2D!#E:6eader(ange>J %only for table range

    lv_crlf

    JD#:ilter*n>5rueD!#:ilter*n>J

    lv_crlf

    JD#E:!J

    lv_name gc_items

    J!J

    * +8#(A/'

    JitemJ JD!#E:J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    loopatit_structdescr assigningDls_field>.

    * !" change to 5/l name convention 6 e.g. %1% becomes %#!% 7

    lv_fieldname = Dls_field>-name.

    lv_fieldname = cl_abap_#ml_name_converter=>to_#ml_name lv_fieldname ".

    lv_inde# = sy-tabi#.

    * !" define range for a table mapping

    data: lv_range typestring. iflv_inde# = 2.

    lv_range = ('.

    else.

    data: lv_inde#E typestring.

    lv_inde#E = lv_inde# - 2.

    condenselv_inde#E.

    concatenate

    ('M

    lv_inde#E

    N

    intolv_range.

    endif.

    lv_id = sy-tabi#.

    condenselv_inde# no-gaps.

    condenselv_id no-gaps.

    concatenate lv_#ml

    JD#E:ield #E:/=KJ

    lv_fieldname

    JK>J

    lv_crlf

    JD#E:(ange>J %only for table mappings

    lv_range

    JD!#E:(ange>J

    lv_crlf

    JD#E:J

    lv_fieldname

    JD!#E:J

    lv_crlf

  • 8/11/2019 Tree Control in WEB UI

    39/109

    J D#E:stringD!#E:J

    lv_crlf

    J Dss:'ell>J

    lv_crlf

    J D!ss:'ell>J

    lv_crlf

    J D#E:7ggregate>+oneD!#E:7ggregate>J

    lv_crlf

    JD!#E:ield>J

    lv_crlf intolv_#ml. %&'$ ()4'54

    endloop.

    concatenatelv_#ml

    JD!#E:ntry>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    concatenatelv_#ml

    J D!#E:)ap>J

    lv_crlf J D!#E:)ap/nfo>J

    lv_crlf

    JD!Aorkbook>J

    lv_crlf

    intolv_#ml. %&'$ ()4'54

    * !" convert to 24;!9

    data: lv_conv_out typereftocl_abap_conv_out_ce.

    data: lv_conv typereftocl_abap_conv_#E#_ce.

    data: lv_#ml_bin type#string.

    lv_conv_out = cl_abap_conv_out_ce=>create ".

    lv_conv_out->write e#portingdata= lv_#ml ".

    lv_#ml_bin = lv_conv_out->get_buffer ".

    lv_conv = cl_abap_conv_#E#_ce=>create out_encoding = ;5-I

    ignore_cerr = get_out_buffer ".

    endmethod.

  • 8/11/2019 Tree Control in WEB UI

    40/109

    methodget_#ml_from_model.

    data: lv_root_node typestring.

    data: lv_tab_siCe typei,

    lv_tab_siCe_nl typei,

    lv_tab_siCe_list typei.

    data: lv_field_name typestring,

    lv_field_name_#ml typestring.

    data: lv_inde# typei.

    data: lv_cell_value typestring.

    data: lv_#ml typestring. data: lv_field_type typestring,

    lv_tooltip typestring.

    data: lr_valuehelp_descr typereftoif_bsp_wd_valuehelp_descriptor,

    lr_picklist_descr typereftoif_bsp_wd_valuehelp_pldescr,

    lt_picklist_values typebsp_wd_dropdown_table.

    data: lv_conv_out typereftocl_abap_conv_out_ce.

    data: lv_conv typereftocl_abap_conv_#E#_ce.

    data: lv_#ml_bin type#string.

    data: lv_pl_binding_string typestring,

    lv_pl_value_path typestring,

    lv_pl_model_name typestring,

    lv_pl_mod typereftoif_bsp_model_binding,

    lv_pl_ob3ect typereftocl_bsp_wd_conte#t_node_ddlb,

    lt_pl_entries typereftobsp_wd_dropdown_table,

    lv_is_tree typeabap_bool,

    lv_is_tree_list typeabap_bool,

    lv_tree_indent typestring,

    lv_field_inde# typei.

    data: lr_entity typereftocl_crm_bol_entity,

    lv_prod_guid typecomt_product_guid,

    lr_cuco typerefto!glb!cl_lst_ppri_cucomain_impl,

    lr_coll_prod typereftocl_bsp_wd_collection_wrapper,

    lr_iterator typereftoif_bol_bo_col_iterator,

    lr_prod_it typereftocl_crm_bol_entity,

    l_o_ppritemproduct typereftoif_bsp_wd_e#t_property_access,

    l_o_model_ent 580(5*cl_crm_bol_entity.

    field-symbols: Dls_config> typebsp_dlc_column_descr,

    Dls_ddlb_line> typebsp_wd_dropdown_line,

    Dlt_entries> typebsp_wd_dropdown_table.

    * !" change to 5/l name convention 6 e.g. %1% becomes %#!% 7

    lv_root_node = cl_abap_#ml_name_converter=>to_#ml_name iv_name ".

  • 8/11/2019 Tree Control in WEB UI

    41/109

    * !" create name for root element

    concatenate

    lv_root_node

    gc_items

    intolv_root_node.

    * !" create start of 5/+ 6not yet 24;!9 encoded but will be later7

    lv_#ml = JD?#ml version=K2.1K encoding=Kutf-IK?>J.

    concatenate

    lv_#ml JDJ

    lv_root_node

    J>J

    intolv_#ml.

    * !" get table sie

    datalr_model_tree typereftocl_bsp_wd_conte#t_node_tree.

    try.

    lr_model_tree ?= iv_table_model.

    * tree

    lv_is_tree = abap_true.

    lv_tab_siCe_nl = lines lr_model_tree->node_tab ". catch: c#_root. %&'$ $A4$#A++

    * table

    lv_is_tree = abap_false.

    lv_tab_siCe_nl = iv_table_model->get_table_siCe ".

    endtry.

    datalr_model_tree_list typereftocl_bsp_wd_conte#t_node_tree.

    try.

    lr_model_tree_list ?= !glb!cl_lst_itemlisted_cn11=>gv_table_model.

    * tree

    lv_is_tree_list = abap_true.

    lv_tab_siCe_list = lines lr_model_tree_list->node_tab ".

    catch: c#_root. %&'$ $A4$#A++

    * table

    lv_is_tree_list = abap_false.

    lv_tab_siCe_list = iv_table_model->get_table_siCe ".

    endtry.

    iflv_tab_siCe_nl > lv_tab_siCe_list.

    lv_tab_siCe = lv_tab_siCe_nl.

    else.

    lv_tab_siCe = lv_tab_siCe_list.

    endif. lv_cell_value = +ot %isted and %isted /tems.

    lv_cell_value = cl_bsp_utility=>encode_string in = lv_cell_value

    encoding= if_bsp_writer=>co_htm

    ".

    check!glb!cl_lst_itemnotlisted_impl=>gr_cuco isbound.

    lr_cuco = !glb!cl_lst_itemnotlisted_impl=>gr_cuco.

    iflr_cuco isbound.

    lr_coll_prod = lr_cuco->typed_conte#t->ppritemprod->collection_wrapper.

    iflr_coll_prod isbound.

    lr_iterator = lr_coll_prod->if_bol_bo_colBget_iterator ".

  • 8/11/2019 Tree Control in WEB UI

    42/109

    endif.

    endif.

    dolv_tab_siCe times.

    * !" create 5/+ for each table row

    lv_inde# = sy-inde#.

    concatenate

    lv_#ml

    JDitem>J

    intolv_#ml. iflv_inde# D= lv_tab_siCe_list.

    lr_entity ?= lr_model_tree_list->get_bo_by_inde# lv_inde# ".

    cleargr_settype.

    iflr_entity->get_name " e4if_prcat_ap_bol_model=>gc_product_ob3.

    callmethodlr_entity->get_property_as_value

    e#porting

    iv_attr_name = 0(*;'5_$;/

    importing

    ev_result = lv_prod_guid.

    iflr_iterator isbound.

    try.

    lr_prod_it ?= lr_iterator->find_by_property iv_attr_name = 0(*;'5_(_$;/iv_value = lv_prod_guid ".

    iflr_prod_it isbound.

    gr_settype = lr_prod_it->get_related_entity 0pr9t7tt9800(_95_5802(el"

    endif.

    catchc#_sy_move_cast_error.

    l_o_ppritemproduct ?= lr_iterator->find_by_property iv_attr_name = 0(*;'5_

    _$;/iv_value = lv_prod_guid ".

    iflr_prod_it isbound.

    l_o_model_ent ?= l_o_ppritemproduct->get_model_node ".

    gr_settype = l_o_model_ent->get_related_entity 0pr9t7tt9800(_95_5802(el

    .

    endif.

    endtry.

    endif.

    endif.

    endif.

    * for (ot +isted tems

    loopatit_config assigningDls_config>.

    lv_field_inde# = sy-tabi#.

    caseDls_config>-title.

    when!!6/(7('68!'75$*(8_5-name.

    lv_field_name_#ml = cl_abap_#ml_name_converter=>to_#ml_name lv_field_name ".

    try.

    lv_cell_value = iv_table_model->get_t_table attribute_path =

  • 8/11/2019 Tree Control in WEB UI

    43/109

    inde# = lv_inde#

    component = lv_field_name

    catchc#_root.

    concatenatelv_field_name J not boundJintolv_cell_value. %&'$ ()4'54

    endtry.

    * !" remove line breas

    replacealloccurrencesofcl_abap_char_utilities=>cr_lf inlv_cell_value with

    * !" put tree indent in front if first row in tree

    iflv_field_inde# = 2.

    iflv_is_tree = abap_true.

    lv_tree_indent = cl_bsp_utility=>encode_string in = lv_tree_indent

    encoding= if_bsp_writer=>co_h

    l ". %@,,E!,F!@, cpl: problems with cross side scripting

    concatenate

    lv_#ml

    JD/++5>J

    lv_tree_indent

    JD!/++5>J

    intolv_#ml. endif.

    endif.

    * !!" cell 5/+

    lv_cell_value = cl_bsp_utility=>encode_string in = lv_cell_value

    encoding= if_bsp_writer=>co_html

    %@,,E!,F!@, cpl: problems with cross side scripting

    concatenate

    lv_#ml

    JDJ

    lv_field_name_#ml

    J>J

    lv_cell_value

    JD!J

    lv_field_name_#ml

    J>J

    intolv_#ml.

    * for listed items

    whenothers.

    * chec for indent if we export a tree

    iflv_field_inde# = F. iflv_is_tree_list = abap_true.

    lv_tree_indent = calculate_tree_indent ir_tree_model = lr_model_tree_list

    iv_inde# = lv_inde# ".

    endif.

    endif.

    * !" get data for each cell

    lv_field_name = Dls_config>-name.

    lv_field_name_#ml = cl_abap_#ml_name_converter=>to_#ml_name lv_field_name ".

    try.

    lv_cell_value = !glb!cl_lst_itemlisted_cn11=>gv_table_model->get_t_table att

    bute_path =

  • 8/11/2019 Tree Control in WEB UI

    44/109

    inde# = lv_inde#

    component = lv_field_name

    catchc#_root.

    concatenatelv_field_name J not boundJintolv_cell_value. %&'$ ()4'54

    endtry.

    * !" remove line breas

    replacealloccurrencesofcl_abap_char_utilities=>cr_lf inlv_cell_value with

    * !" put tree indent in front if first row in tree

    iflv_field_inde# = F.

    iflv_is_tree_list = abap_true.

    lv_tree_indent = cl_bsp_utility=>encode_string in = lv_tree_indent

    encoding= if_bsp_writer=>co_h

    l ". %@,,E!,F!@, cpl: problems with cross side scripting

    concatenate

    lv_#ml

    JD/++5>J

    lv_tree_indent

    JD!/++5>J intolv_#ml.

    endif.

    endif.

    * !!" cell 5/+

    lv_cell_value = cl_bsp_utility=>encode_string in = lv_cell_value

    encoding= if_bsp_writer=>co_htm

    ". %@,,E!,F!@, cpl: problems with cross side scripting

    concatenate

    lv_#ml

    JDJ

    lv_field_name_#ml

    J>J

    lv_cell_value

    JD!J

    lv_field_name_#ml

    J>J

    intolv_#ml.

    endcase.

    endloop.

    * !" end line. concatenate

    lv_#ml

    JD!item>J

    intolv_#ml.

    enddo.

    * !" end 5/+

    concatenate

    lv_#ml

    JD!J

    lv_root_node

  • 8/11/2019 Tree Control in WEB UI

    45/109

    J>J

    intolv_#ml.

    * !" convert to 24;!9

    lv_conv_out = cl_abap_conv_out_ce=>create ".

    lv_conv_out->write e#portingdata= lv_#ml ".

    lv_#ml_bin = lv_conv_out->get_buffer ".

    lv_conv = cl_abap_conv_#E#_ce=>create out_encoding = ;5-I

    ignore_cerr = get_out_buffer ".

    ev_#ml = lv_#ml_bin.

    endmethod.

    methodif_bsp_wd_model_tv_e#cel_e#prtBget_data_#ml.

    data: lt_config_tab typebsp_dlc_column_descr_tab,

    lv_string typestring. %&'$ (''D'D

    field-symbols Dls_config_data> typebsp_dlc_column_descr.

    * Get configuration data.

    ifiv_config_table isnotsupplied.

    lt_config_tab = cl_bsp_dlc_table_utility=>get_table_from_config_#ml iv_config_#ml ". else.

    lt_config_tab = iv_config_table.

    endif.

    loopatlt_config_tab assigningDls_config_data>.

    * )nly consider data if it was not removed by personaliation.

    ifDls_config_data>-hidden isnotinitial.

    deletelt_config_tab inde#sy-tabi#.

    continue.

    endif.

  • 8/11/2019 Tree Control in WEB UI

    46/109

    whileDls_config_data>-name ca..

    splitDls_config_data>-name at.intolv_string Dls_config_data>-name.

    endwhile.

    endloop.

    !glb!cl_lst_itemnotlisted_cn11=>gv_e#cel = abap_true.

    * ;orward to 5/+ generator.

    rv_content_bin = !glb!cl_chtmlb_#ml_provider=>get_#ml_from_model it_config = lt_con

    g_tab iv_table_model = me

    iv_name = me-

    >structure_name

    iv_view_controller = iv_view

    ontroller ".

    !glb!cl_lst_itemnotlisted_cn11=>gv_e#cel = abap_false.

    endmethod.

    methodif_bsp_wd_model_tv_e#cel_e#prtBget_csv.

    data: lv_content_bin type#string.

    data: lt_config_tab typebsp_dlc_column_descr_tab,

    lv_config_data typebsp_dlc_column_descr,

    lt_comp_tab typecl_chtmlb_#ml_provider=>chtmlb_tv_comp_descr_tab, %&'$

    ''D'D

    lv_comp typecl_chtmlb_#ml_provider=>chtmlb_tv_comp_descr,

    lv_string typestring, %&'$ (''D'D

    lr_view_descriptor typereftoif_bsp_dlc_view_descriptor,

    lr_view_descriptor_cl typereftocl_bsp_dlc_view_descriptor, lv_title typebsp_dlc_element_id,

    lv_csv_head typestring,

    lv_csv_head_bin type#string,

    lv_csv_head_ret typestring,

    lv_conv_out typereftocl_abap_conv_out_ce,

    lv_conv_in typereftocl_abap_conv_in_ce,

    lv_conv typereftocl_abap_conv_#E#_ce,

    lv_first_column typeabap_bool,

    lv_cr typeabap_cr_lf valuecl_abap_char_utilities=>cr_lf,

    lv_content typestring,

    lv_content_ret typestring,

    lv_utf_2P_headerE" type#, lv_utf_FE_headerG" type#,

    lv_is_unicode_system typetrpari-flag,

    lv_codepage typeabap_encoding,

    lv_use_utf2P typeabap_bool,

    lv_use_utfFE typeabap_bool,

    lv_use_sep_row typeabap_bool,

    lv_codepage_cQ1" typec,

    lv_codepage_s typestring,

    lv_use_sep_row_not_c typec,

    l_v_dummy typestring,

    l_v_field typename_komp,

  • 8/11/2019 Tree Control in WEB UI

    47/109

    l_v_value typestring,

    l_s_fields likelineof!glb!cl_crmcmp_l_fview_control=>g_i_fields,

    l_o_ent typereftoif_bol_bo_property_access,

    l_o_cuco typerefto!glb!cl_lst_ppri_cucomain_impl,

    cr_converter typerefto!glb!cl_crmcmp_l_field_convert,

    ls_hiernodes type!glb!cgtgds_hiernode_details.

    callfunction5(_$5_/9_;+/'*_9895)

    importing

    ev_is_unicode_system = lv_is_unicode_system.

    * collect codepage and seprow

    getparameterid'()_'9_ 1.

    * codepage not found- use standard

    lv_codepage = G21F.

    endif.

    endif.

    endif.

    lv_use_sep_row = abap_true.

    getparameterid'()_'9_typed_conte#t->lsthdr->collection_wrapper->get_current ".

    endif.

    concatenatesep=Rlv_cr intolv_csv_head.

    concatenatelv_csv_head K%/95/+$ 57/%9KRlv_cr intolv_csv_head.

  • 8/11/2019 Tree Control in WEB UI

    48/109

    loopat!glb!cl_crmcmp_l_fview_control=>g_i_fields intol_s_fields.

    splitl_s_fields-field_name at!!'*+('*(!intol_v_dummy l_v_field.

    ifl_v_field isinitialandl_v_dummy isnotinitial.

    translatel_s_fields-field_label touppercase. %&'$ 4RA(3+A(G

    clearl_v_value.

    else.

    try.

    l_v_value = l_o_ent->get_property_as_string iv_attr_name = l_v_field ".

    catchc#_crm_cic_parameter_error.

    endtry. casel_v_field.

    when!glb!cl_cgtgd_list_constants=>status.

    callmethodcl_crmcmp_c_icon_mapper=>get_icon_url_and_te#t

    e#porting

    iv_val = l_v_value

    importing

    ev_te#t = l_v_value.

    when!glb!cl_cgtgd_list_constants=>kschl.

    createob3ect cr_converter

    e#porting

    ir_node = l_o_cuco->typed_conte#t->lsthdr. callmethodcr_converter->get

    e#porting

    getter = $5_9'6%

    attribute_path = 9'6%

    current = l_o_ent

    iv_owner = !glb!cl_crm_condrecconfed_cn11=>gr_owner

    receiving

    value = l_v_value.

    when!glb!cl_cgtgd_list_constants=>hier_node_search_term.

    readtable!glb!cl_crm_condrecconfed_impl=>g_i_hier_node intols_hiernodes withk

    node_id = l_v_value. %&'$ *

    ifsy-subrc = 1.

    l_v_value = ls_hiernodes-description.

    endif.

    endcase.

    endif.

    concatenatelv_csv_head lv_cr Kl_s_fields-field_label KR intolv_csv_head.

    concatenatelv_csv_head Kl_v_value KRintolv_csv_head.

    endloop.

    * get configuration in a table format

    ifiv_config_table isnotsupplied.

    lt_config_tab = cl_bsp_dlc_table_utility=>get_table_from_config_#ml iv_config_#ml ". else.

    lt_config_tab = iv_config_table.

    endif.

    lv_first_column = abap_true.

    loopatlt_config_tab intolv_config_data.

    clearlv_comp.

    * column removed by personaliation

    iflv_config_data-hidden isnotinitial.

    deletelt_config_tab inde#sy-tabi#.

    continue.

  • 8/11/2019 Tree Control in WEB UI

    49/109

    endif.

    * read column name

    iflv_config_data-titleE" D> !!.

    iflv_config_data-titleisnotinitial.

    lv_comp-column_title = lv_config_data-title.

    else.

    lv_comp-column_title = lv_config_data-name.

    endif.

    else.

    iflr_view_descriptor isbound.* get field label

    lv_title = lv_config_data-title.

    lv_comp-column_title = lr_view_descriptor->get_field_label

    iv_element_id = lv_title

    iv_conte#t_node = me ".

    endif.

    endif.

    * remove KRintolv_csv_head.

    endif.

    else.

    iflv_use_sep_row = abap_true.

    concatenatelv_csv_head lv_cr intolv_csv_head.

    concatenatelv_csv_head K%/95/+$ /5) )7/+5+7+'KRintolv_csv_head.

    concatenatelv_csv_head lv_cr intolv_csv_head.

    concatenatelv_csv_head K+*5%/95KRRRK%/95KRintolv_csv_head.

    endif.

    concatenatelv_csv_head lv_cr intolv_csv_head.

    concatenatelv_csv_head K>KRintolv_csv_head.

    endif.

    lv_first_column = abap_false.

    concatenatelv_csv_head Klv_comp-column_title Kintolv_csv_head.

    endloop.

    concatenatelv_csv_head lv_cr intolv_csv_head.

    * chec for codepage setting

    iflv_codepage isinitial.

    lv_codepage = G21F.

    endif.

    lv_use_utf2P = abap_false.

    lv_use_utfFE = abap_false.

    caselv_codepage.

    whenG21E.

    lv_use_utf2P = abap_true.

    lv_utf_2P_header = .

    whenG21F.

  • 8/11/2019 Tree Control in WEB UI

    50/109

    lv_use_utf2P = abap_true.

    lv_utf_2P_header = .

    whenG21G.

    lv_use_utfFE = abap_true.

    lv_utf_FE_header = 1111.

    whenG21Q.

    lv_use_utfFE = abap_true.

    lv_utf_FE_header = 1111.

    endcase.

    * !" convert to 24;!?E

    lv_conv_out = cl_abap_conv_out_ce=>create ".

    lv_conv_out->write e#portingdata= lv_csv_head ".

    lv_csv_head_bin = lv_conv_out->get_buffer ".

    lv_conv = cl_abap_conv_#E#_ce=>create

    out_encoding = lv_codepage

    ignore_cerr = get_out_buffer ".

    iflv_use_utf2P = abap_true.

    concatenatelv_utf_2P_header lv_csv_head_bin intolv_csv_head_bin inbyte mode.

    endif.

    iflv_use_utfFE = abap_true.

    concatenatelv_utf_FE_header lv_csv_head_bin intolv_csv_head_bin inbyte mode.

    endif.

    iflv_is_unicode_system = abap_false.

    lv_conv_in = cl_abap_conv_in_ce=>create ".

    lv_conv_in->convert e#portinginput= lv_csv_head_bin

    importingdata= lv_csv_head_ret ".

    else.

    lv_csv_head_ret = cl_rt_rep_toolkit=>#Es lv_csv_head_bin ".

    endif.

    callmethodme->get_data_#ml

    e#porting

    * iv#config#xml > iv#config#xml

    iv_config_table = lt_config_tab

    iv_view_controller = iv_view_controller

    receiving

    rv_content_bin = lv_content_bin.

    lv_content = cl_chtmlb_#ml_provider=>get_csv_from_#ml lv_content_bin ".

    lv_conv_out = cl_abap_conv_out_ce=>create ".

    lv_conv_out->write e#portingdata= lv_content ".

    lv_content_bin = lv_conv_out->get_buffer ".

    lv_conv = cl_abap_conv_#E#_ce=>create

    out_encoding = lv_codepage

    ignore_cerr = get_out_buffer ".

  • 8/11/2019 Tree Control in WEB UI

    51/109

    lv_content_ret = cl_rt_rep_toolkit=>#Es lv_content_bin ".

    concatenatelv_csv_head_ret lv_content_ret intorv_content.

    endmethod.

    methodget_table_components.

    *Data declaration

    data: ls_result typebsp_dlc_column_descr.

    data: l_v_cond typecrmt_prp_type,

    l_v_salesorg typestring,

    l_v_distch typestring.

    data: l_s_column typetableviewcontrol, %&'$ (''D'D

    l_i_saflds typestandardtableof!glb!cgtt_saflds,

    l_s_saflds likelineofl_i_saflds,

    l_i_prp_reftypes typecrmt_prp_reftype_tab,

    l_s_prp_reftypes likelineofl_i_prp_reftypes.

    data: l_o_cuco typerefto!glb!cl_lst_ppri_cucomain_impl,

    l_o_lsthdr typereftocl_crm_bol_entity.

    callmethodsuper->get_table_components

    receiving rt_result = rt_result.

    ls_result-name = !glb!cl_cgtgd_list_constants=>category_te#t. %

  • 8/11/2019 Tree Control in WEB UI

    52/109

    checkl_v_cond cp!glb!cl_cgtgd_list_constants=>C112.

    callfunction'()_0(0_955809_*(_0(0_580

    e#porting

    iv_prp_type = l_v_cond

    iv_language = sy-langu

    importing

    et_prp_reftypes = l_i_prp_reftypes.

    readtablel_i_prp_reftypes intol_s_prp_reftypes inde#2.

    checkl_s_prp_reftypes-settype_id = te#t-112.

    selectS from!glb!cgtt_saflds intotablel_i_saflds wheresales_org = l_v_salesorg and

    istchan = l_v_distch andactive = abap_true.

    loopatl_i_saflds intol_s_saflds.

    casel_s_saflds-additionalfields.

    when!glb!cl_cgtgd_list_constants=>ccode.%

  • 8/11/2019 Tree Control in WEB UI

    53/109

    method$5_57&%_%/+_97)0%.

    5809: &$/+*line,

    '75$*(8_/ 580'*)5_'75$*(8_/,

    '75$*(8_5

  • 8/11/2019 Tree Control in WEB UI

    54/109

    attribute_path = attribute_path

    name = 6/(7('68_/ %&'$ ()4'54

    * $)/=)('(4 >

    no_getter = 2".

    endmethod.

    method$5_)_6/(7('68_5

  • 8/11/2019 Tree Control in WEB UI

    55/109

    $5((+'*attr /+5*dref.

    metadata ?= if_bsp_model_bindingBget_attribute_metadata

    attribute_ref = dref

    attribute_path = attribute_path

    name = %7+$;_5

  • 8/11/2019 Tree Control in WEB UI

    56/109

    dref = current->get_property (**5_'75_$;/".%&'$ ()4'54

    '75'6c#_crm_cic_parameter_error.

    +5(8.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    /dref /9+*5&*;+.

    value= 0r'ategory6ierarchy!(**5_'75_$;/ not bound.%&'$ ()4'54

    (5;(+.

    +/.

    5(8.

    value= if_bsp_model_utilBconvert_to_string data_ref = dref

    attribute_path = attribute_path ".

    '75'6c#_bsp_conv_illegal_ref.

    /%-98)&*%9: Dl_data> type757.

    assigndref->S toDl_data>.

    * please implement here some B) specific handler coding* conversion of currency1Iuantity field failed caused by missing

    * unit relation

    * $oding sample:

    * provide currency- decimals- and reference type

    * value > cl#bsp#utility>"mae#string6

    * value > l#data"

    * reference#value > c#currency

    * num#decimals > decimals

    * reference#type > reference#type

    * 7.

    '*+'75+75Dl_data> -';((!;7+5 '*+ 7/%-/+5*value

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54

    +5(8.

    endmethod.

    method95_6/(7('68_$;/.

    757:

    current 580(5*if_bol_bo_property_access,

    dref 580(5*data,

    copy 580(5*data.

    /%-98)&*%9:

    Dnval> 5807+8,

    Doval> 5807+8.

    * get current entity

    ifiterator isbound.

  • 8/11/2019 Tree Control in WEB UI

    57/109

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    * get old value and dataref to appropriate type

    5(8.

    5(8. dref = current->get_property 6/(7('68_$;/".%&'$ ()4'54

    '75'6c#_crm_cic_parameter_error.

    +5(8.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    * assure that attribue exists

    '6'dref /9&*;+.

    * set oval" to old value

    799/$+dref->S 5*Doval>.

    * create a copy for new value

    '(75757copy%/Doval>.

    * set nval" to new value

    799/$+copy->S 5*Dnval>.

    * fill new value using the right conversion

    5(8.

    '7%%)56*if_bsp_model_utilBconvert_from_string

    D> Doval>.

    current->set_property

    iv_attr_name = 6/(7('68_$;/ %&'$ ()4'54

    iv_value = Dnval> ".

    +/.

    endmethod.

  • 8/11/2019 Tree Control in WEB UI

    58/109

    method95_6/(7('68_/.

    757:

    current 580(5*if_bol_bo_property_access,

    dref 580(5*data,

    copy 580(5*data.

    /%-98)&*%9:

    Dnval> 5807+8,

    Doval> 5807+8.

    * get current entity

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    * get old value and dataref to appropriate type

    5(8.

    5(8.

    dref = current->get_property 6/(7('68_/". %&'$ ()4'54

    '75'6c#_crm_cic_parameter_error.

    +5(8.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    * assure that attribue exists

    '6'dref /9&*;+.

    * set oval" to old value

    799/$+dref->S 5*Doval>.

    * create a copy for new value

    '(75757copy%/Doval>.

    * set nval" to new value

    799/$+copy->S 5*Dnval>.

    * fill new value using the right conversion

    5(8. '7%%)56*if_bsp_model_utilBconvert_from_string

  • 8/11/2019 Tree Control in WEB UI

    59/109

    /Dnval> D> Doval>.

    current->set_property

    iv_attr_name = 6/(7('68_/ %&'$ ()4'54

    iv_value = Dnval> ".

    +/.

    endmethod.

    method95_6/(7('68_5 5807+8, Doval> 5807+8.

    * get current entity

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    * get old value and dataref to appropriate type

    5(8.

    757: coll 580(5*if_bol_entity_col.

    757: entity 580(5*cl_crm_bol_entity.

    entity ?= current.

    coll = entity->get_related_entities

    iv_relation_name = 0r'ategory6ierarchyescr(el".%&'$ ()4'54

    current = coll->get_current ".

    /current /9+*5&*;+.

    (5;(+.

    +/.

    5(8.

    dref = current->get_property 6/(7('68_5

  • 8/11/2019 Tree Control in WEB UI

    60/109

    * assure that attribue exists

    '6'dref /9&*;+.

    * set oval" to old value

    799/$+dref->S 5*Doval>.

    * create a copy for new value

    '(75757copy%/Doval>.

    * set nval" to new value

    799/$+copy->S 5*Dnval>.

    * fill new value using the right conversion

    5(8.

    '7%%)56*if_bsp_model_utilBconvert_from_string

    Doval>.

    current->set_property

    iv_attr_name = 6/(7('68_5 ".

    +/.

    endmethod.

    method95_%7+$;.

    757:

    current 580(5*if_bol_bo_property_access,

    dref 580(5*data,

    copy 580(5*data.

    /%-98)&*%9:

    Dnval> 5807+8,

    Doval> 5807+8.

    * get current entity

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    * get old value and dataref to appropriate type

    5(8.

  • 8/11/2019 Tree Control in WEB UI

    61/109

    757: coll 580(5*if_bol_entity_col.

    757: entity 580(5*cl_crm_bol_entity.

    entity ?= current.

    coll = entity->get_related_entities

    iv_relation_name = 0r'ategory6ierarchyescr(el".%&'$ ()4'54

    current = coll->get_current ".

    /current /9+*5&*;+.

    (5;(+. +/.

    5(8.

    dref = current->get_property %7+$;". %&'$ ()4'54

    '75'6c#_crm_cic_parameter_error.

    +5(8.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    * assure that attribue exists

    '6'dref /9&*;+.

    * set oval" to old value

    799/$+dref->S 5*Doval>.

    * create a copy for new value

    '(75757copy%/Doval>.

    * set nval" to new value

    799/$+copy->S 5*Dnval>.

    * fill new value using the right conversion

    5(8.

    '7%%)56*if_bsp_model_utilBconvert_from_string

  • 8/11/2019 Tree Control in WEB UI

    62/109

    method95_%7+$;_5 5807+8,

    Doval> 5807+8.

    * get current entity

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    * get old value and dataref to appropriate type

    5(8.

    757: coll 580(5*if_bol_entity_col.

    757: entity 580(5*cl_crm_bol_entity.

    entity ?= current.

    coll = entity->get_related_entities

    iv_relation_name = 0r'ategory6ierarchyescr(el".%&'$ ()4'54

    current = coll->get_current ".

    /current /9+*5&*;+.

    (5;(+.

    +/.

    5(8.

    dref = current->get_property %7+$;_5S 5*Doval>.

    * create a copy for new value

    '(75757copy%/Doval>.

    * set nval" to new value

    799/$+copy->S 5*Dnval>.

    * fill new value using the right conversion

    5(8.

  • 8/11/2019 Tree Control in WEB UI

    63/109

    '7%%)56*if_bsp_model_utilBconvert_from_string

    5807+8,

    Doval> 5807+8.

    * get current entity

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    * get old value and dataref to appropriate type

    5(8.

    5(8.

    dref = current->get_property (**5_'75_$;/".%&'$ ()4'54

    '75'6c#_crm_cic_parameter_error.

    +5(8.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

  • 8/11/2019 Tree Control in WEB UI

    64/109

    * assure that attribue exists

    '6'dref /9&*;+.

    * set oval" to old value

    799/$+dref->S 5*Doval>.

    * create a copy for new value

    '(75757copy%/Doval>.

    * set nval" to new value

    799/$+copy->S 5*Dnval>.

    * fill new value using the right conversion

    5(8.

    '7%%)56*if_bsp_model_utilBconvert_from_string

    D> Doval>.

    current->set_property

    iv_attr_name = (**5_'75_$;/ %&'$ ()4'54

    iv_value = Dnval> ".

    +/.

    endmethod.

    method$5_6/(7('68_$;/.

    757: current 580(5*if_bol_bo_property_access.

    757: dref 580(5*data.

    value=

    0r'ategory6ierarchy not bound. %&'$ ()4'54

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    5(8.

    5(8.

  • 8/11/2019 Tree Control in WEB UI

    65/109

    dref = current->get_property 6/(7('68_$;/".%&'$ ()4'54

    '75'6c#_crm_cic_parameter_error.

    +5(8.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    /dref /9+*5&*;+.

    value= 0r'ategory6ierarchy!6/(7('68_$;/ not bound.%&'$ ()4'54

    (5;(+.

    +/.

    5(8.

    value= if_bsp_model_utilBconvert_to_string data_ref = dref

    attribute_path = attribute_path ".

    '75'6c#_bsp_conv_illegal_ref.

    /%-98)&*%9: Dl_data> type757.

    assigndref->S toDl_data>.

    * please implement here some B) specific handler coding* conversion of currency1Iuantity field failed caused by missing

    * unit relation

    * $oding sample:

    * provide currency- decimals- and reference type

    * value > cl#bsp#utility>"mae#string6

    * value > l#data"

    * reference#value > c#currency

    * num#decimals > decimals

    * reference#type > reference#type

    * 7.

    '*+'75+75Dl_data> -';((!;7+5 '*+ 7/%-/+5*value

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54

    +5(8.

    endmethod.

    method$5_6/(7('68_/.

    757: current 580(5*if_bol_bo_property_access.

    757: dref 580(5*data.

    value=

    0r'ategory6ierarchy not bound. %&'$ ()4'54

    ifiterator isbound.

    current = iterator->get_current ".

  • 8/11/2019 Tree Control in WEB UI

    66/109

    else.

    current = collection_wrapper->get_current ".

    endif.

    5(8.

    5(8.

    dref = current->get_property 6/(7('68_/". %&'$ ()4'54

    '75'6c#_crm_cic_parameter_error. +5(8.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    /dref /9+*5&*;+.

    value= 0r'ategory6ierarchy!6/(7('68_/ not bound. %&'$ ()4'54

    (5;(+. +/.

    5(8.

    value= if_bsp_model_utilBconvert_to_string data_ref = dref

    attribute_path = attribute_path ".

    '75'6c#_bsp_conv_illegal_ref.

    /%-98)&*%9: Dl_data> type757.

    assigndref->S toDl_data>.

    * please implement here some B) specific handler coding

    * conversion of currency1Iuantity field failed caused by missing

    * unit relation

    * $oding sample:

    * provide currency- decimals- and reference type

    * value > cl#bsp#utility>"mae#string6

    * value > l#data"

    * reference#value > c#currency

    * num#decimals > decimals

    * reference#type > reference#type

    * 7.

    '*+'75+75Dl_data> -';((!;7+5 '*+ 7/%-/+5*value

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54 +5(8.

    endmethod.

    method$5_6/(7('68_5

  • 8/11/2019 Tree Control in WEB UI

    67/109

    value=

    0r'ategory6ierarchy not bound. %&'$ ()4'54

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ". endif.

    5(8.

    757: coll 580(5*if_bol_entity_col.

    757: entity 580(5*cl_crm_bol_entity.

    entity ?= current.

    coll = entity->get_related_entities

    iv_relation_name = 0r'ategory6ierarchyescr(el".%&'$ ()4'54

    current = coll->get_current ". /current /9+*5&*;+.

    (5;(+.

    +/.

    5(8.

    dref = current->get_property 6/(7('68_5 type757.

    assigndref->S toDl_data>.

    * please implement here some B) specific handler coding

    * conversion of currency1Iuantity field failed caused by missing

    * unit relation

    * $oding sample:

    * provide currency- decimals- and reference type

    * value > cl#bsp#utility>"mae#string6

    * value > l#data"

  • 8/11/2019 Tree Control in WEB UI

    68/109

    * reference#value > c#currency

    * num#decimals > decimals

    * reference#type > reference#type

    * 7.

    '*+'75+75Dl_data> -';((!;7+5 '*+ 7/%-/+5*value

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54

    +5(8.

    endmethod.

    method$5_/_6/(7('68_$;/.

    757: current 580(5*if_bol_bo_property_access.

    rv_disabled = 5(;. ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    5(8.

    /current->is_property_readonly

    6/(7('68_$;/" = abap_false. %&'$ ()4'54

    rv_disabled = 7%9.

    +/.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    endmethod.

    method$5_/_6/(7('68_/.

    757: current 580(5*if_bol_bo_property_access.

    rv_disabled = 5(;.

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    5(8.

  • 8/11/2019 Tree Control in WEB UI

    69/109

    /current->is_property_readonly

    6/(7('68_/" = abap_false. %&'$ ()4'54

    rv_disabled = 7%9.

    +/.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    endmethod.

    method$5_/_6/(7('68_5get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    5(8.

    757: coll 580(5*if_bol_entity_col.

    757: entity 580(5*cl_crm_bol_entity.

    entity ?= current.

    coll = entity->get_related_entities iv_relation_name = 0r'ategory6ierarchyescr(el".%&'$ ()4'54

    current = coll->get_current ".

    /current /9+*5&*;+.

    (5;(+.

    +/.

    /current->is_property_readonly

    6/(7('68_5

  • 8/11/2019 Tree Control in WEB UI

    70/109

    method$5_/_%7+$;.

    757: current 580(5*if_bol_bo_property_access.

    rv_disabled = 5(;.

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    5(8.

    757: coll 580(5*if_bol_entity_col.

    757: entity 580(5*cl_crm_bol_entity.

    entity ?= current.

    coll = entity->get_related_entities

    iv_relation_name = 0r'ategory6ierarchyescr(el".%&'$ ()4'54

    current = coll->get_current ".

    /current /9+*5&*;+.

    (5;(+. +/.

    /current->is_property_readonly

    %7+$;" = abap_false. %&'$ ()4'54

    rv_disabled = 7%9.

    +/.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    endmethod.

    method$5_/_%7+$;_5get_current ".

    else.

    current = collection_wrapper->get_current ".

    endif.

    5(8.

    757: coll 580(5*if_bol_entity_col.

    757: entity 580(5*cl_crm_bol_entity.

    entity ?= current.

  • 8/11/2019 Tree Control in WEB UI

    71/109

    coll = entity->get_related_entities

    iv_relation_name = 0r'ategory6ierarchyescr(el".%&'$ ()4'54

    current = coll->get_current ".

    /current /9+*5&*;+.

    (5;(+.

    +/.

    /current->is_property_readonly

    %7+$;_5get_current ".

    endif.

    5(8.

    /current->is_property_readonly

    (**5_'75_$;/" = abap_false. %&'$ ()4'54

    rv_disabled = 7%9.

    +/.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    endmethod.

    method$5_%7+$;.

    757: current 580(5*if_bol_bo_property_access.

    757: dref 580(5*data.

  • 8/11/2019 Tree Control in WEB UI

    72/109

    value=

    0r'ategory6ierarchy not bound. %&'$ ()4'54

    ifiterator isbound.

    current = iterator->get_current ".

    else.

    current = collection_wrapper->get_current ". endif.

    5(8.

    757: coll 580(5*if_bol_entity_col.

    757: entity 580(5*cl_crm_bol_entity.

    entity ?= current.

    coll = entity->get_related_entities

    iv_relation_name = 0r'ategory6ierarchyescr(el".%&'$ ()4'54

    current = coll->get_current ". /current /9+*5&*;+.

    (5;(+.

    +/.

    5(8.

    dref = current->get_property %7+$;". %&'$ ()4'54

    '75'6c#_crm_cic_parameter_error.

    +5(8.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    /dref /9+*5&*;+.

    value=

    0r'ategory6ierarchy!0r'ategory6ierarchyescr... not bound.%&'$ ()4'54

    (5;(+.

    +/.

    5(8.

    value= if_bsp_model_utilBconvert_to_string data_ref = dref attribute_path = attribute_path ".

    '75'6c#_bsp_conv_illegal_ref.

    /%-98)&*%9: Dl_data> type757.

    assigndref->S toDl_data>.

    * please implement here some B) specific handler coding

    * conversion of currency1Iuantity field failed caused by missing

    * unit relation

    * $oding sample:

    * provide currency- decimals- and reference type

    * value > cl#bsp#utility>"mae#string6

    * value > l#data"

  • 8/11/2019 Tree Control in WEB UI

    73/109

    * reference#value > c#currency

    * num#decimals > decimals

    * reference#type > reference#type

    * 7.

    '*+'75+75Dl_data> -';((!;7+5 '*+ 7/%-/+5*value

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54

    +5(8.

    endmethod.

    method$5_%7+$;_5get_property %7+$;_5

  • 8/11/2019 Tree Control in WEB UI

    74/109

    /dref /9+*5&*;+.

    value=

    0r'ategory6ierarchy!0r'ategory6ierarchyescr... not bound.%&'$ ()4'54

    (5;(+.

    +/.

    5(8.

    value= if_bsp_model_utilBconvert_to_string data_ref = dref

    attribute_path = attribute_path ". '75'6c#_bsp_conv_illegal_ref.

    /%-98)&*%9: Dl_data> type757.

    assigndref->S toDl_data>.

    * please implement here some B) specific handler coding

    * conversion of currency1Iuantity field failed caused by missing

    * unit relation

    * $oding sample:

    * provide currency- decimals- and reference type

    * value > cl#bsp#utility>"mae#string6

    * value > l#data"

    * reference#value > c#currency

    * num#decimals > decimals* reference#type > reference#type

    * 7.

    '*+'75+75Dl_data> -';((!;7+5 '*+ 7/%-/+5*value

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54

    +5(8.

    endmethod.

    method$5_)_6/(7('68_$;/.

    757: attr 580'*)5_6/(7('68_$;/.

    757: dref 580(5*data.

    $5((+'*attr /+5*dref.

    metadata ?= if_bsp_model_bindingBget_attribute_metadata attribute_ref = dref

    attribute_path = attribute_path

    name = 6/(7('68_$;/ %&'$ ()4'54

    * $)/=)('(4 >

    no_getter = 2".

    endmethod.

  • 8/11/2019 Tree Control in WEB UI

    75/109

    )56*map_key_to_id#_table.

    * maps the select nodes 6!" eys7 to 2 indices.

    * just before 2 display

    757lt_sel_id#_table 580intG_table.

    757ls_key 580string.

    %**075gt_selrow_key_table /+5*ls_key .

    (757&%me->node_tab A/568node_key = ls_key

    5(7+90*(5/+$+*/%9.

    /sy-subrc 1.

    700+sy-tabi# 5*lt_sel_id#_table . +/.

    +%**0.

    * if after loop lt#sel#idx#table is initial add initial value

    /lt_sel_id#_table /9/+/5/7%.

    700+-25*lt_sel_id#_table .

    +/.

    rt_selinde#_table = lt_sel_id#_table .

    +)56*.

    methodget_children.

    data:ls_node likelineofit_nodes,

    ls_node_entry typecrmt_bsp_treetable_node,

    lr_category typereftocl_crm_bol_entity,

    lr_prod_category typereftocl_crm_bol_entity,

    lv_category_guid typecomt_category_guid,

    lv_prodcat_guid typecomt_category_guid,

    lv_prod_guid typecomt_product_guid,

    ls_node_tab typecrmt_bsp_treetable_node,

    ls_products type lstruc_categ_prod,

    l_i_category_level typecomt_category_api_e#p_tab,

    l_s_category_level typecomt_category_api_e#p, l_v_siCe typeintG.

    * build hierarchy table

    clearme->gt_node_tab.

    * clear gt#children.

    loopatit_nodes intols_node.

    ls_node_entry-node_key = ls_node->node_key.

    ls_node_entry-icon = ls_node->get_icon ".

    ls_node_entry-tooltip = ls_node->get_icon_tooltip ".

    ls_node_entry-is_e#panded = ls_node->is_e#panded ".

    ls_node_entry-is_leaf = ls_node->is_leaf.

    appendls_node_entry tome->gt_node_tab.

    lr_category ?= get_bo ls_node->node_key ".

    checklr_category isbound.

    iflr_category->get_name " e4if_prcat_ap_bol_model=>gc_category_ob3.

    callmethodlr_category->get_property_as_value

    e#porting

    iv_attr_name = '75$*(8_$;/

    importing

    ev_result = lv_category_guid.

    insertlv_category_guid intotablegt_children.

  • 8/11/2019 Tree Control in WEB UI

    76/109

    elseif lr_category->get_name " e4if_prcat_ap_bol_model=>gc_product_ob3.

    callmethodlr_category->get_property_as_value

    e#porting

    iv_attr_name = 0(*;'5_$;/

    importing

    ev_result = lv_prod_guid.

    * get the corresponding category guid as well.

    readtablenode_tab intols_node_tab withkeynode_key = ls_node->node_key.

    lr_prod_category ?= get_bo ls_node_tab-parent_key ".

    callmethodlr_prod_category->get_property_as_value e#porting

    iv_attr_name = '75$*(8_$;/

    importing

    ev_result = lv_prodcat_guid.

    ls_products-category_guid = lv_prodcat_guid.

    ls_products-product_guid = lv_prod_guid.

    appendls_products togt_products.

    * read higher levels and chec whether the category guid id

    callfunction'*)_'75$*(8_(7_6/$6(%%9

    e#porting

    iv_category_guid = lv_prodcat_guid importing

    et_category = l_i_category_level

    e#ceptions

    others = 1.

    l_v_siCe = lines l_i_category_level " - 2.

    loopatl_i_category_level intol_s_category_level.

    if sy-tabi# = l_v_siCe .

    readtablel_i_category_level intol_s_category_level inde#l_v_siCe.

    appendl_s_category_level-category_guid to!glb!cl_lst_ppri_cucomain_impl=>gt_cat

    listed_guids.

    endif.

    readtablegt_children transportingnofields withtablekeytable_line = l_s_cate

    ry_level-category_guid.

    ifsy-subrc = 1.

    e#it.

    endif.

    endloop.

    endif.

    ifls_node->is_leaf = abap_false.

    * process subnodes add_children_nodes ls_node ".

    endif.

    endloop.

    endmethod.

    methodadd_children_nodes .

    data: lt_nodes typebsp_wd_tree_node_tab,

    lv_node typebsp_wd_tree_node_ref,

    ls_node_entry typecrmt_bsp_treetable_node.

  • 8/11/2019 Tree Control in WEB UI

    77/109

    field-symbols: Dnode_entry> typecrmt_bsp_treetable_node.

    data: lr_category typereftocl_crm_bol_entity,

    lr_prod_category typereftocl_crm_bol_entity.

    data:lv_category_guid typecomt_category_guid,

    lv_prodcat_guid typecomt_category_guid,

    lv_prod_guid typecomt_product_guid,

    ls_products type lstruc_categ_prod.

    rv_no_children = abap_false.

    lt_nodes = me->get_child_nodes iv_node ".

    loopatlt_nodes intolv_node.

    ls_node_entry-node_key = lv_node->node_key.

    ls_node_entry-parent_key = iv_node->node_key.

    ls_node_entry-icon = lv_node->get_icon ".

    ls_node_entry-tooltip = lv_node->get_icon_tooltip ".

    ls_node_entry-is_e#panded = lv_node->is_e#panded ".

    ls_node_entry-is_leaf = lv_node->is_leaf.

    lr_category ?= get_bo lv_node->node_key ".

    checklr_category isbound.

    iflr_category->get_name " e4if_prcat_ap_bol_model=>gc_category_ob3.

    callmethodlr_category->get_property_as_value e#porting

    iv_attr_name = '75$*(8_$;/

    importing

    ev_result = lv_category_guid.

    insertlv_category_guid intotablegt_children.

    elseif lr_category->get_name " e4if_prcat_ap_bol_model=>gc_product_ob3.

    callmethodlr_category->get_property_as_value

    e#porting

    iv_attr_name = 0(*;'5_$;/

    importing

    ev_result = lv_prod_guid.

    * get the corresponding category guid as well.

    lr_prod_category ?= get_bo iv_node->node_key ".

    callmethodlr_prod_category->get_property_as_value

    e#porting

    iv_attr_name = '75$*(8_$;/

    importing

    ev_result = lv_prodcat_guid.

    ls_products-category_guid = lv_prodcat_guid.

    ls_products-product_guid = lv_prod_guid.

    appendls_products togt_products.

    endif.

    appendls_node_entry tome->gt_node_tab assigningDnode_entry>.

    ifls_node_entry-is_leaf = abap_false.

    * process subnodes

    Dnode_entry>-is_leaf = add_children_nodes lv_node ".

    endif.

  • 8/11/2019 Tree Control in WEB UI

    78/109

    endloop.

    iflt_nodes isinitial.

    rv_no_children = abap_true.

    endif.

    endmethod.

    method$5_'6/%(+_+%.

    rt_children_node = me->get_child_nodes ir_tree_node ".

    endmethod.

    methodget_children_sku.

    data: lt_children_node typebsp_wd_tree_node_tab,

    lt_child_node typebsp_wd_tree_node_tab,

    lt_child_ref_buf typebsp_wd_tree_node_tab,

    l_s_children_ref likelineoflt_children_node,

    l_s_child_ref likelineoflt_children_node, l_o_model_ent typereftocl_crm_bol_entity, %&'$ (''D'D

    l_v_lines typei,

    l_v_line typeivalue2.

    lt_children_node = me->get_child_nodes ir_tree_node ".

    l_v_lines = lines lt_children_node ".

    whilel_v_lines isnotinitial.

    readtablelt_children_node intol_s_children_ref inde#l_v_line.

    ifl_s_children_ref isboundandl_s_children_ref->get_node_name " e4if_prcat_ap_bol_

    del=>gc_category_ob3.

    lt_child_node = me->get_child_nodes l_s_children_ref ".

    appendl_s_children_ref to rt_children_node.

    endif.

    loopatlt_child_node intol_s_child_ref .

    ifl_s_child_ref isboundandl_s_child_ref->get_node_name " e4if_prcat_ap_bol_mode

    >gc_category_ob3.

    append l_s_child_ref tolt_child_ref_buf.

    endif.

    endloop.

    clearlt_child_node.

    l_v_line = l_v_line U 2. l_v_lines = l_v_lines - 2.

    ifl_v_lines D 2.

    lt_children_node = lt_child_ref_buf .

    clearlt_child_ref_buf.

    checklt_children_node isnotinitial.

    l_v_lines = lines lt_children_node ".

    l_v_line = 2.

    endif.

    endwhile.

  • 8/11/2019 Tree Control in WEB UI

    79/109

    endmethod.

    )56*if_bsp_wd_tree_nodeBget_children.

    757: l_v_parent_guid 580comt_category_guid ,

    l_v_category_guid 580comt_category_guid,

    l_v_hit_string 580string,

    l_v_e#panded 580comt_boolean,

    l_v_e#panded_child 580comt_boolean.

  • 8/11/2019 Tree Control in WEB UI

    80/109

    757: l_o_coll 580(5*if_bol_bo_col,

    l_o_entity 580(5*cl_crm_bol_entity,

    l_o_child_typed 580(5*!glb!cl_lst_itemnotlisted_cn1E,

    l_o_bo 580(5*if_bol_bo_property_access,

    l_o_bo_child 580(5*if_bol_bo_property_access,

    l_o_core 580(5*cl_crm_bol_core ,

    l_o_coll_child 580(5*if_bol_bo_col,

    l_o_coll_children 580(5*if_bol_bo_col,

    l_o_coll_childrens 580(5*if_bol_bo_col,

    l_o_cuco typerefto!glb!cl_lst_ppri_cucomain_impl, l_v_sales_org typecrmt_sales_org,

    l_o_lsthdr typereftocl_crm_bol_entity,

    l_v_leaf typecrmt_boolean.

    5(8.

    '7%%)56*me->bo->get_property_as_value

    category_guid

    /)0*(5/+$

    ev_result = l_v_parent_guid.

    * $A++ /'4)D me!"3#()D'#+'A;* '5=)R4(G

    * #8#$A4'G)RH#G2D > l#v#parent#guid

    * /=)R4(G

    * '#8#+'A; > l#v#leaf

    * .

    * l#o#cuco > 1glb1cl#lst#itemnotlisted#impl>"gr#cuco.

    * l#o#lsthdr J> l#o#cuco!"typed#context!"lsthdr!"collection#wrapper!"get#current6

    .

    * try.

    * l#o#lsthdr!"get#property#as#value6 exporting

    * iv#attr#name > 1glb1cl#cgtgd#list#constants>"sales#org

    * importing

    * ev#result > l#v#sales#org 7.

    * catch cx#crm#cic#parameter#error.

    * endtry.

    *

    * if l#v#leaf eI abap#true or l#v#sales#org is initial.

    *

    *********************(estle 3pecific $oding******************

    /!glb!cl_cgtgd_cat_smart_search=>check_auth_for_smart_search " abap_true. /!glb!cl_lst_ppri_cucomain_impl=>gv_smart_search abap_true.

    757: lr_smart_search 580(5*!glb!cl_cgtgd_cat_smart_search.

    lr_smart_search = !glb!cl_cgtgd_cat_smart_search=>get_instance ".

    '7%%)56*lr_smart_search->get_children_for_guid

  • 8/11/2019 Tree Control in WEB UI

    81/109

    ** Get the instance of bol core services

    *

    l_o_bo = l_o_coll->get_first ".

    A6/%l_o_bo /9&*;+.

    * get the info from the bo:

    '7%%)56*l_o_bo->get_property_as_value

    category_guid /)0*(5/+$

    ev_result = l_v_category_guid.

    '7%%)56*l_o_bo->get_property_as_string

    hit

    ('//+$

    rv_result = l_v_hit_string.

    l_o_core = cl_crm_bol_core=>get_instance ".* create a category object from the guid.

    l_o_entity = l_o_core->get_root_entity

    iv_ob3ect_name = if_prcat_ap_bol_model=>gc_category_ob3

    iv_ob3ect_guid = l_v_category_guid ".

    '7%%)56*me->/9_+*_%7

  • 8/11/2019 Tree Control in WEB UI

    82/109

    /!glb!cl_cgtgd_cat_smart_search=>check_auth_for_smart_search " abap_true

    /!glb!cl_lst_ppri_cucomain_impl=>gv_smart_search abap_true.

    lr_smart_search = !glb!cl_cgtgd_cat_smart_search=>get_instance ".

    '7%%)56*lr_smart_search->get_children_for_guid

    siCe " > 1.%A(D l#v#expand

    d#$+D 'K if_bsp_wd_tree_nodeBe#pand_node ".

    %9.

    l_o_child_typed->if_bsp_wd_tree_nodeBcollaps_node ".

    /l_o_coll_child /9+*5&*;+.

    '7%%)56*l_o_child_typed->set_node_is_leaf

    set_search_result

    get_ne#t ".

    +A6/%.* endif.

    '75'6c#_sy_move_cast_error c#_sy_ref_is_initial

    c#_crm_genil_model_error c#_crm_cic_parameter_error .

    +5(8.

    +)56*.

  • 8/11/2019 Tree Control in WEB UI

    83/109

  • 8/11/2019 Tree Control in WEB UI

    84/109

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54

    +5(8.

    endmethod.

    method$5_'75$*(8_5get_property '75$*(8_5

  • 8/11/2019 Tree Control in WEB UI

    85/109

    * value > l#data"

    * reference#value > c#currency

    * num#decimals > decimals

    * reference#type > reference#type

    * 7.

    '*+'75+75Dl_data> -';((!;7+5 '*+ 7/%-/+5*value

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54 +5(8.

    endmethod.

    method$5_/_'75$*(8_/.

    757: current 580(5*if_bol_bo_property_access.

    rv_disabled = 5(;.

    current = bo. 5(8.

    /current->is_property_readonly

    '75$*(8_/" = abap_false. %&'$ ()4'54

    rv_disabled = 7%9.

    +/.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    endmethod.

    method$5_/_'75$*(8_5is_property_readonly

    '75$*(8_5

  • 8/11/2019 Tree Control in WEB UI

    86/109

    method$5_)_'75$*(8_/.

    757: attr 580'*)5_'75$*(8_/.

    757: dref 580(5*data.

    $5((+'*attr /+5*dref.

    metadata ?= if_bsp_model_bindingBget_attribute_metadata

    attribute_ref = dref

    attribute_path = attribute_path

    name = '75$*(8_/ %&'$ ()4'54

    * $)/=)('(4 >

    no_getter = 2".

    endmethod.

    method$5_)_'75$*(8_5

  • 8/11/2019 Tree Control in WEB UI

    87/109

    dref = current->get_property 6/(7('68_/". %&'$ ()4'54

    '75'6c#_crm_cic_parameter_error.

    +5(8.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    /dref /9+*5&*;+.

    value= . %&'$ ()4'54

    (5;(+.

    +/.

    5(8.

    value= if_bsp_model_utilBconvert_to_string data_ref = dref

    attribute_path = attribute_path ".

    '75'6c#_bsp_conv_illegal_ref.

    /%-98)&*%9: Dl_data> type757.

    assigndref->S toDl_data>.

    * please implement here some B) specific handler coding* conversion of currency1Iuantity field failed caused by missing

    * unit relation

    * $oding sample:

    * provide currency- decimals- and reference type

    * value > cl#bsp#utility>"mae#string6

    * value > l#data"

    * reference#value > c#currency

    * num#decimals > decimals

    * reference#type > reference#type

    * 7.

    '*+'75+75Dl_data> -';((!;7+5 '*+ 7/%-/+5*value

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54

    +5(8.

    endmethod.

    method$5_)_6/(7('68_/.

    757: attr 580comt_hierarchy_id.

    757: dref 580(5*data.

    $5((+'*attr /+5*dref.

    metadata ?= if_bsp_model_bindingBget_attribute_metadata

    attribute_ref = dref

    attribute_path = attribute_path

    name = 6/(7('68_/ %&'$ ()4'54

    * $)/=)('(4 >

  • 8/11/2019 Tree Control in WEB UI

    88/109

    no_getter = 2".

    endmethod.

    method$5_/_6/(7('68_/.

    757: current 580(5*if_bol_bo_property_access.

    rv_disabled = 5(;.

    current = bo.

    5(8.

    /current->is_property_readonly

    6/(7('68_/" = abap_false. %&'$ ()4'54

    rv_disabled = 7%9.

    +/.

    '75'6c#_sy_ref_is_initial c#_sy_move_cast_error

    c#_crm_genil_model_error.

    (5;(+.

    +5(8.

    endmethod.

    method$5_6/(7('68_5get_related_entities

    iv_relation_name = if_prcat_ap_bol_model=>gc_hierarchy_descr_rel ".%&'$

    * +ogic for displaying the hierarchy description in the current language current = coll->get_first ".

    A6/%current /9&*;+.

    current->get_property_as_value

  • 8/11/2019 Tree Control in WEB UI

    89/109

    +/.

    current = coll->get_ne#t ".

    +A6/%.

    /current /9+*5&*;+.

    5(8.

    dref = entity->get_property 6/(7('68_/". %&'$ ()4'54

    '75'6c#_crm_cic_parameter_error.

    +5(8. %9.

    5(8.

    dref = current->get_property 6/(7('68_5 580data.

    799/$+dref->S 5*Dl_data>.

    * please implement here some B) specific handler coding

    * conversion of currency1Iuantity field failed caused by missing

    * unit relation

    * $oding sample:

    * provide currency- decimals- and reference type

    * value > cl#bsp#utility>"mae#string6

    * value > l#data"

    * reference#value > c#currency

    * num#decimals > decimals

    * reference#type > reference#type* 7.

    '*+'75+75Dl_data> -';((!;7+5 '*+ 7/%-/+5*value

    907(75&8space. %&'$ ()4'54

    '75'6c#_root.

    value= -'*+(9/*+ 7/%-. %&'$ ()4'54

    +5(8.

    endmethod.

  • 8/11/2019 Tree Control in WEB UI

    90/109

    method$5_/_6/(7('68_5get_related_entities

    iv_relation_name = 0r'ategory6ierarchyescr(el".%&'$

    current = coll->get_current ".

    /current /9+*5&*;+.

    (5;(+.

    +/.

    /current->is_property_readonly

    6/(7('68_5

  • 8/11/2019 Tree Control in WEB UI

    91/109

    method$5_97('6_(9;%5.

    value= abap_false.

    endmethod.

    method$5_0_97('6_(9;%5.

    '79iv_property.

    A6+if_bsp_wd_model_setter_getter=>fp_fieldtype.

    rv_value = cl_bsp_dlc_view_desc