cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a method global so that it can be used in another component.?

Former Member
0 Kudos

Hi,

Is it possible to make a method global so that it can be used in another component.?

i.e I have one component C1 and methods declared in this component M1, M2, ...

Now I have another component C2 and in this component i want to use method M1 of component C1.

how to do so?

Any inputs will be appreciated.

Thanx.

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Pankaj,

This method should have been declared at the component controller level & you will have to go to the methods tab & check the "Interface" checkbox against this method so that this method becomes available to other components. Below lines are taken from the SAP documentation, "Attributes, methods, context elements, and events can be marked as interface elements. These elements are then exposed to other components by means of the interface controller."

Regards,

Uday

Former Member
0 Kudos

Hi,

As Uday said, To make the method as global of component say C1, You have to make method as interface by clicking the check box.

Now while using the method in other component say C2, you have to follow following steps:

1. In used component of comp. C2, add component C1.

2. Instantiate the component atleast once in any of the method of component using code wizard option:

'Instantiate Used Componet'.

3. Now you can call the method of component C1 using code wizard option 'Method call in used controller'

Answers (0)