cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to retrieve parameters from RFC Function Module

Former Member
0 Kudos

Hi All,

I have created a model for the RFC Enabled function module BAPI_BUPA_CENTRAL_GETDETAIL within my webdynpro program. I am passing parameters to the function module BAPI_BUPA_CENTRAL_GETDETAIL and I have validated that this is being passed correctly by displaying the passed value from the node of the input parameters.

Code used to pass input parameters -

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try

{

wdContext.currentBapi_Bupa_Central_Getdetail_InputElement().modelObject().execute();

size = wdContext.nodeCentraldataperson().size();

wdComponentAPI.getMessageManager().reportSuccess(Integer.toString(size));

wdContext.nodeOutput().invalidate();

}

catch(WDDynamicRFCExecuteException e)

{

manager.reportException(e.getMessage(), false);

}

I also see that it returns 1 record by using the code below:

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try

{

wdContext.currentBapi_Bupa_Central_Getdetail_InputElement().modelObject().execute();

size = wdContext.nodeCentraldataperson().size();

wdComponentAPI.getMessageManager().reportSuccess(Integer.toString(size));

wdContext.nodeOutput().invalidate();

}

catch(WDDynamicRFCExecuteException e)

{

manager.reportException(e.getMessage(), false);

}

But, when I try to retrieve the value returned it does not fetch that value -

Bapi_Bupa_Central_Getdetail_Output getdata = wdContext.nodeBapi_Bupa_Central_Getdetail_Input().nodeOutput().currentOutputElement().modelObject();

Bapibus1006_Central_Person[] getres = new Bapibus1006_Central_Person[size];

for(int i=0; i<size; i++){

wdComponentAPI.getMessageManager().reportSuccess(Integer.toString(i));

getres<i> = getdata.getCentraldataperson();

//String fullname = wdContext.nodeBapi_Bupa_Central_Getdetail_Input().nodeOutput().nodeCentraldataperson().getElementAt(i).getAttributeValue("Fullname").toString();

String fullname = getres<i>.getFullname();

fullname += Integer.toString(i);

wdContext.currentContextElement().setFullname(fullname);

wdComponentAPI.getMessageManager().reportSuccess("fullname:" + fullname);

}

It always returns 0 or null. Can someone please help me with this issue. The BAPI returns values in structure format and not internal table and hence I dont see the issue there as well.

What can be the problem?

Thanks for all your help in advance.

Best regards,

Divya

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Divya,

Instead of this

for(int i=0; i<size; i++){

wdComponentAPI.getMessageManager().reportSuccess(Integer.toString(i));

getres = getdata.getCentraldataperson();

//String fullname = wdContext.nodeBapi_Bupa_Central_Getdetail_Input().nodeOutput().nodeCentraldataperson().getElementAt(i).getAttributeValue("Fullname").toString();

String fullname = getres.getFullname();

fullname += Integer.toString(i);

wdContext.currentContextElement().setFullname(fullname);

wdComponentAPI.getMessageManager().reportSuccess("fullname:" + fullname);

}

write this

for(int i=0; i<size; i++){

wdComponentAPI.getMessageManager().reportSuccess(Integer.toString(i));

getres = getdata.getCentraldataperson();

//String fullname = {color:green}wdContext.nodeCentraldataperson().getElementAt(i).getAttributeValue("Fullname").toString();

String fullname = getres.getFullname();

fullname += Integer.toString(i);

wdContext.currentContextElement().setFullname(fullname);

wdComponentAPI.getMessageManager().reportSuccess("fullname:" + fullname);

}

The reason for this is very simple. After executing the RFC, you are invalidating the output node, so if you try to access it afterwards it will not have anything.

Best Regards,

Ravi

Former Member
0 Kudos

Hi ,

You are retreving ouput from Bapi_Bupa_Central_Getdetail_Output node.

You have fetch data from Ouput node which is under

Bapi_Bupa_Central_Getdetail_Input node, check the model node structure Bapi_Bupa_Central_Getdetail_Input

Regards,

Sunitha Hari

nikhil_bose
Active Contributor
0 Kudos

see, here RFC return values are available in Centraldataperson node. In order to reflect the new values you need to invalidate this node instead of nodeOutput.

replace the code in try:


try
{
wdContext.currentBapi_Bupa_Central_Getdetail_InputElement().modelObject().execute();
size = wdContext.nodeCentraldataperson().size();
wdComponentAPI.getMessageManager().reportSuccess(Integer.toString(size));
wdContext.nodeCentraldataperson().invalidate();
// only this step  needs change
}
catch(WDDynamicRFCExecuteException e)
{
manager.reportException(e.getMessage(), false);
}

I changed only one statement; see the comment

nikhiL

Former Member
0 Kudos

Nikhil / Srihari,

I changed my code and it now looks like - I am trying get the return value into the context fullname but i still cant get the value although the size of nodeCentraldataperson() is thrown as 1 and the input is being passed correctly as i have validated this in this line of code [wdContext.nodeBapi_Bupa_Central_Getdetail_Input().currentBapi_Bupa_Central_Getdetail_InputElement().getBusinesspartner();]

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try

{

wdContext.currentBapi_Bupa_Central_Getdetail_InputElement().modelObject().execute();

size = wdContext.nodeCentraldataperson().size();

wdComponentAPI.getMessageManager().reportSuccess(Integer.toString(size));

wdContext.nodeCentraldataperson().invalidate();

}

catch(WDDynamicRFCExecuteException e)

{

manager.reportException(e.getMessage(), false);

}

for(int i=0; i <size; i++){

String name = "FullName: ";

wdContext.nodeBapi_Bupa_Central_Getdetail_Input().nodeOutput().nodeCentraldataperson().setLeadSelection(i);

name += wdContext.nodeBapi_Bupa_Central_Getdetail_Input().currentBapi_Bupa_Central_Getdetail_InputElement().getBusinesspartner();

name += wdContext.nodeBapi_Bupa_Central_Getdetail_Input().nodeOutput().nodeCentraldataperson().currentCentraldatapersonElement().getFullname();

wdContext.currentContextElement().setFullname(name);

}

Any idea what could be wrong?

Thanks,

Divya

Former Member
0 Kudos

Hi ,

for(int i=0; i <size; i++){

String name = "FullName: ";

wdContext.nodeOutput().nodeCentraldataperson().setLeadSelection(i);

name += wdContext.node<output>().getBusinesspartner();

// try fetching Business Partner from output node ... u are fetching from input parameter

name += wdContext.nodeCentraldataperson().currentCentraldatapersonElement().getFullname();

wdContext.currentContextElement().setFullname(name);

}

Try this code

Regards,

Sunitha Hari

Edited by: Sunitha Hari on Apr 9, 2008 10:42 AM

nikhil_bose
Active Contributor
0 Kudos

code : for loop

// just changed your code; didn't tried other ways



for(int i=0; i <size; i++){
String name = "FullName: ";
wdContext..nodeCentraldataperson().setLeadSelection(i);
name += wdContext.currentBapi_Bupa_Central_Getdetail_InputElement().getBusinesspartner();
name += wdContext.currentCentraldatapersonElement().getFullname();
wdContext.currentContextElement().setFullname(name);
}

but i am not sure about this code since you get the last value only.

could you post your requirement like where you want to set/display the full name ?

nikhiL

Edited by: Nikhil Bos on Apr 9, 2008 11:33 AM

Former Member
0 Kudos

Hi Divya,

Instead of code:

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try
{
wdContext.currentBapi_Bupa_Central_Getdetail_InputElement().modelObject().execute();
size = wdContext.nodeCentraldataperson().size();
wdComponentAPI.getMessageManager().reportSuccess(Integer.toString(size));
wdContext.nodeCentraldataperson().invalidate();
}
catch(WDDynamicRFCExecuteException e)
{
manager.reportException(e.getMessage(), false);
}

Try following:

IWDMessageManager manager = wdComponentAPI.getMessageManager();
try
{
wdContext.currentBapi_Bupa_Central_Getdetail_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
size = wdContext.nodeCentraldataperson().size();
wdComponentAPI.getMessageManager().reportSuccess(Integer.toString(size));
}
catch(WDDynamicRFCExecuteException e)
{
manager.reportException(e.getMessage(), false);
}

The problem is you are trying to fetch size before invalidating the output node. When you invalidate the output node then only controller will fetch data from model to its output node.

Regards,

Gopal

Former Member
0 Kudos

Hi All,

Thankyou for all your valuable inputs. I set some breakpoints within the function module and realized that the problem was with the input data. The FM works in R3 with business partner as 2000000065 but when passed from WDJ it has to be completely LPADed with the value to look like 0200000065.

Thanks again,

Divya

Former Member
0 Kudos

hai Divya,

The client configured for adaptive rfc will be different when compared to jco.So check if data is available in the client configured for adaptive rfc.This ll fix your issue.If data is not there ask the abaper to shift the data to respective client and then check the rfc execution.

Thanks n Regards

Sharanya.R

Former Member
0 Kudos

Hi Sharanya,

The JCo is pointing to client 120. I have tested the BAPI in client 120. I am also getting the return size as 1 within WD. I am the ABAP developer myself so I see the ABAP side working fine.

The adaptive RFC is also set to client 120. So what could be the problem?

Thanks,

Divya