cancel
Showing results for 
Search instead for 
Did you mean: 

Help using the result from a RFC into another RFC

Former Member
0 Kudos

Hi everybody,

I've an application with two views, in the first view is displayed a table recovered from a RFC from which clicking in the cell of any row sends the user to the second view where a second RFC (Bapi_Appraisal_GetDetail) is executed informing data from the previous view. Right here everything is working correctly.

This second RFC returns a table from which I need 2 fields (Element_Id and Element_Type) of each row and launch a third RFC (Bapi_Appraisal_Scale_Getdetail_Input) to recover the info I need to display in another table.

So the problem comes here, I don't know how to go through my table (the result of the second RFC) and executing the third RFC in order to create a table with its results. e.g: if RFC nº2 returns 16 elements, RFC nº3 should be executed 16 times (each by row).

Thanks in advance for any help!

Joan


public void wdDoInit()
  {
    //@@begin wdDoInit()
// Initialize values for the second RFC
String codeBapi2 = wdThis.wdGetApreciacionActuacionCompController().wdGetContext().currentContextElement().getCodiAprec();
wdContext.currentBapi_Appraisal_Getdetail_InputElement().setAppraisal_Id(codeBapi2);
String planVersion = "01";
		wdContext.currentBapi_Appraisal_Getdetail_InputElement().setPlan_Version(planVersion);
wdThis.wdGetBapiEvaluacionesCust0Controller().executeBapi_Appraisal_GetDetail();

// If the second RFC returns a non empty response, the third RFC is executed     	
if (wdContext.nodeOutputSalida().size() > 0 && wdContext.nodeOutputSalida().getLeadSelection() != -1) {
      for (int i=0; i<wdContext.nodeOutputSalida().size(); i++){
wdContext.nodeOutputSalida().getElementAt(i);
// Initialize values of third RFC
wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement().setElement_Id(wdContext.nodeOutputSalida().nodeAppraisal_DataSalida().getCurrentElement().getAttributeValue("Element_Id").toString());
wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement().setElement_Type(wdContext.nodeOutputSalida().nodeAppraisal_DataSalida().getCurrentElement().getAttributeValue("Element_Type").toString());
wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement().setPlan_Version("01");

wdThis.wdGetBapiEvaluacionesCust0Controller().executeBapi_Appraisal_Scale_Getdetail_Input();
}
}   

Edited by: Joan Roda on Jun 9, 2008 10:28 AM

Edited by: Joan Roda on Jun 9, 2008 10:48 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try to copy the model nodes with:

WDCopyService.copyCorresponding(source, target)

Former Member
0 Kudos

Thanks for your answer. My code will be something like:

WDCopyService.copyCorresponding(wdContext.currentOutputSalidaElement(), wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement());

But I don't see how this code will allow me to loop through the result of the second RFC. My problem is that I'm stuck in the first row of the table and I can't go to the following rows. Where should I insert this line of code that you provided me? Does it sustitute any part of my current code? (I guess the set methods Element_Type and Element_ID)

Former Member
0 Kudos

Hope understanding your problem, you can go through your table within a loop and "getElementAt" and call your 3rd RFC within that loop!?

for (int i = wdContext.nodeXYZ.size() - 1; i >= 0; i--)

{

// get the current row in line "i"

wdContext.XYZ.getElementAt(i);

...

...

..

// Maybe the RFC call with Entry of "getElementAt..."

}

Former Member
0 Kudos

You want to loop over nodeOutputSalida???

Hope following code helps you..

for (int i = wdContext.nodeOutputSalida().nodeAppraisal_DataSalida().size() - 1; i >= 0; i--)

{

// Initialize values of third RFC

wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement().setElement_Id(wdContext.nodeOutputSalida().nodeAppraisal_DataSalida().getAppraisal_DataSalidaElementAt(i).getElement_Id();

wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement().setElement_Type(wdContext.nodeOutputSalida().nodeAppraisal_DataSalida().getAppraisal_DataSalidaElementAt(i)

.getElement_Type();

wdContext.currentBapi_Appraisal_Scale_Getdetail_InputElement().setPlan_Version("01");

wdThis.wdGetBapiEvaluacionesCust0Controller().executeBapi_Appraisal_Scale_Getdetail_Input();

}

}

Former Member
0 Kudos

You have to know on what node you need the "size"

wdContext.nodeOutputSalida().size()

OR

wdContext.nodeOutputSalida().nodeAppraisal_DataSalida().size()

Then you need to get the specific "ElementAt"

wdContext.nodeOutputSalida().nodeAppraisal_DataSalida().getAppraisal_DataSalidaElementAt(i).getElement_Id());

OR

wdContext.nodeOutputSalida().getOutputSalidaElementAt(i).nodeAppraisal_DataSalida().getElement_Id());

(i think this doesn't work)

with getXYZElementAt you can get the specific parameter directly!

Former Member
0 Kudos

Thanks! That solved my problem.

Answers (0)