on 08-04-2006 3:05 PM
Hi I got a null pointer.
ihave the following code:
//@@begin executeY_Tf_Start_Process_Input()
Y_Tf_Start_Process_Input inputPS = new Y_Tf_Start_Process_Input();
inputPS.setScenario_Key(wdContext.currentYtf_MainprocessPLElement().getScenariokey());
inputPS.setPernr(wdContext.currentEmployee_ListELElement().getPernr());
inputPS.setCountry(wdContext.currentCountriesCLElement().getLand1());
inputPS.setMainprocesskey(wdContext.currentYtf_MainprocessPLElement().getMainprocesskey());
inputPS.setReason(wdContext.currentReasonsPRElement().getReason());
wdContext.nodeY_Tf_Start_Process_Input().bind(inputPS);
try
{
wdContext.currentY_Tf_Start_Process_InputElement().modelObject().execute();
wdContext.nodeOutputPS().invalidate();
}
catch (Exception ex)
{
ex.printStackTrace();
}
//@@end
}
_____________
error message:
java.lang.NullPointerException
at com.shell.teamflow.wd.processstart.ProcessStart_Cust.executeY_Tf_Start_Process_Input(ProcessStart_Cust.java:220)
at com.shell.teamflow.wd.processstart.wdp.InternalProcessStart_Cust.executeY_Tf_Start_Process_Input(InternalProcessStart_Cust.java:395)
at com.shell.teamflow.wd.processstart.StartProcessView.onActionStartProcess(StartProcessView.java:177)
at com.shell.teamflow.wd.processstart.wdp.InternalStartProcessView.wdInvokeEventHandler(InternalStartProcessView.java:432)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
Hi
try this
try
{
if(wdContext.currentReasonsPRElement().getReason()!=null)
inputPS.setReason(wdContext.currentReasonsPRElement().getReason());
}
catch(NullPointerException e)
{
inputPS.setReason("");
}
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Doesn't this help you resolve your problem?
try
{
wdContext.currentReasonsPRElement().getReason()!=null)
inputPS.setReason(wdContext.currentReasonsPRElement().getReason());
}
catch(NullPointerException e)
{
inputPS.setReason("");
}
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I think you should check if you are getting the Reasons populated in the ReasonsPR node.If you are, then check if Reason is mandatory parameter.If it is then you have to pass the correct value to this parameter.
Anyway could you please post the stacktrace?
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
wdContext.currentReasonsPRElement().getReason() itself is giving Null pointer Exception.
Hence use the try catch block as per my previous post and the check.
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Still ur reponse from ReasonsPR is null...
try once like this:
if(wdContext.currentReasonsPRElement().getReason()!=null)
{
//tmp your getting null value check whether you mapped to response(ReasonsPR) and is getting value from bapi?
String tmp = "";
tmp = wdContext.currentReasonsPRElement().getReason();
if(tmp != "")
inputPS.setReason(tmp);
else
inputPS.setReason("");
}
else
inputPS.setReason("");
Regards
Suresh
Hi
Try using
try
{
wdContext.currentReasonsPRElement().getReason()!=null)
inputPS.setReason(wdContext.currentReasonsPRElement().getReason());
}
catch(NullPointerException e)
{
inputPS.setReason("");
}
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Are you sure that the element for the node ReasonsPR exists?If not then make sure that you have one by setting its cardinality to 1..n or by creating it.If you already have one then use try catch block for that code.
In catch block set the reason to "".
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
if(wdContext.currentReasonsPRElement().getReason()!=null)
{
//tmp your getting null value check whether you mapped to response(ReasonsPR) and is getting value from bapi?
String tmp = wdContext.currentReasonsPRElement().getReason();
if(tmp != null)
inputPS.setReason(tmp);
else
inputPS.setReason("");
}
else
inputPS.setReason("");
Regards
Suresh
java.lang.NullPointerException
at com.shell.teamflow.wd.processstart.ProcessStart_Cust.executeY_Tf_Start_Process_Input(ProcessStart_Cust.java:221)
at com.shell.teamflow.wd.processstart.wdp.InternalProcessStart_Cust.executeY_Tf_Start_Process_Input(InternalProcessStart_Cust.java:395)
at com.shell.teamflow.wd.processstart.StartProcessView.onActionStartProcess(StartProcessView.java:177)
at com.shell.teamflow.wd.processstart.wdp.InternalStartProcessView.wdInvokeEventHandler(InternalStartProcessView.java:432)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
___________________________________________________
Y_Tf_Start_Process_Input inputPS = new Y_Tf_Start_Process_Input();
inputPS.setScenario_Key(wdContext.currentYtf_MainprocessPLElement().getScenariokey());
inputPS.setPernr(wdContext.currentEmployee_ListELElement().getPernr());
inputPS.setCountry(wdContext.currentCountriesCLElement().getLand1());
inputPS.setMainprocesskey(wdContext.currentYtf_MainprocessPLElement().getMainprocesskey());
if(wdContext.currentReasonsPRElement().getReason()!=null)
{
//tmp your getting null value check whether you mapped to response(ReasonsPR) and is getting value from bapi?
String tmp = wdContext.currentReasonsPRElement().getReason();
if(tmp != null)
inputPS.setReason(tmp);
else
inputPS.setReason("");
}
else
inputPS.setReason("");
// if(wdContext.currentReasonsPRElement().getReason()!=null)
// inputPS.setReason("");
// else
// inputPS.setReason(wdContext.currentReasonsPRElement().getReason());
wdContext.nodeY_Tf_Start_Process_Input().bind(inputPS);
try
{
wdContext.currentY_Tf_Start_Process_InputElement().modelObject().execute();
wdContext.nodeOutputPS().invalidate();
}
catch (Exception ex)
{
ex.printStackTrace();
}
Hi,
Try this
Create other node (You can Change the cardinality here 1..n)and bind the bapi value to the node and bind it to the view.
You unable to check the null with cardinality 0..n when the value is null
//for binding the value from Bapi to dropdown
IPrivate<ViewName>.I<DropName>Node node = wdContext.node<DropName>();
int len=wdContext.node<BAPIList>().size();
for(int l=0;l<len;l++) {
String
returndata=String.valueOf(((IPrivate<viewname>.I<BAPIList>Element)(wdContext.node<BAPIList>(
).getElementAt(l))).get<Parameter>());
IPrivate<ViewName>.I<DropName>Element element =
wdContext.create<DropName>Element();
element.set<Param>(returndata);
node.addElement(element);
}
Kind Regards
Mukesh
Hi
What is the line no. 221 in your ProcessStart_Cust.java.
It is causing this exception.Could you please post it?
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
node property is 0.1
______________________________
Y_Tf_Start_Process_Input inputPS = new Y_Tf_Start_Process_Input();
inputPS.setScenario_Key(wdContext.currentYtf_MainprocessPLElement().getScenariokey());
inputPS.setPernr(wdContext.currentEmployee_ListELElement().getPernr());
inputPS.setCountry(wdContext.currentCountriesCLElement().getLand1());
inputPS.setMainprocesskey(wdContext.currentYtf_MainprocessPLElement().getMainprocesskey());
if
(wdContext.currentReasonsPRElement().getReason()!=null)
inputPS.setReason
<221>(wdContext.currentReasonsPRElement().getReason());
else
inputPS.setReason("");
wdContext.nodeY_Tf_Start_Process_Input().bind(inputPS);
try
{
wdContext.currentY_Tf_Start_Process_InputElement().modelObject().execute();
wdContext.nodeOutputPS().invalidate();
}
catch (Exception ex)
{
ex.printStackTrace();
}
Message was edited by: Eoin Cronan
Hi
The error occurd at line number 220.
And check that element is not null which you have bind to that line.
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
Check all the input is null then bind it to the BAPI Input
like
Y_Tf_Start_Process_Input inputPS = new Y_Tf_Start_Process_Input();
if(wdContext.currentYtf_MainprocessPLElement().getScenariokey()!=null){
inputPS.setScenario_Key(wdContext.currentYtf_MainprocessPLElement().getScenariokey());
}
if(wdContext.currentEmployee_ListELElement().getPernr()!=null){
inputPS.setPernr(wdContext.currentEmployee_ListELElement().getPernr());
}
if(wdContext.currentCountriesCLElement().getLand1()!=null){
inputPS.setCountry(wdContext.currentCountriesCLElement().getLand1());
}
if(wdContext.currentYtf_MainprocessPLElement().getMainprocesskey()!=null){
inputPS.setMainprocesskey(wdContext.currentYtf_MainprocessPLElement().getMainprocesskey());
}
if(wdContext.currentReasonsPRElement().getReason()!=null){
inputPS.setReason(wdContext.currentReasonsPRElement().getReason());
}
//do the execute
Kind Regards
Mukesh.
Again I null pointer with this code
java.lang.NullPointerException
at com.shell.teamflow.wd.processstart.ProcessStart_Cust.executeY_Tf_Start_Process_Input(ProcessStart_Cust.java:221)
at com.shell.teamflow.wd.processstart.wdp.InternalProcessStart_Cust.executeY_Tf_Start_Process_Input(InternalProcessStart_Cust.java:395)
at com.shell.teamflow.wd.processstart.StartProcessView.onActionStartProcess(StartProcessView.java:177)
at com.shell.teamflow.wd.processstart.wdp.InternalStartProcessView.wdInvokeEventHandler(InternalStartProcessView.java:432)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
Hi
It is occurring because you are accessing current<Node>Element of some node which actually does not exist.
The error is in line 220 of your ProcessStart_Cust.java.
Check if the node you are accessing in this line actually has the element.If not the create one or set the cardinality to 1..n.
Regards,
Ajay
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.