on 09-07-2006 12:38 PM
Hello all,
does anybody know how to call a method in view B from view A?
Thank you for your answers!
Kind regards, Patrick.
Hi,
View is a separate Entity/Object( ie Private One).We cant access the Data/method Directly From One View to another View.So u can Declare the Method In a COMPONENT/CUSTOM contolor and Tranfer The data (it May b an Input Field Data )to That Corresponding Controller From Thr Only u can access the Method By,
wdcontext.GetComponentController.methodCall(Parameters if required);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vijith,
I already solved the problem. To commit the code in view B, view B has to be visible at all...
Nice weekend, Patrick.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karthikeyan!
This might be possible, but that is not, what I want to have. The logic should be placed in view B and not in the help controller...
Kind regards, Patrick.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pravesh!
I just did what you had suggested. Create Method in View A, which is calling a method in a help controller. The help controller fires an event, which should call an event handler method in view B.
And that's the problem. I have found out, that the method in the help controller is called, but the event handler method in view B isn't!
Does anybody know what the problem might be? I already registered the help controller to view A and B!
Thank you, Patrick.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Patrick,
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
}
Also look to this link for further clarification.
<a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/a137c339-0b01-0010-a688-a87b88706845">How to Navigate Inside Web Dynpro Component Interface Views</a>
I hope this will help you to solve your problem.
Regards
Pravesh
Ps: Please consider rewarding points if helpful and solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.