Skip to Content
Technical Articles

How to synchronize single value between different components

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( ):

  1. ” define implementation class of component, which we want to link
  2. sync_win TYPE REF TO %comp_class_impl%.
  3. usage_ref TYPE REF TO cl_bsp_wd_component_usage.
  4. CASE iv_usage->usage_name.
  5.         ” define synchronization only for specific usage
  6.         WHEN ‘%name%’.
  7.                 usage_ref ?= iv_usage.
  8.                 ” define MainWindow of component, which we want to link
  9.                 sync_win ?= usage_ref=>get_interface_view_contr( ‘%COMP_NAME/Window_Name%’ ).
  10. ” link specific attribute of current class to specific attribute of desired component class
  11. 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.

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