cancel
Showing results for 
Search instead for 
Did you mean: 

error Input table in web dynpro java

former_member196079
Active Contributor
0 Kudos

Hi expert

I'm trying to create a service order via web dynpro java, but i can't use the input parameter of type table;

With this implementation of the method init of the custom controller ,on the table i can insert only an element, because the table have only a row. wdContext.nodeIt_Input_Items().size() = 1

  public void wdDoInit()
  {
    //@@begin wdDoInit()
	Crm_Wap_Order_Create_Input input = new Crm_Wap_Order_Create_Input();
		wdContext.nodeNode_custom_controller().bind(input);
	Crm_Wap_Input_Items table = new Crm_Wap_Input_Items();
			wdContext.nodeIt_Input_Items().bind(table);  
		
	
		input.setIv_Bp(input.getIv_Bp());
			input.setIv_Currency(input.getIv_Currency());
			input.setIv_Description(input.getIv_Description());
			input.setIv_Offline_Luid_Order(input.getIv_Offline_Luid_Order());
			input.setIv_Ord_Delivery_Date(input.getIv_Ord_Delivery_Date());
			input.setIv_Order_Guid(input.getIv_Order_Guid());
			input.setIv_Pers_Resp(input.getIv_Pers_Resp());
			input.setIv_Po_Number_Sold(input.getIv_Po_Number_Sold());
			input.setIv_Proc(input.getIv_Proc());
			input.setIv_Save(input.getIv_Save());
			input.setIv_Selected_Prod(input.getIv_Selected_Prod());
			input.setIv_Ship_To(input.getIv_Ship_To()); 

		for(int i=0;i<wdContext.nodeIt_Input_Items().size(); i++) {
			table.setOrder_Qty(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getOrder_Qty());
			table.setProd(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getProd());
			table.setDelivery_Date(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getDelivery_Date());
			table.setSequence(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getSequence());
			table.setUom(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getUom());
			table.setLine_Guid(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getLine_Guid());
			if(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getProd()!= null)
			 input.addIt_Input_Items(table);
			 } 
    //@@end
  }

I've tried, with a button, to insert more row, and i do that, but the additionals rows are not passed to the function, but only the row created with the method wdDoInit();

How can i bind the additional row at the context??

Somebody know a tutorial for create an order via web dynpro java??

Please Help me

Best regards

Marco

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Marco,

you will have to set the cardinality of your context node from 1 to *. If you imported a model, it may be, that you wont be able to do so in the context view, in that case you can check the cardinality within the model.

hope that helps

Jan

former_member196079
Active Contributor
0 Kudos

Hi Jan

The cardinality of mine context node is 0 to *, i've change it on the context view.

for add the row i use this code, is this right??

	
       Crm_Wap_Order_Create_Input input = new Crm_Wap_Order_Create_Input();	
	Crm_Wap_Input_Items table = new Crm_Wap_Input_Items();
	IIt_Input_ItemsElement tb = wdContext.createIt_Input_ItemsElement(table);
	wdContext.nodeNode_custom_controller().addElement(tb);

thanks Marco

Former Member
0 Kudos

Sorry, just by reading this sample, I cannot guess your context structure. What Elements exactly are you trying to create and which are your nodes?

Just provide a full sample where i can see the variable types, please

Jan

Former Member
0 Kudos

try

 Crm_Wap_Order_Create_Input input = new Crm_Wap_Order_Create_Input();
 wdContext.nodeNode_custom_controller().bind(input);
input.setIt_Input_Items(new AbstractList())

former_member196079
Active Contributor
0 Kudos

hi Jan

this is the custom controller context node

Link: [http://img196.imageshack.us/i/20eb24feef0f760076b9a0e.png/]

the selected node It_Input_Item is the table input parameter, this is his properties

Link: [http://img189.imageshack.us/i/ae081db3f248866f71ca203.png/]

and this is the table and the context of the view

Link: [http://img190.imageshack.us/i/f840c96fc38c94137eec607.png/]

Link: [http://img35.imageshack.us/i/50465507c7fb928a0921a05.png/]

the view context are mappef with the custom controllew context

Thanks Marco

Former Member
0 Kudos

Former Member
0 Kudos

Hi Marco,

you mean to say first ur adding one row into table in custam controller and you are trying to add a row while clicking on the button.

if this is the case, create one custam method in custam controller past ur code in that method and call that method in WDInit method in custom controller and in the button action also call the custam method created in custam controller.

let me know if you have any issues.

Thanks&Regards,

Bhargava.

former_member196079
Active Contributor
0 Kudos

Hi Bhargava

Yes i want add row when i press a button, but i'm not able to inplemente a method thant can do this.

The method that i've write, add a row on the table view, but the value of this row is not passed at the function....

i think that the row is not bind at the context....

con you help me??

Marco

Former Member
0 Kudos

Hi Marco,

Let me know one thing, you are adding th row before executing the BAPI.

if it is correct then first try create a refernce of particular node and set the values by useing that reference and bind that reference to the paraent node.

please use this code for adding refernce to root node.

<rootnodeRefernce>.add(<ChildnodeRefernce>);

then execute the bapi. make sure that if you are adding different values in different rows try to put that code in action of Button

and if you want add one row at intial time of displaying view try to add that code in wdInit of particular view also.

let me know if you are facing any problems.

Thanks&Regards,

Bhargava.

former_member196079
Active Contributor
0 Kudos

Hi Bhargava

I've found the problem.

In the context i've all the data but the problem is in the model cardinality....it's 0...1.

Link: [http://img16.imageshack.us/i/e1a7645c1c31f5668894a57.png/]

how i can change it??

Marco.

former_member196079
Active Contributor
0 Kudos

another screen

Link: [http://img36.imageshack.us/i/cd09e7c559d6f87d6cbe971.png/]

Former Member
0 Kudos

Hi Marco,

the screens are not clear. you can't change the model node cordinality.

let confirm one thing, you need to show the value in second screen after saving the data in backend. and also confirm your storing that value in backend or not.

Confirm one more thing u dirctly mapped the bapi structure from models to custam controller or u created a node in custam controller and then u mapped.

Thanks&Regards,

Bhargava.

former_member196079
Active Contributor
0 Kudos

Hi Bhargava

Hi've created the node and after i've mapped it with the custom controller...

I think that the probles is in the model cardinality beacuse, in the context i've all the data and all the row.

Marco

Former Member
0 Kudos

Hi Marco,

Try to map the bapi node dirctly from the model to custam controller and custam controller to view.

and try that code in wdInit of that view and the Button Action.

let me know if it not works.

Thanks&Regards,

Bhargava.

former_member196079
Active Contributor
0 Kudos

Hi Bhargava

It not work.....it pass only the item created in the method wdDoInit.........

Marco

Former Member
0 Kudos

Hi Marco,

Let me know one thing, you are executing the bapi in wdInit and as well as in button action.

Former Member
0 Kudos

Hi,

I'll attach a code here, this is how your Java function should look like:


	IPOOrderListForecastNode poOrderListForecast = wdContext.nodePOOrderListForecast();
	Z_Get_Orderlist_Planner_Input poOrderListForecastInput = new Z_Get_Orderlist_Planner_Input();
	poOrderListForecast.bind(poOrderListForecastInput);
	
	IVariablesElement variables = wdContext.currentVariablesElement();
	IVMIOrderListFilterSettingsElement vmiSettings = wdContext.currentVMIOrderListFilterSettingsElement();
	IDisplayViewSettingsElement displayView = wdContext.currentDisplayViewSettingsElement();
	String selectedStore = variables.getSelectedStore();
	String department = variables.getDepartment();
	String subDepartment = variables.getSubDepartment();
	String vendor = vmiSettings.getVendor();

	poOrderListForecastInput.setStore(selectedStore);
	poOrderListForecastInput.setZdept(department);
	poOrderListForecastInput.setZsdept(subDepartment);
	poOrderListForecastInput.setLifnr(vendor);

	IVMIOrderListNode nodeVMIOrderList = wdContext.nodeVMIOrderList();
	for (int i = 0; i < nodeVMIOrderList.size(); i++) {
		IVMIOrderListElement vmiOrderListElement = nodeVMIOrderList.getVMIOrderListElementAt(i);
		Zwd_S_Vmi_Order_List_Article vmiOrderListArticle = new Zwd_S_Vmi_Order_List_Article();
		vmiOrderListArticle.setBstme(vmiOrderListElement.getBstme());
		vmiOrderListArticle.setMatnr(vmiOrderListElement.getMatnr());
		vmiOrderListArticle.setUombase(vmiOrderListElement.getUombase());
		vmiOrderListArticle.setUomordr(vmiOrderListElement.getUomordr());
		vmiOrderListArticle.setUomtype(vmiOrderListElement.getUomtype());
		poOrderListForecastInput.addI_Artlist(vmiOrderListArticle);
	}
	
	try {
		poOrderListForecastInput.execute();

Hope it helps;

Regards,

Daniel

former_member196079
Active Contributor
0 Kudos

hi Bhargava

sorry for the late..

no in the init method i do the binding of the parametere, because if i'dont it in the init mothod the parameters are not editable..

Link:[http://img29.imageshack.us/i/56a7250185252a1d06af141.png/]

in me button metho i execute the BAPI....


  public void wdDoInit()
  {
    //@@begin wdDoInit()
	Crm_Wap_Order_Create_Input input = new Crm_Wap_Order_Create_Input();
    wdContext.nodeNode_custom_controller().bind(input);
	    //input.setIt_Input_Items(new AbstractList());
	  
	Crm_Wap_Input_Items table = new Crm_Wap_Input_Items();
	wdContext.nodeIt_Input_Items().bind(table);  
	
	
		input.setIv_Bp(input.getIv_Bp());
			input.setIv_Currency(input.getIv_Currency());
			input.setIv_Description(input.getIv_Description());
			input.setIv_Offline_Luid_Order(input.getIv_Offline_Luid_Order());
			input.setIv_Ord_Delivery_Date(input.getIv_Ord_Delivery_Date());
			input.setIv_Order_Guid(input.getIv_Order_Guid());
			input.setIv_Pers_Resp(input.getIv_Pers_Resp());
			input.setIv_Po_Number_Sold(input.getIv_Po_Number_Sold());
			input.setIv_Proc(input.getIv_Proc());
			input.setIv_Save(input.getIv_Save());
			input.setIv_Selected_Prod(input.getIv_Selected_Prod());
			input.setIv_Ship_To(input.getIv_Ship_To()); 
	

		for(int i=0;i<wdContext.nodeIt_Input_Items().size(); i++) {			
			//wdContext.nodeIt_Input_Items().ge
			table.setOrder_Qty(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getOrder_Qty());
			table.setProd(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getProd());
			table.setDelivery_Date(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getDelivery_Date());
			table.setSequence(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getSequence());
			table.setUom(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getUom());
			table.setLine_Guid(wdContext.nodeIt_Input_Items().getIt_Input_ItemsElementAt(i).getLine_Guid());
			input.addIt_Input_Items(table);
			} 

    //@@end
  }

this is the init...

in the button method


  public void CreateOrder( )
  {
    //@@begin CreateOrder()
    
	try
	{  
		wdContext.currentNode_custom_controllerElement().modelObject().execute();
		wdContext.nodeOutput().invalidate();
		}
		catch (Exception ex)
		{
		 ex.printStackTrace();
		}
    //@@end
  }

former_member196079
Active Contributor
0 Kudos

HI Daniel

Thanks for the code....but it still not work,......

How i must impement the init method??

Marco

former_member196079
Active Contributor
0 Kudos

Hi

i think that the error is when i add the row....

con u give me the code for add a row on the table please???'

thanks in advance

Marco

Former Member
0 Kudos

Hi Marco,

please check the for loop. your tacking the size of It_Input_Items node and looping upto the size of It_Input_Items node

and your tacking whatever values in that node and agian your setting to same node.

how this will add the new row into your It_Input_Items node.

let me know what is the source node and what is the destination node.

Thanks&Regards

Bhargava.

former_member196079
Active Contributor
0 Kudos

Hi Bhargava.

The loop in the init method work.....because if i start the application, in the table i find a row....and this row is passed at the function.....

Link:[http://img198.imageshack.us/img198/74/a4a977ea5794168ccabe9d6.png]

if i add a row, i can see at view level, but i think that in the context this row is not add, because in the function i find only the first row.

Link:[http://img11.imageshack.us/img11/74/a4a977ea5794168ccabe9d6.png]

for add the row i use this code...is correct??


	Crm_Wap_Input_Items table = new Crm_Wap_Input_Items();
	IIt_Input_ItemsElement tb = wdContext.createIt_Input_ItemsElement(table);
       wdContext.nodeIt_Input_Items().addElement(tb);

Thaks so mutch

Marco

Former Member
0 Kudos

Hi Marco,

The code u writen is correct. but before adding element to node u need to set values to that elemnet.

so try to set the values to that element and then add that element to node.

Thanks&Regards,

Bhargava.

former_member196079
Active Contributor
0 Kudos

Sorry...

the link where you can see the add row in this

Link:[http://img9.imageshack.us/img9/886/051ef1020090c85e1029603.png]

sorry Marco

Former Member
0 Kudos

Hi Marco,

Your Input fields are greyed out because, the below line of code should be after initialising the node elements. So, you should put this code at the end of all code in wdInit() method. Do you understand my point.

 wdContext.nodeIt_Input_Items().bind(table);
wdContext.nodeNode_custom_controller().bind(input);

the images that you gave are not visible. Send them to gopal.yarlagadda at salford.gov.uk

I'll have a look and will let you know if there is any problem.

Regards,

Gopal.

Edited by: Gopal on Jul 17, 2009 5:50 PM

Edited by: Gopal on Jul 17, 2009 5:53 PM

former_member196079
Active Contributor
0 Kudos

HI....

not work.........

can you show how i should implement the init and the execute method????

thanks

Marco