Quantcast
Channel: Web Dynpro ABAP
Viewing all articles
Browse latest Browse all 141

Data sharing between multiple WD component using same assistance class

$
0
0

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.

ZWD_MAIN.png

ZWD_USED.png

Both the components are using the same assistance class ZCL_WD_ASSIST.

ZASSIST1.png

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

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.

 

ZASSIST2.png

Comments and suggestions are welcome.


Viewing all articles
Browse latest Browse all 141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>