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.