on 01-11-2007 5:46 PM
Hello Experts,
I am having trouble populating a Table input in my Web Dynpro Java application. I have tried researching this issue on SDN and have attemped many of the solutions with no luck. Here is my code:
Bapi_Order_Input NewOrder = new Bapi_Order_Input();
wdContext.nodeBapi_Order_Input().bind(NewOrder);
Bapisdhd1 OrderHead = new Bapisdhd1(); - <i>(This is part of the Input Paramter, values are successfully passed)</i>
OrderHead.setDoc_Type("ZOR");
OrderHead.setSales_Org("2000");
OrderHead.setDistr_Chan("40");
NewOrder.setOrder_Header_In(OrderHead);
Bapiparnr Partner = new Bapiparnr(); - <i>(This is a table parameter, values are not being passed to the backend)</i>
Partner.setPartn_Role("SP");
Partner.setPartn_Numb("20010");
Partner.setItm_Number("000000");
NewOrder.addOrder_Partners(Partner);
wdContext.currentBapi_Salesorder_Createfromdat2_InputElement().modelObject().execute();
I cannot use "NewOrder.setOrder_Partners(Partner)" because Order_Partners is an AbstactList. I have attempted to create this abstract list below but it will not syntactically check:
AbstractList PartnerList = new Bapiparnr.Bapiparnr_List();
If I test these same input values above in R/3, the BAPI executes fine. When I test the BAPI from WD, I get the return message " Please enter a Sold-To or ShipTo Party". I can replicate this same message in R/3 if I do not populate the Partner table.
I am also able to see the Partner values I enter when I create a Table is display them in Web Dynpro.
This is frusterating me a great deal and I would greatly appreciate, and rewards, any suggestions or recomendations.
Thank you for your help,
Matt
Hi,
As you are using wdcontext to execute the bapi.
Use context to fill the data.
I<partner>Element element1 = wdContext.create<partner>Element();
element1.setPartn_Role("SP");
element1.setPartn_Numb("20010");
element1.setItm_Number("000000");
wdContext.node<partner>.addElement(element1);
Then continue with code which executes the bapi.
Hope this helps.
Regards,
Nagaraju Donikena.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nagaraju,
Thank you for your reply. Unfortunately, I am still not able to pass the Partner values to the backend. I had to modify your code somewhat for it to syntactically check but this is what I tried:
Bapi_Salesorder_Createfromdat2_Input NewOrder = new Bapi_Salesorder_Createfromdat2_Input();
wdContext.nodeBapi_Salesorder_Createfromdat2_Input().bind(NewOrder);
Bapiparnr PartnerStructure = new Bapiparnr();
IPrivateTestSalesOrderView.IOrder_PartnersElement Partner
= wdContext.nodeOrder_Partners().<b>createOrder_PartnersElement(PartnerStructure);</b>
The "Create" method required Bapiparnr as an input
Partner.setPartn_Role("SP");
Partner.setPartn_Numb("20010");
Partner.setItm_Number("000000");
wdContext.nodeOrder_Partners().addElement(Partner);
OrderHead.setDoc_Type("ZOR");
OrderHead.setSales_Org("2000");
OrderHead.setDistr_Chan("40");
OrderHead.setDivision("10");
OrderHead.setSales_Off("1000");
OrderHead.setPo_Meth_S("CU01");
NewOrder.setOrder_Header_In(OrderHead);
wdContext.currentBapi_Salesorder_Createfromdat2_InputElement().modelObject().execute();
Once again, I can see the Partner table being populated with a value in the Web Dynpro table before the BAPI is executed, but the value is failing to be passed to the backend.
Thanks
Hi,
Bapi_Order_Input NewOrder = new Bapi_Order_Input();
wdContext.nodeBapi_Order_Input().bind(NewOrder);
Bapisdhd1 OrderHead = new Bapisdhd1(); - (This is part of the Input Paramter, values are successfully passed)
OrderHead.setDoc_Type("ZOR");
OrderHead.setSales_Org("2000");
OrderHead.setDistr_Chan("40");
NewOrder.setOrder_Header_In(OrderHead);
Bapiparnr Partner = new Bapiparnr(); - (This is a table parameter, values are not being passed to the backend)
Partner.setPartn_Role("SP");
Partner.setPartn_Numb("20010");
Partner.setItm_Number("000000");
NewOrder.addOrder_Partners(Partner);
wdContext.currentBapi_Salesorder_Createfromdat2_InputElement().modelObject().execute();
Here what u are doing create the instance for <b>Bapi_Order_Input</b> and bind the this instance only
and passi the input to this instance that is OK.
But execute mehtod u wrote for the Other BAPI <b>currentBapi_Salesorder_Createfromdat2</b> .
I think this may be the problem.
Crete the one BAPI instance and pass the input to that instance and execute that BAPI ONLY.
that might helps.
Bapi_Order_Input NewOrder = new Bapi_Order_Input();
wdContext.nodeBapi_Order_Input().bind(NewOrder);
Bapiparnr Partner = new Bapiparnr(); - (This is a table parameter, values are not being passed to the backend)
Partner.setPartn_Role("SP");
Partner.setPartn_Numb("20010");
Partner.setItm_Number("000000");
NewOrder.addOrder_Partners(Partner);
wdContext.Bapi_Order_Input Element().modelObject().execute();
and write the invalidate .
I think that this might be the procedure.
Thanks,
Lohi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lohitha,
I believe I miss-typed my actual code. At the top of my original post, I thought I would simplify the BAPI name to "Bapi_Order_Input" from "Bapi_Salesorder_Createfromdat2_Input", therefore when I wrote:
Bapi_Order_Input NewOrder = new Bapi_Order_Input();...... I really meant:
Bapi_Salesorder_Createfromdat2_Input NewOrder = new Bapi_Salesorder_Createfromdat2_Input();
But as it turns out, towards the end of my post I reverted back to using my actualy code. Sorry for the confusion...
Thanks for your help. I am still getting the same issue and have listed my code in the replies above.
Thank you all for your help so far. I appreciate your suggestions.
Regards,
Matt
Check size of table parameter before executing the model using following method.
wdContext.currentBapi_Salesorder_Createfromdat2_InputElement().modelObject().getOrder_Partners().size().
If size > 0 your data is successfully transmitted to BAPI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Monalisa,
Thank you for responding. I was not able to test the size of the node with code you gave due to a "java.lang.NullPointException". Here is what I tried:
Bapi_Salesorder_Createfromdat2_Input NewOrder = new Bapi_Salesorder_Createfromdat2_Input();
wdContext.nodeBapi_Salesorder_Createfromdat2_Input().bind(NewOrder);
Bapiparnr PartnerStructure = new Bapiparnr();
IPrivateTestSalesOrderView.IOrder_PartnersElement Partner
= wdContext.nodeOrder_Partners().createOrder_PartnersElement(PartnerStructure);
Partner.setPartn_Role("SP");
Partner.setPartn_Numb("20010");
Partner.setItm_Number("000000");
wdContext.nodeOrder_Partners().addElement(Partner);
OrderHead.setDoc_Type("ZOR");
OrderHead.setSales_Org("2000");
OrderHead.setDistr_Chan("40");
OrderHead.setDivision("10");
OrderHead.setSales_Off("1000");
OrderHead.setPo_Meth_S("CU01");
NewOrder.setOrder_Header_In(OrderHead);
i<b>nt size = wdContext.currentBapi_Salesorder_Createfromdat2_InputElement().modelObject().getOrder_Partners().size();
wdContext.currentContextElement().setPartnerSize("Size:" + String.valueOf(size));</b>
wdContext.currentBapi_Salesorder_Createfromdat2_InputElement().modelObject().execute();
Hello Matt,
In your view please add this code at the appropriate locations:
Bapi_Salesorder_Createfromdat2_Input NewOrder = new Bapi_Salesorder_Createfromdat2_Input();
IPrivate<ViewName>.I<OutputRow>Element ele = wdContext.node<OutputRow>.create<OutputRow>ItemElement(NewOrder);
wdContext.node<OutputRow>.addElement(ele);
Replace <OutputRow> with the name of the model node that contains the individual attributes/fields you want to modify. You will find your equivalent of <OutputRow> inside the 'Output' model node-- it may be directly under it or be nestled a few model nodes deep.
In the code above, you can use the variable 'ele' to hold the values of the attributes/fields you want to modify. Since 'ele' refers to an object that corresponds to the structure of a row that you want to modify-- you can change the values of its constituents and in effect change the values of columns in a row.
It goes without saying that if you are working with the RFM 'Bapi_Salesorder_Createfromdat2' that you will need multiple variables doing what 'ele' does in this example to transfer values to the RFM in multiple structures.
Let me know if you require further assistance with this approach.
Hope this helps,
- Vik.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.