on 07-16-2009 11:41 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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.
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
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.
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.
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
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
}
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.
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
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
User | Count |
---|---|
95 | |
11 | |
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.