cancel
Showing results for 
Search instead for 
Did you mean: 

Major Problem filling my Context

Former Member
0 Kudos

Hi All,

I need help solving the following problem. My Context looks as follows:

Context

-> Z_Customer_Front_Controller_Input

-->I_Customer

---> value1

---> value2

---> value ...

-> Z_Read_Infoobject_Input

--> Output

---> E_Customer

-


> value1

-


> value2

-


> value ...

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


		  wdContext.currentI_CustomerElement().set__Bic__Epskufuer(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Epskufuer());
		  wdContext.currentI_CustomerElement().set__Bic__Rbampisbr(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbampisbr());
		  wdContext.currentI_CustomerElement().set__Bic__Rbwwrpnkz(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbwwrpnkz());
		  wdContext.currentI_CustomerElement().setChanged(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getChanged());
// etc....
		  	  
	  }	

This code leads me to a single object being filled into the context, namely the last one in the list...

But I need all of them. I guess I need to add coding similar to

wdContext.nodeI_Customer().addElement(??);

but i just don't get it running...

Please help! I am desperate!!

Thanks, Johannes

Accepted Solutions (1)

Accepted Solutions (1)

nikhil_bose
Active Contributor
0 Kudos

if I_Customer can have 0..n instances, you can go for instantiating it and bind to parent node.

e.g.


I_Customer customer;
for(int i=0; i < wdContext.nodeE_Customer().size(); i++ ){
 customer = new I_Customer(//new Model Object()); customer.set__Bic__Epskufuer(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Epskufuer());
		  customer.set__Bic__Rbampisbr(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbampisbr());
		  customer.set__Bic__Rbwwrpnkz(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbwwrpnkz());
		  customer.setChanged(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getChanged());
wdContext.nodeI_Customer().bind(customer);
}

nikhil

Former Member
0 Kudos

Thanks for the answer...

unfortunately, I do not have amn element named

I_Customer customer;

I only have:

II_CustomerElement customer;

but then

customer = new II_CustomerElement(...);

leads me to "the constructor for .. is undefined"

Any ideas? Thanks!!

Answers (3)

Answers (3)

Former Member
0 Kudos

I need to get this running.

I have tried

customerElement = wdContext.nodeI_Customer().createAndAddI_CustomerElement();

leads me to

com.sap.tc.webdynpro.progmodel.context.ContextException: 
NodeElement(.InfoObjectCust.Z_Customer_Front_Controller_Input): 
model node element cannot be created without a model instance

the function

customerElement = wdContext.nodeI_Customer().createI_CustomerElement();

does not exist in 7.1.

customer = new I_Customer(//new Model Object()); ...

does not work for me neither...

Does Anybody have another idea?

Pleaede help, I am working on this since days and I NEED to get it working!! Thanks, Johannes

Former Member
0 Kudos

Allright Buddies, I got I...

here my coding for 7.1...

public void onActionValidateChangesCustomer(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionValidateChangesCustomer(ServerEvent)
	  for( int i=0; i < wdContext.nodeE_Customer().size(); i++ ){
		 
		  wdContext.currentI_CustomerElement().set__Bic__Epskufuer(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Epskufuer());
		  wdContext.currentI_CustomerElement().set__Bic__Rbampisbr(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbampisbr());
		  wdContext.currentI_CustomerElement().set__Bic__Rbbrand(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbbrand());
		  wdContext.currentI_CustomerElement().set__Bic__Rbcustgrp(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbcustgrp());
		  wdContext.currentI_CustomerElement().set__Bic__Rbgroup(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbgroup());
		  wdContext.currentI_CustomerElement().set__Bic__Rbkunde(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbkunde());
		  wdContext.currentI_CustomerElement().set__Bic__Rbprod(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbprod());
		  wdContext.currentI_CustomerElement().set__Bic__Rbsubgrp1(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbsubgrp1());
		  wdContext.currentI_CustomerElement().set__Bic__Rbsubgrp2(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbsubgrp2());
		  wdContext.currentI_CustomerElement().set__Bic__Rbwwrpnkz(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbwwrpnkz());
		  wdContext.currentI_CustomerElement().setChanged(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getChanged());
		  wdContext.currentI_CustomerElement().setDatefrom(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getDatefrom());
		  wdContext.currentI_CustomerElement().setObjvers(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getObjvers());
		  
		  wdContext.nodeI_Customer().addElement(new __Bic__Mrbkunde());
		  wdContext.nodeI_Customer().moveNext();
	  }	  
	  
	  // trigger the RFC
	  wdThis.wdGetInfoObjectCustController().executeZ_Customer_Front_Controller();

    //@@end
  }

Thanks, Johannes

Former Member
0 Kudos

Hi ,

try the below code

II_CustomerNode i_CustomerNode=wdContext.nodeII_Customer();

II_CustomerElement i_CustomerElement

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

i_CustomerElement = wdContext.nodeI_Customer().createI_CustomerElement()

i_CustomerElement .set__Bic__Epskufuer(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Epskufuer());

i_CustomerElement .set__Bic__Rbampisbr(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbampisbr());

i_CustomerElement .set__Bic__Rbwwrpnkz(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbwwrpnkz());

i_CustomerElement .setChanged(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getChanged());

// etc....

wdContext.nodeII_CustomerNode().addElement(i_CustomerElement);

wdContext.nodeII_CustomerNode().moveNext();

}

Thanks,

Ramesh.

Edited by: Ramesh Babu V on Aug 14, 2008 4:27 PM

Edited by: Ramesh Babu V on Aug 14, 2008 4:34 PM

Former Member
0 Kudos

I adapted my coding to:

	  II_CustomerNode customerNode = wdContext.nodeI_Customer();
	  II_CustomerElement customerElement;
	  
	  for( int i=0; i < wdContext.nodeE_Customer().size(); i++ ){

		  customerElement = wdContext.nodeI_Customer().createI_CustomerElement(new __Bic__Mrbkunde());
		  //customerElement = wdContext.nodeI_Customer().createAndAddI_CustomerElement();
		  customerElement.set__Bic__Epsflags(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Epsflags());
		  customerElement.set__Bic__Epskufuer(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Epskufuer());
		  customerElement.set__Bic__Rbampisbr(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbampisbr());
		  customerElement.set__Bic__Rbbrand(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbbrand());
		  customerElement.set__Bic__Rbcustgrp(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbcustgrp());
		  customerElement.set__Bic__Rbgroup(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbgroup());
		  customerElement.set__Bic__Rbkunde(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbkunde());
		  customerElement.set__Bic__Rbprod(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbprod());
		  customerElement.set__Bic__Rbsubgrp1(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbsubgrp1());
		  customerElement.set__Bic__Rbsubgrp2(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbsubgrp2());
		  customerElement.set__Bic__Rbwwrpnkz(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbwwrpnkz());
		  customerElement.setChanged(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getChanged());
		  customerElement.setDatefrom(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getDatefrom());
		  customerElement.setObjvers(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getObjvers());

		  wdContext.nodeI_Customer().addElement(customerElement);
wdContext.nodeI_Customer().moveNext();

This leads me to an empty list... Whats wrong?

Former Member
0 Kudos

customerElement = wdContext.nodeI_Customer().createI_CustomerElement(new __Bic__Mrbkunde());

change the above statement to

customerElement = wdContext.nodeI_Customer().createI_CustomerElement();

Former Member
0 Kudos

this function is not defined (I am using 7.1)..... What can use in 7.1?

I tried

customerElement = wdContext.nodeI_Customer().createAndAddI_CustomerElement();

which leads me to exceptions...

Thanks, Johannes

nikhil_bose
Active Contributor
0 Kudos

you have to pass parent stuctures/model as parameters.

try crtl+space inside ( ) and you can easily pass parameter as new Z..( new..//your model());

Former Member
0 Kudos

Can you give an example of parameters, I've tried and don't get it...