Skip to Content
avatar image
Former Member

WebDynpro accessing BAPIs

Hi,

I'm trying to go through the examples in WAS6.30 Sneak Preview Edition and have a few questions.

Since the BAPI_FLIGHT_GETLIST bapi is not included in our 4.6C installation, I was trying to go through the example step by step using a different bapi (BAPI_SALESORDER_GETSTATUS) and changing everything accordingly. I don't have issues until I get to the step where I need to insert some code into the standard method wdDoInit() of the custom controller. I do not know how to create the input elements. The model contains only the following 4 modelclasses: Bapi_Salesorder_Getstatus_Input, Bapi_Salesorder_Getstatus_Output, Bapireturn, Bapisdstat and I don't seem to be able to create an instance of any of these classes. What am I missing?

Without the lines in the "// Creates the input elements" segment the application still builds and deploys but the input field does not accept values and when I press the Search button nothing happens.

Any help would be much appreciated.

Thanks,

Gabor

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Oct 01, 2003 at 12:43 PM

    Hi,

    Has anyone created a WebDynpro application accessing a BAPI in R/3 other than BAPI_FLIGHT_GETLIST? Could you post your code from the wdDoInit() method of the custom controller and let us know which bapi you've used?

    Thanks a lot,

    Gabor

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I have tried couple of RFCs but not getting desired result. There is no much documentation also, only SAP folks could help us. I am also ver eagarly waiting for some clue for the issue mentioned above.

      Regards.

      Suresh

  • avatar image
    Former Member
    Oct 14, 2003 at 08:57 PM

    Hi,

    On the website http://sdn.sap.com/was6_3beta2 , you can download an example for creating a webdynpro application that accesses an abap function. You may downloaded this file already but anyway.

    I have used the instructions to call the function BAPI_COMPANYCODE_GETDETAIL and it all works fine.

    I noticed that you first need to enter the code and then perform the import (step 9 and 10 on page 26 and 27) which will include the required classes. For your convenience hereby some coding for the Controller (methods 'wdDoInit' and 'getCompany').

    Hope this helps.

    Best regards,

    Arend

    ********************************************************

    public void wdDoInit()

      {

      //@@begin wdDoInit()

        Bapi_Companycode_Getdetail_Input input =

                new Bapi_Companycode_Getdetail_Input();

        wdContext.nodeBapi_Companycode_Getdetail_Input().bind(input);

        client = JCO.createClient("987",

                                              "user",

                                               "password",

                 "EN",

                                                "",

                                                "00");

       model = (AOtestBAPi) WDModelFactory.getModelInstance(

                             AOtestBAPi.class,

                              WDModelScopeType.APPLICATION_SCOPE);

                             model.setJcoClient(client);

        //@@end

      }

    //**********************************************

      public void getCompany( ) {

        //@@begin getCompany()

      client.connect();

      try {

       wdContext.currentBapi_Companycode_Getdetail_InputElement().modelObject().execute();

      }

      catch (Exception ex) {

       ex.printStackTrace();

      }

      finally {

       client.disconnect();

      }

      wdContext.nodeOutput().invalidate();

        //@@end

      }

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Steffen,

      it can be tricky sometimes with similar sounding method names, like _InputElement or _Input, model() or modelObject().

      You may have to carefully watch which methods to take for the call. The code completion functionality (press Strg and the space key at the same time when you enter the code) may be useful since it lists all the available methods. Watch out if two or more have similar names - it is easy to pick the wrong one.

      Greetings

      Ivo

  • avatar image
    Former Member
    Nov 17, 2003 at 05:39 PM

    You can even initialise the BAPI proxies in the View Class in the controller class

    Even this works well. V

    doInit() //method of the View class

    {

    // begin

        Bapi_Incominginvoice_Getlist_Input input = new Bapi_Incominginvoice_Getlist_Input();

        wdContext.nodeBapi_Incominginvoice_Getlist_Input().bind(input);

        Bapi_Incinv_Vendor_Ra vendor = new Bapi_Incinv_Vendor_Ra();

        wdContext.nodeVendor_Ra().bind(vendor);

        Bapi_Incinv_Doc_Date_Ra docdate = new Bapi_Incinv_Doc_Date_Ra();

        wdContext.nodeDocdate_Ra().bind(docdate);

    // end

    }

    Add comment
    10|10000 characters needed characters exceeded