cancel
Showing results for 
Search instead for 
Did you mean: 

Node Binding error

udaykumar_kanike
Active Contributor
0 Kudos

Hi All,

I am facing node binding error. Please someone help me. I wrote following code.

Zhr_Str_Employee_Rel eno = new Zhr_Str_Employee_Rel();

wdContext.nodeIt_Emp_No().bind(eno);

eno.setEmp_No(wdContext.currentOutput_usernameElement().getEmployeenumber());

IPrivateZsubordinatesView.IIt_Emp_NoNode empno = null;

empno.bind(eno);

when i run the application I am getting folllowing error.

com.sap.tc.webdynpro.progmodel.context.ContextException: Node(ZsubordinatesView.Zhr_Fm_Relations_Down_Input.Output.It_Emp_No): cannot bind or add elements because the node has no valid parent

It seems that I am going somewhere wrong. Please someone help me.

Thanks

Uday

Edited by: Uday Kumar Kanike on Jan 12, 2012 1:00 PM

Accepted Solutions (1)

Accepted Solutions (1)

Qualiture
Active Contributor
0 Kudos

Is the parent node element of the node you want to bind already created?

You can only add elements to child nodes when all parents are bound and have at least one element.

udaykumar_kanike
Active Contributor
0 Kudos

Hi Robin,

following is my model node : Zhr_Str_Employee_Rel

and It_Emp_No is my node to which i need to bind the value.

however, model node is mapped to this node when I checked model binding.

so please suggest me how to proceed.

i need to fetch the value of the following node and bind it to above node.

wdContext.currentOutput_usernameElement().getEmployeenumber()

thanks

uday

Qualiture
Active Contributor
0 Kudos

In your code, you have:

IPrivateZsubordinatesView.IIt_Emp_NoNode empno = null;
empno.bind(eno);

You cannot bind to a 'null' value. Instead, you need to instantiate the node, use something like:

IPrivateZsubordinatesView.IIt_Emp_NoNode empno = wdContext.nodeIt_Emp_No();
empnode.createAndAddIIt_Emp_NoElement();
empno.bind(eno);

udaykumar_kanike
Active Contributor
0 Kudos

Hi Robin,

I am getting this new error which is slightly different from my previous error.

com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(ZsubordinatesComp.Zhr_Fm_Relations_Down_Input.Output.It_Emp_No): value node is created without a reference

Regards

Uday

Qualiture
Active Contributor
0 Kudos

Can you simply try

IPrivateZsubordinatesView.IIt_Emp_NoNode().bind(eno);

udaykumar_kanike
Active Contributor
0 Kudos

No Robin,

When I write this code, I am getting error in NWDS itself saying no method IIt_Emp_NoNode() defined for the class IPrivateZsubordinatesView.

Qualiture
Active Contributor
0 Kudos

Apologies, a copy-paste error on my side...

Anyways, in your code you have

Zhr_Str_Employee_Rel eno = new Zhr_Str_Employee_Rel();
wdContext.nodeIt_Emp_No().bind(eno);

and later on you tried to bind 'eno' again:

IPrivateZsubordinatesView.IIt_Emp_NoNode empno = null;
empno.bind(eno);

That latest part is not necessary, and I believeyou just need to execute your function

p330068
Active Contributor
0 Kudos

Dear Uday,

Please try this :-



Zhr_Str_Employee_Rel eno = new Zhr_Str_Employee_Rel(WDModelScopeType.APPLICATION_SCOPE);
wdContext.nodehr_Str_Employee_Rel().bind(eno);
eno.setEmp_No(<PASS THE VALUE TO MODEL FOR EXECUTION>);

try
{	
	eno.execute();			
	wdContext.nodeOutput_username().invalidate();									
}catch(WDDynamicRFCExecuteException ce) {
	wdComponentAPI.getMessageManager().reportException("executing Model:: "+ce.getMessage(),false);
}catch(Exception ex){			
	wdComponentAPI.getMessageManager().reportException("executing Model:: " +ex.getMessage(),false);
}finally{	
	
	// Copy Results into IIt_Emp_NoNode Node: 				
	populateIt_Emp_No();
                     //Disconnect model instance
	wdContext.currentZhr_Str_Employee_RelElement().modelObject().modelInstance().disconnectIfAlive();	
}


//Create method to populate the value in It_Emp_No
populateIt_Emp_No(){

	wdContext.nodeIt_Emp_No().invalidate();
	IIt_Emp_NoElement eleEmp = null

	if(wdcontext.nodeOutput_username().size() > 0){

		for(int i=0; i<wdcontext.nodeOutput_username().size(); i++) {
			eleEmp = wdContext.createIt_Emp_NoElement();
			eleEmp.set<YOur Attribute to set>(wdContext.nodeOutput_username ().getOutput_usernameElementAt(j).getEmp_No());
			wdContext.nodeIt_Emp_No().addElement(eleEmp);	

		}
}
}

Hope it will helps

Best Regards

Arun Jaiswal

udaykumar_kanike
Active Contributor
0 Kudos

Hi Arun,

My model node name is Zhr_Fm_Relations_Down_Input

Zhr_Str_Employee_Rel is only a root node of RFC to which my It_Emp_No is bounded.

I tried many ways but it dint work.

when I am trying to create instance of It_Emp_No , it is asking for parameter of type Zhr_Str_Employee_Rel.

so i am bit confused how to pass parameter of type to other node.

regards

uday

udaykumar_kanike
Active Contributor
0 Kudos

I am trying this new type. here also i am getting type casting error. i could not convert either e01 to string nor i can take the value as below.

Zhr_Str_Employee_Rel eno = new Zhr_Str_Employee_Rel();

wdContext.nodeIt_Emp_No().invalidate();

IIt_Emp_NoElement e01 = (IIt_Emp_NoElement) wdContext.currentOutput_usernameElement().getEmployeenumber();

wdContext.nodeIt_Emp_No().bind(e01);

p330068
Active Contributor
0 Kudos

Dear Uday,

Once you create the object of the Zhr_Fm_Relations_Down_Input xyz and binded.

Then there is no need to bind for Zhr_Str_Employee_Rel to It_Emp_No. you only need to add or set. like

Zhr_Str_Employee_Rel one = new Zhr_Str_Employee_Rel ();

It_Emp_No two = new It_Emp_No()

two.setEmp("VALUE");

one.addAAA OR SetBBB(two);

xyz.addAAA OR SetBBB(one);

Try it should work.

You might refer to [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/761eba66-0401-0010-b982-d5f5bd9e8f90|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/761eba66-0401-0010-b982-d5f5bd9e8f90]

Hope it will helps

Best Regards

Arun Jaiswal

former_member182372
Active Contributor
0 Kudos

Uday Kumar, the problem is with your Output relation. When you initialize the table before execution you should use the table relation from your executable class model (Zhr_Str_Employee_Rel in your case) not from Output. I the context you actually have to create 2 nodes: one under execuatable model class node, and one under Output.

So the context should look like:

Zhr_Str_Employee_Rel

- It_Emp_No

- Output

---It_Emp_No_Output

udaykumar_kanike
Active Contributor
0 Kudos

Hi Arun,

The link was very helpful but still I could not resolve node binding error. Please find the code I wrote.

for( int i=0; i<wdContext.nodeOutput_username().size();i++)

{

inp2.setI_Im_Report("x");

inp2.setI_Ad_Report("x");

inp2.setI_Bh_Report("x");

inp2.setI_Fh_Report("x");

inp2.setI_Hr_Report("x");

inp2.setI_It_Report("x");

String empnumber = wdContext.currentOutput_usernameElement().getEmployeenumber();

Zhr_Str_Employee_Rel eno = new Zhr_Str_Employee_Rel();

eno.setEmp_No(empnumber);

inp2.addIt_Emp_No(eno);

wdThis.wdGetZsubordinatesCompController().executeZhr_Fm_Relations_Down_Input();

}

In my case, Rfc needs "x" value to be passed along with the employee number. so I have set the values manually.

Please help.

Thanks

Uday

p330068
Active Contributor
0 Kudos

Dear Uday,

Apart from inp2 values setting in for loop. you can other code to out of for loop.

for( int i=0; i<wdContext.nodeOutput_username().size();i++)

{

inp2.setI_Im_Report("x");

inp2.setI_Ad_Report("x");

inp2.setI_Bh_Report("x");

inp2.setI_Fh_Report("x");

inp2.setI_Hr_Report("x");

inp2.setI_It_Report("x");

}

If you are passing only constant values then there is no need to user FOR loop.

Try to execute the RFC in backend directly and check what are all attibute and parameter required and set it accordingly.

Best Regards

Arun Jaiswal

udaykumar_kanike
Active Contributor
0 Kudos

Hi Arun,

Finally it worked. Thanks to all who helped me.

Following are the final lines of code I wrote which worked.

for( int i=0; i<wdContext.nodeOutput_username().size();i++)

{

inp2.setI_Im_Report("x");

//inp2.setI_Ad_Report("x");

//inp2.setI_Bh_Report("x");

//inp2.setI_Fh_Report("x");

//inp2.setI_Hr_Report("x");

//inp2.setI_It_Report("x");

//String empnumber = wdContext.currentOutput_usernameElement().getEmployeenumber();

Zhr_Str_Employee_Rel eno = new Zhr_Str_Employee_Rel();

eno.setEmp_No(wdContext.currentOutput_usernameElement().getEmployeenumber());

inp2.addIt_Emp_No(eno);

wdThis.wdGetZsubordinatesCompController().executeZhr_Fm_Relations_Down_Input();

}

Thanks

Uday

Answers (0)