cancel
Showing results for 
Search instead for 
Did you mean: 

calling method of other DC

Former Member
0 Kudos

Hi,

I have two DCs: DC1 and DC2.

DC2 has one Java Class file with two methods (contructor and a custom method) defined in it.

I want to access these methods in DC1. How can I access these methods? I saw one weblog which helps in creating and reusing the Development components, I tried doing the same things but I am not able to access the methods of DC2 in DC1.

Please help.

Thanks.

Puneet

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Puneet,

2.While creating the public part select "WebDynproComponent" and check the complete path of the component below.

This is how you are going to expose your component .

4. In DC2, select "usedWebDynpro components"..Right Click and add DC1.

Now Select view, open properties tab and the DC1 inteface controller in the view requiredControllers.

Regards, Anilkumar

Former Member
0 Kudos

Hi there,

How do I access the public method when I have finished the steps above?

I can see the interface controller in the consumer component controller:

wdThis.wdThis.wdGetMYAppComponentUsage().getInterfaceController().

...but what do I do to actually access my public method called getEmployeeData? Do you guys have an example?

Best regards, Peter

Former Member
0 Kudos

Hi Puneet,

After creating the public part ,please build the DC once.

Then In the DC project you can see gen/... structure.

Regards, Anilkumar

Former Member
0 Kudos

Hi Anil,

Thanks a ton. It works now...I was building the project, and not the DC.

Thanks for all the help.

Regards,

Puneet

Former Member
0 Kudos

Hi Punnet,

1. First place the method you want to expose in DC1 interface controller.

2. Expose the interface controller as public part in DC1.

3. Add the public part of Dc1 to Dc2.

4. Now add the InterfaceComponentController of DC1 in DC2 .

5. Now you should be able to access to methods in Dc1 interface controller.

Regards, Anilkumar

Former Member
0 Kudos

Hi Anil,

I was following up on the following thread:

(My request is similar to this)

It says after declaring the public part, the exposed class should appear in :Gen/default/public/<PublicpartName>/lib/java/<Publicpart.jar>

But when I check the same in the devlopment configuration perspective, I dont see any such folder. All i can see is : Gen/default/deploy....

Any idea why the public part is not appearing in this folder strcuture.

Thanks.

Puneet

Former Member
0 Kudos

Hi Anil,

Prevous problem was solved.

Now I have come to the issue when I want to share methods exposed in interface controller of other DC. Can you briefly describe how to do the following:

1. First place the method you want to expose in DC1 interface controller. "DONE"

2. Expose the interface controller as public part in DC1. "HOW?? I exposed the whole java package. Is there something else I need to do?"

3. Add the public part of Dc1 to Dc2. "DONE"

4. Now add the InterfaceComponentController of DC1 in DC2 . "HOW??"

5. Now you should be able to access to methods in Dc1 interface controller.

Thanks.

Regards,

Puneet.

guru_subramanianb
Active Contributor
0 Kudos

Hi Puneet,

Jus a suggestion.Since you have said tht you have exposed as public part, try to get some output by having system.out in the method which is decleared as public.By this way you can make sure that you are calling the DC2 method from DC1.

In addition refer these links incase if you miss something.It has answer to ur query

http://help.sap.com/saphelp_nw04/helpdata/en/02/6755bd296ade42931646f869b1fd15/content.htm

Hope it helps.

Regards,

Guru

Former Member
0 Kudos

After exposing the public parts in DC2, in DC1 you have to create the usage dependency. That means from DC1 you have add DC2 as used component. Then only you can access the methods of DC2.

For accessing any DC requires this two steps

1. Expose the public part in the service provider DC

2. From the consumer DC create the Usage Dependency with the provider DC.

Hope it helps!!!

Shubhadip

Former Member
0 Kudos

Hi,

I refered to the pdf document (WD component reuse) for this development.

I have a java file (TableSort.java) in DC2. I have a method (constructor TableSort(param1,param2)) which I need to call in the view implementation of DC1.

I have exposed the entities (java class and java package)of DC2. I have also made DC2 as a used DC in DC1. I have added it in the WD references in DC1 as "com.sap/TableSort"

Now when I write this code in view implementation in DC1, it shows an error (Cannot resolve TableSort):

TableSort.TableSort(abc,def);

Can you help me with correct calling of the method? I think there is some issue with referencing the DC2 in DC1.

Thanks.

Regards

Puneet.

Former Member
0 Kudos

Hi Puneet,

Expose that java class as public part and then try.

Regards,

Santhosh.C

Former Member
0 Kudos

Hi Santhosh,

I have already exposed the Java class and the Java Package.

No success

Regards,

Puneet

Former Member
0 Kudos

Hi Puneet,

Check this link for creating DC,public parts etc.

http://help.sap.com/saphelp_nw04/helpdata/en/34/6b63c1a7ba6845b85239999b7061bc/content.htm

Regards,

RK