Skip to Content

Model Node Tree view change & save

Making user activities (Changing and saving data record) from Model node Tree view

Note: It covers replacing table view with Tree view as well…

I am proceeding with this blog to make Relationships (Bol entity BuilRelationship) tree view actions for a business partner (BuilHeader)…  Business partner can have different Business partners with same Relationship type. I am taking standard BSP component BP_DATA and View AccountRelationshipsOV. This standard view (AccountRelationshipsOV) gives table view which I am going to replace with tree view.

See tree view output as below which I am going to create and making activities change & save in this blog.

Step 1) Create Model entity (BuilRelationship) from wizard in view AccountRelationshipsOV to form tree view.

Step 2) Change context class of created model entity class to tree view class.

Note: Base entity will be disappeared (Please see below screen shot after changing class)

Step 3) Change configuration to replace table view with tree view in html page.

Step 4) Create proxy class to be used in refresh method with super standard class of CL_BSP_WD_TREE_NODE_PROXY and redefine IF_BSP_WD_TREE_NODE~GET_CHILDREN to write Childs custom logic.

Step 5) Redefine refresh method and write code to form parent nodes as below. Loop through collection and call Proxy class. 

Pass  entity and proxy class to lr_root. Share collection data to Proxy class as well.

Step 6) Write below custom code IF_BSP_WD_TREE_NODE~GET_CHILDREN to form child records.

I am done with above 6 steps to change table view to tree view. Step 8 onwards  explains  Tree view change & save activities.

Step 7) Create buttons (EDIT & SAVE) in do_prepare_output method of tree view .

Step 8) Edit event:  Please write below code in edit handler method of edit button. Lock root entity & put view group context in edit mode.

Step 9) Save event: Write below code in save event handler method to save changed entities in tree view. Saving based on core transaction.

Step 10) Create Expand and Collapse events of tree view .

Step 11) Tree view output.

Step 12) let us put tree view by clicking edit button.

Step 13) Change dates in tree view and save with save button.

Click Save

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Rishi verma

    HI Mani ,

    Nice blog , but i am facing  issue while doing changes for SuperClass  of newly created context node “TREERELATION”  ( model : “BuilRelationShip” )  to :

    CL_BSP_WD_CONTEXT_NODE_TREE  then i am getting below exception .

      =============

    Class ZL_BP_DATA_ACCOUNTRELATIO_CN01,Public Section

    Unless all abstract methods (for example, GET_TABLE_LINE_SAMPLE) are

    redefined in a class derived from an abstract class, you must also

    define class (ZL_BP_DATA_ACCOUNTRELATIO_CN01) as abstract. –

    =============

    2nd issue am facing with HTM code for tree view : This code screen shot is incomplete can you please add the correct code

    like you have add in screen shot :

    <chtml:configTree id  = “TREERELATION”

           nodeTable      = “<%= TREERELATION->node_tab %>”

           OnCollapseNode = “COLLAPSE”

           onExpandNode =  “EXPAND”

           onRowSelection = “select”

           SelctionNode = “NONE”

           ajaxDeltaHandling =  “TRUE”

           SelectedRowIndex = “<%= TREERELATION->SELECTED_INDEX %>”

           type = “COLUMN”

           usage = “EDITLIST”

           table = “<//TREERELATION/Table”

           nodeTextColumnDescription =  “<%otr(CRM_IC_APPL_CH_HIST/EXPAND_TREE) %>”

           allRowEditable = “TRUE”

           noFrame = “X”

           visibleFirstRow = “<% TREERELATION->visible_first_row_index %>”

           actions = “<%= controller->gt_button%>”

           actionMaxInRow = “8”

           personalizable = “TRUE”

    displayMode = “<%= controller->view_group_context->is_view_in_display_mode(controller)” ??????

           downloadToExcel = “TRUE”

           selectedRowIndexTable = “<%= TREERELATION->SELECTION_TAB %>” .

    (0) 

Leave a Reply