Skip to Content
avatar image
Former Member

How to display a structure returned from bapi?

Hi,

I created a project that is accessing r/3.

On execution of my bapi its returning messages which is a structure.

I tried displaying it in my view using this code:

IWDMessageManager msgmgr = wdComponentAPI.getMessageManager();

msgmgr.reportSuccess(wdContext.currentReturnElement().getMessage());

but its throwing an exception

Can any one please suggest in this regard.

Regards,

Aparna.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Oct 18, 2006 at 02:33 PM

    Hi

    try this

    try{

    if(wdContext.currentReturnElement().getMessage()!=null){

    IWDMessageManager msgmgr = wdComponentAPI.getMessageManager();

    msgmgr.reportSuccess(wdContext.currentReturnElement().getMessage());

    }

    }catch(Exception e){

    IWDMessageManager msgmgr = wdComponentAPI.getMessageManager();

    msgmgr.reportSuccess(e.getMessage());

    }

    Kind Regards

    Mukesh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Satyajit,

      Your code was helpful.

      But instead of getting it from 'input' i used this:

      wdContext.nodebapi_name_input().currentbapi_name_inputElement().modelObject().getOutput().getReturn().getMessage()

      This returned my bapi message as string.

      Thanks All for the help

      Regards,

      Aparna .P

  • avatar image
    Former Member
    Oct 18, 2006 at 04:27 PM

    Hi

    I think it returns the null pointer exception because you mention the getMessage is not returning null value.

    can you check the value is coming or not?

    Other wise post ur issues.

    Thanks

    Lohi.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 19, 2006 at 05:25 AM

    Hi,

    "Null Pointer Exception", will raise when you point to a Null Object.

    in your code, first check

    if(wdContext.currentReturnElement() != null){

    msgmgr.reportSuccess(wdContext.currentReturnElement().getMessage());

    msgmgr.reportSuccess("Size : "+wdContext.currentReturnElement().size());

    }else{

    msgmgr.reportSuccess("Null");

    }

    // if it is coming to else(null), it means "wdContext.currentReturnElement()" is containing null.

    Regards,

    Sridhar

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Sridhar,

      As per our earlier discussion i tried this.

      It is giving null. But actually bapi is returning a message, which i am able capture in webdynpro when it is sent as a table.

      Now when the same 'return' is changed to structure i am unable to display.

      Problem is though there is some data in my return its showing null.

      Please suggest a way to handle structures returned from bapi in webdynpro.

      Regards,

      Aparna .P