Sometimes we need to supply a single value synchronization of specific parameter between different separated components of CRM. Of course, there is a way to implement such task via binding, but if we are talking about synchronization of only one single value, this way may be too complicated. Here is an approach to do that much more easily.
Implementation in
WD_USAGE_INITIALIZE( ):
- " define implementation class of component, which we want to link
- sync_win TYPE REF TO %comp_class_impl%.
- usage_ref TYPE REF TO cl_bsp_wd_component_usage.
- CASE iv_usage->usage_name.
- " define synchronization only for specific usage
- WHEN '%name%'.
- usage_ref ?= iv_usage.
- " define MainWindow of component, which we want to link
- sync_win ?= usage_ref=>get_interface_view_contr( '%COMP_NAME/Window_Name%' ).
- " link specific attribute of current class to specific attribute of desired component class
- GET REFERENCE OF me->flag INTO sync_win->flag.
I suggest to use this approach very carefully, because active use of such technique may lead to some side effects, e.g., spaghetti code, where it's very difficult to understand what, when, and where is connected with external components.