If you have done any programming with SAP Tree controls, you know that there is some rather complex code that goes into using them. However if you are on a 4.6C platform, there is a simpler solution: SAP Tree Model. Tree Model is a class that sits on top of the Enjoy Tree Controls and provides additional functionality that you would otherwise have to program yourself.
The Tree Model controls, like the Tree controls, are broken into three main classes for the three different types: CL_SIMPLE_TREE_MODEL CL_LIST_TREE_MODEL CL_COLUMN_TREE_MODEL. The advantage to using the tree model is that SAP has programmed much of the application layer of working with Trees for you. First the Tree model maintains a copy of all the node and item data for you at the application level. There are methods that you can call to read this data later and to check for duplicate node keys before inserting them into your tree. This eliminates the need for you to maintain this information in your own program. The Tree model also checks all the node keys before they are passed to the frontend contols. This eliminates the Automation errors and short dumps that are caused by duplicate keys in the tree control. The Tree model controls all the interaction with the frontend control. It buffers the data and allows you to easily control when data is sent to the frontend. It also has highly optimized flush synchronization. Finally it adds much needed methods such as Search and Print to
the Tree Control. Although greatly simplified over the tree control, Tree model still takes some practice to learn. SAP has some example programs that should help you. SAPSIMPLE_TREE_MODEL_DEMO SAPTLIST_TREE_MODEL_DEMO SAPCOLUMN_TREE_MODEL_DEMO SAPSIMPLE_TREEM_DRAG_DROP_DEMO SAPSIMPLE_TREEM_DRAGDROP_DEMO2
This was first published in May 2001