cancel
Showing results for 
Search instead for 
Did you mean: 

Fire plug on another window

Former Member
0 Kudos

Hi All,

I need to use a popup window that has a startup plug that must be initialized. The window contains a view that is referenced from another DC (That means that the only way to communicate with it is via plugs).

I know how to do the popup, but I don't know how to call its startup plug directly from the code.

The final scenario should be as follows:

1) The initial view has a button

2) When pressing the button the referenced view is displayed as a modal popup (I need to pass parameters to this view).

3) In the popup there is also a button that when clicked sends the selected information and closes.

4) The selected information is displayed on the initial view.

Thanks,

Aviad

Accepted Solutions (0)

Answers (2)

Answers (2)

arun_srinivasan
Contributor
0 Kudos

hi

>Create a value attribute for parameter in intial view,popupview and comp controller and similarly create a value Attribute for "Selected information".

>Add the usage of comp ctrl in both views properties

>Map the Both Attribute from intial view to CC and then from CC to popup view

>In the Intial view

buttonaction()

{

//Modelwindow calling steps

wdContext.currentContextElement().Set<VA>(Parameter);//Set the Parameter that you need to pass

}

>In the Popupview

closeaction()

{

//closing the window code

String information=wdContext.currentContextElement().Get<Selected Information>();

wdContext.currentContextElement().Set<VA>(inforamtion);

}

hope this helps,

Regards,

Arun

pravesh_verma
Active Contributor
0 Kudos

Hi Aviad,

For creating and getting the values from one window to other you can use the Events. Follow these steps:

1) Go to the Component controller. Create a new <i>EVENT</i> there, say <b>setValue</b> and a Method say <b>setFinalValue().</b>

2) Create a attribute of type string in controller context, say <b>text</b>.

3) In the 1st window from which you want to pass the value, create a METHOD, say <b>SettingValue();</b>

4) In this method (ie:<i>SettingValue()</i> ), write a code to set the value of text and call the event of the controller.

To the the value of text:

wdThis.wdGet<Controller_Name>().wdGetContext().currentContextElement().setText("Any Value");

To call the event:

wdThis.wdGet<Controller_Name>().setFinalValue();

5) In the controller code write this code in the setFinalValue method.


public void setFinalValue( )  {
    //@@begin setFinalValue()
  	wdThis.wdFireEventSetValue();
    //@@end
  }

6) In the next window where you want to access this value create a Event Handler in the View of it.

<i>Methods-> New - >Event Handler-> Next -> Give name (say <b>setTextForCell</b>). Select the Event Source (ie: <i>Name of the controller</i>) and set the subscribed Event (ie: <b>setValue</b>).</i>

7) In the implementation write this code to get the set value

public void setTextForCell(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin setTextForCell(ServerEvent)
  	String text = wdThis.wdGet<Controller_Name>().wdGetContext().currentContextElement().getText();

	.....

	Use this value anywhere you want

	.....
    //@@end
  }

I hope this will solve your problem.

Regards

Pravesh

Ps: Please consider rewarding points if helpful and solved.

Former Member
0 Kudos

Hi,

I guess my question was not clear enough.

The referenced view is embedded from a <b>different DC</b>(its interfaceviews are in the public part of that DC) so the only means (I know of) for passing/getting parameters is from its plugs.

I can't access its code sections from the main project, but I can get its interfaceview controller from my main project. Not to fire the plugs, just the get info about the view.

This DC will be used by many other DCs as well, so any solution must be soft-coded.

Many Thanks,

Aviad

Former Member
0 Kudos

Aviad,

Refer <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/a137c339-0b01-0010-a688-a87b88706845">Cross component navigation, Explained</a> by Bertram for a thorough explanation.

Bala