on 05-05-2008 5:03 AM
Dear All I have written following code to add data in table behind an action button.
public void onActionInsert(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionInsert(ServerEvent)
String PassYear = wdThis.wdGetContext().currentContextElement().getPassYear();
String GPA = wdThis.wdGetContext().currentContextElement().getGPA();
String Major = wdThis.wdGetContext().currentContextElement().getMajor();
String Institute = wdThis.wdGetContext().currentContextElement().getInstitute();
Zrfc_Online_Edu_Input input2 = new Zrfc_Online_Edu_Input();
wdContext.nodeZRFC_ONLINE_EDU().bind(input2);
Zonline_Edu tab = new Zonline_Edu();
tab.setGpa(GPA);
tab.setMajor(Major);
tab.setPassyear(PassYear);
tab.setInstitute(Institute);
tab.setDegree("Masters");
input2.addEducation_Tab(tab);
//@@end
}
But following code is overwriting the previous records every time I click Action button. How can I write the below code outside action button.
Zrfc_Online_Edu_Input input2 = new Zrfc_Online_Edu_Input();
wdContext.nodeZRFC_ONLINE_EDU().bind(input2);
Zonline_Edu tab = new Zonline_Edu();
Following Code resolved the problem.
public void onActioninsertMaster(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActioninsertMaster(ServerEvent)
String PassYear = wdThis.wdGetContext().currentContextElement().getPassYear();
String GPA = wdThis.wdGetContext().currentContextElement().getGPA();
String Major = wdThis.wdGetContext().currentContextElement().getMajor();
String Institute = wdThis.wdGetContext().currentContextElement().getInstitute();
wdContext.nodeZRFC_ONLINE_EDU().bind(input2);
tab = new Zonline_Edu();
tab.setGpa(GPA);
tab.setMajor(Major);
tab.setPassyear(PassYear);
tab.setInstitute(Institute);
tab.setDegree("Masters");
input2.addEducation_Tab(tab);
//@@end
}
//@@begin others
Zrfc_Online_Edu_Input input2 = new Zrfc_Online_Edu_Input();
Zonline_Edu tab;
//@@end
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this.
Put the following code under wdInit()
Zrfc_Online_Edu_Input input2 = new Zrfc_Online_Edu_Input();
Zonline_Edu tab = new Zonline_Edu();
input2.addEducation_Tab(tab);
wdContext.nodeZRFC_ONLINE_EDU().bind(input2);
and put the remaining code under Action Handler
currentZonline_EduElement().setGpa(GPA);
currentZonline_EduElement().setMajor(Major);
currentZonline_EduElement().setPassyear(PassYear);
currentZonline_EduElement().setInstitute(Institute);
currentZonline_EduElement().setDegree("Masters");
and use reset method to flush your data accordingly for tab data.
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
move the code to the doInit Method , as this is the hook method called only once so the model classes can be instantiated only once and in the Button Action U execute the model and feed the data to the Table .
Thanks and Regards
Fistae
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can write in wdDoModifyView mothod
if(fristTime){
Zrfc_Online_Edu_Input input2 = new Zrfc_Online_Edu_Input();
wdContext.nodeZRFC_ONLINE_EDU().bind(input2);
Zonline_Edu tab = new Zonline_Edu();
}
Thanks
linghj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You havn't posted all your code.
But I guess that, every time onActionInsert, a new Zonline_Edu Object should be created.
So, just move the following two statements:
Zrfc_Online_Edu_Input input2 = new Zrfc_Online_Edu_Input();
wdContext.nodeZRFC_ONLINE_EDU().bind(input2);
The 3rd statement stays in the current place:
Zonline_Edu tab = new Zonline_Edu();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
move that code from the button action handler to wdDoinit.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Adnan,
you can write that code in the at the bottom of ur implementation page between
//@@begin others
Zrfc_Online_Edu_Input input2 = new Zrfc_Online_Edu_Input();
wdContext.nodeZRFC_ONLINE_EDU().bind(input2);
Zonline_Edu tab = new Zonline_Edu();
//@@end
Thanks
Jeet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.