Skip to Content
author's profile photo Former Member
Former Member

Unable to retrieve parameters from RFC Function Module

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 04:28 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Posted on Apr 09, 2008 at 04:39 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 04:45 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 05:11 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.