Concepts of BOL programming : Get_current
Get_current and get_iterator how does it works?
The data you enter on the Web UI gets saved in the
database tables via BOL Entities or Objects. These BOL Entities are kind of
class instances with underlying structures(mapped to the database tables).
These BOL entities are held by Collection Wrappers. They are kind of containers or wrapper classes in the context nodes.
For example, in a form view the data gets stored in 1 BOL entity and in turn held by a Collecton Wrapper whereas in a table view the data is 1:N, there can be N BOL entities (all with same structure) corresponding to each row of the table view and held by a Collection Wrapper.
The BOL entities will be of type CL_CRM_BOL_ENTITY.
So when you want to access data from a view, you write this way...
If you are in a method of IMPL Class.... ( if you are at the context node methods
These BOL entities are held by Collection Wrappers. They are kind of containers or wrapper classes in the context nodes.
For example, in a form view the data gets stored in 1 BOL entity and in turn held by a Collecton Wrapper whereas in a table view the data is 1:N, there can be N BOL entities (all with same structure) corresponding to each row of the table view and held by a Collection Wrapper.
The BOL entities will be of type CL_CRM_BOL_ENTITY.
So when you want to access data from a view, you write this way...
If you are in a method of IMPL Class.... ( if you are at the context node methods
Context Node name -> Collection
Wrapper -> get_current( ).
)
View Controller -> Context ->
Context Node name -> Collection Wrapper -> get_current( ).
get_current gives the BOL entity underlying the view. You can alternatively use get_first( ) as in a Form view there is 1 BOL entity only.
If you are in table view then,get_current gives the current entity. If you want the next row then get_next ( ) or you can loop at the collection_wrapper and get the corresponding row using index.
If you want to delete certain rows in the table view then you can delete by looping at the collection but there is a danger of missing the index(as happens when ypu delete entries while looping on an internal table).
So you use the table view iterator to do this as it searches on the index or BOL entity totally.
Explore the methods of classes CL_CRM_BOL_ENTITY and IF_BOL_BO_COL. Do a where used and observe what they are doing.
The best thing about CRM Web Client UI is that the code written across components is almost uniform.
You open any of the methods the code will be similar. So if you master one component, everything is almost same.
Post a Comment