on 05-03-2007 10:33 AM
Hi Experts,
I am getting the following exception
java.lang.NullPointerException
when i try to execute the following code:
int i = wdContext.nodeOutput().currentOutputElement().getO_Text().length();
Can anybody please help me solve this
Regards,
Abdullah
answered
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Abdulla,
Please check these,
Ensure that your node/attribute is null
You can write the code inside the exception block.
Regards,
<b>Ramganesan K</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
are you sure that that the RFC is not returning any values?
Did you print that and check?
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if ur RFC is not returning the values.., that is the reason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anoop
In the backend it is returning values.
The code in my controller is
public void Bapi_GetList( )
{
//@@begin Bapi_GetList()
try
{
// Calls remote function module
wdContext.currentBapi_Birthday_Getlist_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
}
catch (Exception ex)
{
// If an exception is thrown, then the stack trace will be printed
ex.printStackTrace();
}
//@@end
}
i am even binding the input in the doInit of the Controller. This method Bapi_Execute is being called from my view.
Regards
Abdullah
Hi ,
Maybe there is an error or some mandatory parameter not set..
catch (Exception ex)
{
// printstacktrace would not give you the output in ur browser console.. so //.. use this
wdComponentAPI.getMessageManager().reportWarning(e.getCause());
}
See if its error free.. If there is still no data.. Maybe u r input does not produce any result as per the RFC..
So you need to check.. if
i
f(wdContext.node<nodename>().size() > 0 )
//then access the current element.. other wise skip it..
Regards
Bharathwaj..
put all the code in domodify view in try catch..
put a print statement before int i = wdContext.nodeOutput().currentOutputElement().getO_Text().length();
like wdThis,wdgetapi.getcomponet.getmessagemanager.reportsuccess()wdContext.nodeOutput().currentOutputElement().getO_Text());
and check teh value that u are getting...
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Abdullah,
here ,
<i>
int i = wdContext.nodeOutput().currentOutputElement().getO_Text().length();</i>
only one thing can be ,
The Output element must not be created , better thing is make the cardinality to 1.1 or 1.n.
and why are you writing this code in WdDoModify(), it is certainly not preferable
hope it helps
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
nodeOutput().currentOutputElement(). is a node element that u get after executing one RFC.
Might be doModifyview is been called befor eyou execute the RFC and store all the information in the particular noew..
Yoy try to exceute the method in doint itself so that you dont get this error
Thanks
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anoop,
the rfc is called before this method is being called and
according to Abhijeets suggestion,
The cardinality is 1..n
I debugged again and saw that the BAPI is not returning values. I had recently made changes in the BAPI. Can that have caused this to happen?
Although the input and output structure remains same
Regards
Abdullah
Message was edited by:
Abdullah Ismail
Hi ,
Ensure that the Output element is created before accessing it as current element.
Or make the cardinality as 1..n and work on it.
You are trying to access the leadselected element .. but there is none created in the node. so it returns a null and hence a nullpointer exception..
And do search forum for similar queries.. !
Regards
Bharathwaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
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.