on 06-28-2007 9:08 PM
Hi Experts,
I have to pass value of certain parameters from view to component controller. My problem is like this. I have created two buttons on the view. When the user will press one button, one set of value should be passed to component controller and then to R/3. When the user selects other button other set of values should pass from view to component controller and then to R/3.
The code looks like as below:
public void onActionButton(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionButton(ServerEvent)
Date dt = new Date(System.currentTimeMillis());
bp.setInputdate(dt);
wdThis.wdGetTimesheetCompController().executeZbapi_Cat_Stech00_Getdetail_Input();
//@@end
}
public void onActionNextWeek(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionNextWeek(ServerEvent)
Date dt1 = new Date(System.currentTimeMillis());
long dateMillis = dt1.getTime();
long dayInMillis = 1000 * 60 * 60 247;
dateMillis = dateMillis + dayInMillis;
dt1.setTime(dateMillis);
bp.setInputdate(dt1);
wdThis.wdGetTimesheetCompController().executeZbapi_Cat_Stech00_Getdetail_Input();
//@@end
}
When I am doing this values are NOT getting passed from view to component controller. Can you please let me know what is going wrong here?
Regards,
Brian
Hi
try this
Date dt = new Date(System.currentTimeMillis());
Zbapi_Cat_Stech00_Getdetail_Input bp=new Zbapi_Cat_Stech00_Getdetail_Input();
bp.setInputdate(dt);
wdContext.nodeZbapi_Cat_Stech00_Getdetail_Input().bind(bp);
wdThis.wdGetTimesheetCompController().executeZbapi_Cat_Stech00_Getdetail_Input();
Kind Regards
Mukesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brain,
see this link,
<b>https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d352a790-0201-0010-5082-b1a608d22b6c</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Brian,
If you want to check values passing from View to Component, try this way.
- Create a ValueNode (TestNode) and ValueAttribute (TestAttr) from Component Controller Context.
- Create Method (TestMethod) and place this logic in the method
String testAttr = wdContext.createTestNodeElement().getTestAttr();
wdComponentAPI.getMessageManager().reportSuccess("Value Entered in View : "+testAttr );
- Create a link from view to the controller, and drag TestNode to the View.
and assign some value to the attribute.
wdContext.currentTestNode1Element().setTestAttr("Testing Purpose");
And call your controller method (TestMethod) from view, you can see the value from controller also.
wdThis.wdGetTestComponetController().TestMethod();
It will print the same value what you have assigned in the view.
It seems to be tricky, but it is very simple.
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Brian,
Passing parameter to the component controller is simple.
After you creating RFC Model, you might have created model node ( I guess that is bp in your code). When you bind values to that (bp) from view, values automatically binded to the component controller and from there to model (R/3) after calling the below method.
wdThis.wdGetTimesheetCompController().executeZbapi_Cat_Stech00_Getdetail_Input();
Use MessageManager to check correct values are going to the back end or not.
IWDMessageManager manager = wdComponentAPI.getMessageManager();
manager.reportSuccess("Value ");
It is good programming practice.
For more information go thru the sample for WebDynpro for JAVA.
https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#15
Accessing ABAP Function at this place.
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.