Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Abhinav_Sharma
Contributor
0 Kudos

Welcome to my first blog and here I am going to tell you a trick. Sometimes, there are multiple WD components reusing each other and share a common assistance class. Each component requires a separate instance of assistance class, however, some common data also we want to share between these WD components.

Now, there are few other ways using which we can achieve the same:

  1. We can share the assistance class object in the used component, by sharing the same assistance class object at runtime. For more detail, you can refer link
  2. We can do external mapping between the using and used component using Component Interface Controller.
  3. The third way that I am going to explain is a bit different and it is based on the OOPS ABAP concept and without runtime code and external mapping.

Consider that we have two WD components, ZWD_MAIN and ZWD_USED.

Both the components are using the same assistance class ZCL_WD_ASSIST.

What we know is that each WD component will have its own instance of assistance class. Each object will be different and have different instance of the ZCUSTOMERS. So how can we make sure that both the object points to same attribute? I think you have guessed it :wink:

If not, here is the magic trick, if we want to share the ZCUSTOMERS list between two WD components, then just by changing the attribute ZCUSTOMERS from Instance Attribute to Static Attribute, all the assistance class object can share the ZCUSTOMERS data. Isn’t it very simple :smile: .

Comments and suggestions are welcome.

Labels in this area