cancel
Showing results for 
Search instead for 
Did you mean: 

RFC input structure

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

sebastin_alvarez
Participant
0 Kudos

Sorry, but i have to say this. Bertram Ganz i have to give my thanks, because i solved my problem with your answer.

Thanks, Sebastiá

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Bertram,

Your suggested code solves my problem. Thanks for your help.

Johan