on 10-31-2008 3:45 PM
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!!
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!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One Correction the same code DOES NOT work for the other table parameter either.
PLEASE HELP!!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.