Skip to Content
Author's profile photo Former Member

Integrate one WDJ component to another in NetWeaver 7.3

Summary

This documnet includes demonstration of how to integrate two Web DynPro Java components and call other DC’s method.

This way we can create a development component for common functionality and call it in multiple DCs.

Introduction

In DC integration we use component from different DC and call its methods, we can use its contexts and get the value of context in other DC. By integrating DC , we can truly implement the reusability of components in projects. For common functionalities/Screens that needs to be called in multiple applications, we can use DC integration.

Creating a Web Dynpro application

We need two Wed DynPro components.

Create a new Web Dynpro DC named firstdc with the component named FirstDcComp and the application named FirstDcApp. Let the window be named FirsctDcWin and its view FirstDcView.

/wp-content/uploads/2014/04/1_428835.png

Create another Web Dynpro DC named seconddc with the component named SecondDcComp and the application named SecondDcApp. Let the window be named SecondDcWin and its view SecondDcView.

/wp-content/uploads/2014/04/2_428850.png

In SecondDc:

Create a method in component controller

/wp-content/uploads/2014/04/3_428853.png

In the method of component controller write some code: (Here i am printing text)

/wp-content/uploads/2014/04/4_428854.png

Copy the method of component controller and paste in interface controller. By doing this step we expose method so that other dc can call it.

Similar way, we can expose context of componet as well so that they can be refered in other component

/wp-content/uploads/2014/04/5_428866.png

/wp-content/uploads/2014/04/6_428882.png

Go to component properties of second dc -> public Parts tab

/wp-content/uploads/2014/04/8_428884.png

Add public part

/wp-content/uploads/2014/04/9_428894.png

Give proper name to the public part and click on Finish.

Right click on public part and select manage entities to add seconDcComp Component in public part.

/wp-content/uploads/2014/04/10_428895.png

You will get the following screen. Select component to be exposed.

/wp-content/uploads/2014/04/11_428896.png

And Finish.

Go to component properties of firstdc

/wp-content/uploads/2014/04/12_428903.png

Add dependency of seconddc

/wp-content/uploads/2014/04/13_428904.png

Click finish.

Right click on Used component and add secondDcComp

/wp-content/uploads/2014/04/14_428905.png

/wp-content/uploads/2014/04/15_428918.png

Give name to component to be used and Finish

/wp-content/uploads/2014/04/16_428919.png

We create a button and its event on FirstDcView

/wp-content/uploads/2014/04/7_428883.png

Go to firstDcWindow and embed interface view of secondDc so that u can call seconDcView and event of secondDc

/wp-content/uploads/2014/04/17_428920.png

/wp-content/uploads/2014/04/18_428924.png

/wp-content/uploads/2014/04/19_428925.png

/wp-content/uploads/2014/04/20_428931.png

In firstDc,

On button event we call method of secondComp

To call method from secondComp ointerface controller we need to add reference of it in the view

/wp-content/uploads/2014/04/24_428938.png

/wp-content/uploads/2014/04/21_428932.png

After building and deploying application, we run the firstDcApp application

/wp-content/uploads/2014/04/22_428936.png

on click of button, method from secondDcComp will be called as per the code. And we have printed test in the method m_callOk()

So, we get the result as

/wp-content/uploads/2014/04/23_428937.png

Conclusion

Using this method we can create reusble componments for common processes. One DC can be used multiple times in different DCs this will reduce the development efforts.

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Bhagyashree,

      This document you shared is very helpful, using that we can reuse code. 🙂

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Pralhad. 🙂

      Author's profile photo Former Member
      Former Member

      document is very helpful. 🙂

      Author's profile photo govardan raj
      govardan raj

      hi Bhagayashree ,

      while adding the dependency ,when you just click finish , the deploy time, run Time dependecy as well as build time dependency will be added ,

      do we need all those dependencies ?

      in 7.01 version , we just givce build time dependency , we never give deploy time ,runtime etc ..

      Regards

      Govardan

      Author's profile photo Farag Elfadaly
      Farag Elfadaly

      Hi Bhagyashree,

      Thanks for this helpful post.

      I have a problem when adding secondDc as used component to firstDc, it did not appear in the list although I have added secondDc in the dependencies of firstDc.

      Author's profile photo govardan raj
      govardan raj

      hi farag elfadly,

      Build your second dc as well as first dc , and in the second dc ->right click->Development Component ->show in -> component properties

      here Select Permissions Tab  and check the entityforwarding allowed. again build the dc.

      hope this should solve your problem

      Regards

      Govardan

      Author's profile photo Guru Raj
      Guru Raj

      hi farag elfadly,


      i Guess u missed Manage Entity Step where we add Component to Public part

      >>Check this step in above document.manageEntity.PNG

      Regards,

      Guru Raj

      Author's profile photo Farag Elfadaly
      Farag Elfadaly

      It is ok now, when I built the two components from Development infrastructure perspective.