on 09-11-2006 9:14 PM
How do I populate an abstractlist that is an input to an RFC? I read the post by Bertram Ganz, but my generated classes look different. I imported the RFC and the system generated the following:
-zbapi_appraisal_create
-zbapi_appraisal_create_input
-appraisees (bapiappraisee)
-bapiappraisee
-fields...
-output (zbapi_appraisal_create_output)
-same as output node below
-appraiser_id
-rest of input parameters...
-zbapi_appraisal_create_output
...etc.
I have no problem setting the regular input parms, but how do I set the table? I tried the following, but I get a ClassCastException on the call to setAppraisees().
Zbapi_Appraisal_Create_Input input = new Zbapi_Appraisal_Create_Input();
wdContext.nodeZbapi_Appraisal_Create().bind(input);
input.setAppraisal_Model_Id(appraisalModelId);
input.setStart_Date(startDate);
input.setText(description);
input.setCreation_Date(appraisalDate);
input.setAppraiser_Id(appraiserId);
//static values
input.setPlan_Version("01");
input.setAnonymous(true);
input.setAppraiser_Type("P");
input.setAppraiser_Plan_Version("01");
//create appraisee
<b>Bapiappraisee obj = new Bapiappraisee();
obj.setPlan_Version("01");
obj.setType("P");
obj.setId(appraiseeId);
obj.setName(appraiseeName);
List myList = input.getAppraisees();
if (myList == null) myList = new ArrayList();
myList.add(obj);
input.setAppraisees((AbstractList)myList);</b>
wdContext.currentZbapi_Appraisal_CreateElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
Any input is greatly appreciated!!
John<b></b>
hi,
If input is declared and binded in custom controller then use following method to get object for Bapiappraisee -
wdThis.wdGetCustomControllerName()
.wdGetContext()
.zbapi_appraisal_create_inputElement()
.<b>modelObject()</b>.
There will be method like <b>input.addBapiappraiseeList()</b>.Use this method for adding inner nodes.
Also please check the binding for Bapiappraisee as zbapi_appraisal_create_input -> bapiappraisee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Maksim. The third link had code with an add method. I didn't see that one. I modified my code as follows:
//create appraisee
Bapiappraisee obj = new Bapiappraisee();
obj.setPlan_Version("01");
obj.setType("P");
obj.setId(appraiseeId);
obj.setName(appraiseeName);
<b>input.addAppraisees(obj);</b>
wdContext.currentZZBapi_Appraisal_CreateElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
My code compiles; however, when I run it with the debugger, I get the following exception when the execute method is called:
com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException
The detailMessage node is null and I can drill down forever in the cause and exceptionInfo nodes and never see an exception message.
Any ideas?
Thanks,
John
Please read a good manual prepared by Arun Bhat -
<a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f3f93ee7-0c01-0010-2593-d7c28b5377c2">Adaptive RFC Troubleshooting Guide</a>
WDDynamicRFCException most likely comes in the following cases:
a) JCo is not setup properly
b) Your function module does not exist in R/3 system referred by your JCo
c) Your function module is not RFC enabled
d) DD_DOMA_GET is not RFC enabled
Also make sure you have got your cardinality settings for your model node in context controller proper.
If you have used a template approach, just check your wdDoInit method of your custom/component controller for code similar to the following:
wdContext.nodeBAPI_Input().bind(new BAPI_Input());
If you have the above code and the code that you have just pasted , just comment this code and try executing your application again.
Regards,
Subramanian V.
Message was edited by: Subramanian Venkateswaran
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.