on 11-03-2005 11:51 AM
Hello,
I am trying to call a RFC from my WebDynpro application.
The RFC has a mandatory input structure called PERSDATA.
I am using the following test code to call the RFC:
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try{
wdContext.nodeZ_Portal_Get_Timesheet_Input().bind(new Z_Portal_Get_Timesheet_Input());
wdContext.currentZ_Portal_Get_Timesheet_InputElement().setKeydate(new Date(105,9,27));
wdContext.nodePersdata().bind(new Cats_Its_Persdata());
wdContext.currentPersdataElement().setPernr("00003000");
wdContext.currentZ_Portal_Get_Timesheet_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
} catch(WDDynamicRFCExecuteException ce) {
manager.reportException(ce.getMessage(), false);
}
When I run this code I get the errormessage:
<b>Mandatory parameter PERSDATA of method Z_PORTAL_GET_TIMESHEET missing.</b>
When I display the input structure in my view (in a table) it displays one row with pernr set to 00003000 (so it seems to me that the input structure is ok).
What am I doing wrong here?
Hallo Johan,
your mistake is based on the fakt, that you did not correctly aggregate your model object graph. Instead you operated on the context itself. The context only references the model objects within the model object graph. Relations between context nodes and context node elements are not automatcally mirrored within the model object graph. Principally you have to aggregate your model object graph first (independant from the contex) and afterwards you can reference the executable model class within the toplevel context node element.
I assume, that your code should look like this:
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try {
// Aggregate model object graph
Z_Portal_Get_Timesheet_Input timeSheetInput =
new Z_Portal_Get_Timesheet_Input();
timeSheetInput.setKeydate(new Date(105, 9, 27));
Cats_Its_Persdata persData = new Cats_Its_Persdata();
persData.setPernr("00003000");
timeSheetInput.setPersdata(persData);
// Bind executable model object to context node 'Z_Portal_Get_Timesheet_Input'
wdContext.nodeZ_Portal_Get_Timesheet_Input().bind(timeSheetInput);
// Execute model object
wdContext
.currentZ_Portal_Get_Timesheet_InputElement()
.modelObject()
.execute();
// Invalidate output node so that the context-to-model-object-references will be updated
wdContext.nodeOutput().invalidate();
} catch (WDDynamicRFCExecuteException ce) {
manager.reportException(ce.getMessage(), false);
}
Also have a look at my related answer within the forum thread which deals with the same issue.
Regards, Bertram
Regards, Bertram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Bertram,
Your suggested code solves my problem. Thanks for your help.
Johan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.