cancel
Showing results for 
Search instead for 
Did you mean: 

value Node is created without a reference

Former Member
0 Kudos

Hi experts!!

I have the following code:

for (int i = 0; i < size2; ++i){

IMELINode gnd = wdContext.nodeMELI();

IMELIElement meli = gnd.currentMELIElement();

II_Meli_GenNode ndg = wdContext.nodeI_Meli_Gen();

II_Meli_GenElement gel = ndg.currentI_Meli_GenElement();

gel.setAttributeValue("Indat" , meli.getEISODOS_DATE());

gel.setAttributeValue("Outdat" , meli.getLIKSI_DATE());

ndg.addElement(gel);

II_MeliNode ndm = wdContext.nodeI_Meli();

II_MeliElement mel = ndm.currentI_MeliElement();

mel.setAttributeValue("Afm" , meli.getAFM());

mel.setAttributeValue("Code_Eforia" , meli.getDOY());

mel.setAttributeValue("Firstname" , meli.getONOMA_MEL());

mel.setAttributeValue("Lastname" , meli.getEPWNYMO_MEL());

mel.setAttributeValue("Onoma_Mhtr" , meli.getMITERA() );

mel.setAttributeValue("Onoma_Patr" , meli.getPATRWNYMO());

mel.setAttributeValue("Natio" , meli.getYPIKOOTITA());

mel.setAttributeValue("Adress" , meli.getADDRESS_HOM());

mel.setAttributeValue("Sex" , meli.getGENOS());

ndm.addElement(mel);

}

And it gives me a null exception.

If instead of the .currentElement , i use .createElement it gives me an exception "value Node is created without a reference"

The I_Meli & I_Meli_Gen value nodes are tables in my RFC .

The same code works fine for another table parameter in my RFC..

Any ideas???

Thanx in advance!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I tried this:

for (int i = 0; i < size2; ++i){

IMELINode gnd = wdContext.nodeMELI();

IMELIElement meli = gnd.currentMELIElement();

IZpt_Eggrafi_Neou_InputNode nkd = wdContext.nodeZpt_Eggrafi_Neou_Input();

IWDNode ndg = nkd.getChildNode("I_Meli_Gen", 1);

//II_Meli_GenNode ndg = wdContext.nodeI_Meli_Gen();

IWDNodeElement gel = ndg.createElement();

gel.setAttributeValue("Indat" , meli.getEISODOS_DATE());

gel.setAttributeValue("Outdat" , meli.getLIKSI_DATE());

ndg.addElement(gel);

}

and i get this error :

2com.sap.tc.webdynpro.progmodel.context.ContextException: Node(Confirm.Zpt_Eggrafi_Neou_Input): you can access the singleton child node 'I_Meli_Gen' only via lead selection

ANY IDEAS??

PLEASE HELP!!!

Former Member
0 Kudos

HI,

Assuming you have node1 as parent node and node2 as child node then the code follows as below:

try {

<modelname> model = new <modelname>();

<node1> input = new <node1>(model);

<node2type> items = new <node2type>(model);

items.set<attribute>(<value>);

input.add<node2>(items);

wdContext.node<node1>().bind(input);

wdContext.nodeBapi_Requisition_Create_Input().currentBapi_Requisition_Create_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

} catch (WDDynamicRFCExecuteException e) {

// TODO Auto-generated catch block

wdComponentAPI.getMessageManager().reportException(e.getMessage(),true);

e.printStackTrace();

}

Regards,

Murtuza

Former Member
0 Kudos

Hi,

Can you please post your detail context structure then it will be easy to any one answer your question or suggest code for your problem

Regards

Raghu

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi!! Thank u for your answer!!

The value nodes i am trying to fill are child nodes of the main xxxInputNode of my RFC. They have several Strings as value attributes and the cardinality (which i cannot change because they are automatically created during the RFC model import ) is set to 0..n.

As i said before when i use the .create method i get the exception

value Node is created without a reference.

Please help!!

Former Member
0 Kudos

Hi,

As I can see that you are trying to add values to your table so for sure you should be using createElement and not currentElement.

You would get nullpointer exception if you are trying to use currentElement and you have no elements in your node.

Could you describe us the complete node structure so that we can help you in correct code.

Regards,

Murtuza

Former Member
0 Kudos

One Correction the same code DOES NOT work for the other table parameter either.

PLEASE HELP!!!!