on 05-30-2008 8:19 AM
Hi,
I am developing the WD application.
But am facing Strange Problem.
When i am writing code for inserting data in wdDoInit() method it is successfully inserting data. I am also calling executeInsert() method and in that i have executed the modelobject. In InsertView i have called the executeInsert method using wdThis.<ComponentController>.executeInsert();
But when i write the code in method executeInsert() which i have created then it is not inserting in database.
and then calling it in insertview as wdThis.<ComponentController>.executeInsert();
So i am not able to understand this Strange Behaviour.
Pls explain me why this happens...
Thanks & Regards,
Dhruv Shah
Hi,
Can you post the code and the methods
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,
public void wdDoInit()
{
//@@begin wdDoInit()
try
{
Zep_Events_Input inp = new Zep_Events_Input();
wdContext.nodeZep_Events_Input().bind(inp);
inp.setAdd1(wdContext.currentZep_Events_InputElement().getAdd1());
inp.setAdd2(wdContext.currentZep_Events_InputElement().getAdd2());
inp.setBukrs(wdContext.currentZep_Events_InputElement().getBukrs());
inp.setButxt(wdContext.currentZep_Events_InputElement().getButxt());
inp.setDisp_Mod(wdContext.currentZep_Events_InputElement().getDisp_Mod());
inp.setE_Date(wdContext.currentZep_Events_InputElement().getE_Date());
inp.setE_Name(wdContext.currentZep_Events_InputElement().getE_Name());
inp.setLocation(wdContext.currentZep_Events_InputElement().getLocation());
inp.setStatus(wdContext.currentZep_Events_InputElement().getStatus());
}
catch(Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess(e.toString());
}
//@@begin javadoc:executeInsert()
/** Declared method. */
//@@end
public void executeInsert( )
{
//@@begin executeInsert()
try
{
// Zep_Events_Input inp = new Zep_Events_Input();
//
// wdContext.nodeZep_Events_Input().bind(inp);
wdContext.currentZep_Events_InputElement().modelObject().execute();
}
catch(Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess(e.toString());
}
//@@end
}
public void onActionSave(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionSave(ServerEvent)
//$$begin ActionButton(-1900911611)
wdThis.wdGetActivityController().executeInsert();
//$$end
//@@end
}
Now if i write following way then i am not able to insert data:
public void wdDoInit()
{
//@@begin wdDoInit()
try
{
Zep_Events_Input inp = new Zep_Events_Input();
wdContext.nodeZep_Events_Input().bind(inp);
}
catch(Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess(e.toString());
}
public void executeInsert( )
{
//@@begin executeInsert()
try
{
// Zep_Events_Input inp = new Zep_Events_Input();
//
//
inp.setAdd1(wdContext.currentZep_Events_InputElement().getAdd1());
inp.setAdd2(wdContext.currentZep_Events_InputElement().getAdd2());
inp.setBukrs(wdContext.currentZep_Events_InputElement().getBukrs());
inp.setButxt(wdContext.currentZep_Events_InputElement().getButxt());
inp.setDisp_Mod(wdContext.currentZep_Events_InputElement().getDisp_Mod());
inp.setE_Date(wdContext.currentZep_Events_InputElement().getE_Date());
inp.setE_Name(wdContext.currentZep_Events_InputElement().getE_Name());
inp.setLocation(wdContext.currentZep_Events_InputElement().getLocation());
inp.setStatus(wdContext.currentZep_Events_InputElement().getStatus());
wdContext.nodeZep_Events_Input().bind(inp);
wdContext.currentZep_Events_InputElement().modelObject().execute();
}
catch(Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess(e.toString());
}
//@@end
}
Hi Dhruv,
You don't have to write following code anywhere, not even in wdDoInit:
inp.setAdd1(wdContext.currentZep_Events_InputElement().getAdd1());
inp.setAdd2(wdContext.currentZep_Events_InputElement().getAdd2());
inp.setBukrs(wdContext.currentZep_Events_InputElement().getBukrs());
inp.setButxt(wdContext.currentZep_Events_InputElement().getButxt());
inp.setDisp_Mod(wdContext.currentZep_Events_InputElement().getDisp_Mod());
inp.setE_Date(wdContext.currentZep_Events_InputElement().getE_Date());
inp.setE_Name(wdContext.currentZep_Events_InputElement().getE_Name());
inp.setLocation(wdContext.currentZep_Events_InputElement().getLocation());
inp.setStatus(wdContext.currentZep_Events_InputElement().getStatus());
in wdDoInit following code is enough:
Zep_Events_Input inp = new Zep_Events_Input();
wdContext.nodeZep_Events_Input().bind(inp);
In executeInsert following code is enough:
try
{
wdContext.currentZep_Events_InputElement().modelObject().execute();
}
catch(Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess(e.toString());
}
Regards,
Gopal
HI,
Thanks for reply.
Now for displaying should i have to write the same.
Coz i have a RFC which is taking mode from WD.
mode =1 then Display
mode = 2 then Insert.
so now i tried writing the above code and also supplied the mode, but unable to display.
should i have to take a value attribute in context and then bind it to RFC context node.
Guide me on this.
Thanks & Regards,
Dhruv Shah
Hi Dhruv,
You can add one parameter mode in executeInsert method and add following code in it:
wdContext.nodeZep_Events_Input().currentZep_Events_InputElement().setMode(mode);//mode is parameter
Now when you want to display call executeInsert(1) and if you want to insert call executeInsert(2).
But I will suggest that to make two RFCs, one for displaying and one for insert. And use both RFCs as per your requirement. This is only a suggestion.
Regards,
Gopal
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
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.