cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving data in Response Node from RFC

former_member181928
Participant
0 Kudos

In my wd Appln i am invoking a RFC.and my context has the following structure.

Context-->inp1

outputnode

output1

output2

I have bound this three attributes to three input fields.

There is a scenario where i have to check if the output1 is empty or not before the rfc is invoked.

When i write the following code it gives me null pointer exception

if(wdContext.currentOutputNodeElement.getOutput1().equals(""))

then i also checked if the output1 is null or not

if(wdContext.currentOutputNodeElement.OUTPUT1 == null) even this gave me null pointer exception.

can u please tell me what exactly is null here .

There is no problem when the response has come from rfc only crashing if accessed before getting response from RFC

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Why are you binding input to output nodes?

Anyhoos, you'll probably find that your nodes are null, try:

if(wdContext.nodeOutput1()==null)

If the node itself is null then testing if it holds a null attribute will throw the null pointer exception.

I hope this helps,

Patrick.

Former Member
0 Kudos

Nilesh,

Correct check should looks like:


final I<ControllerName>.IInp1Element elIn
 = wdContext.currentInp1Element();

final I<ControllerName>.IOutputNodeElement elOut
 = null == elIn ? null : wdContext.currentOutputNodeElement();

if ( null != elOut && null != elOut.getOutput() && 
     elOut.getOutput().length() > 0 )
{
/* code here */
}

VS

Message was edited by: Valery Silaev

Former Member
0 Kudos

Hi Nilesh,

For checking output1 empty:

For String it is null, if its going to be an integer then its 0.

<b>if(wdContext.currentOutputNodeElement.getOutput1()==null)</b>

Hope it helps,

Regards,

Nagarajan.