How to Call BAPI From the Custom Controller

Hi
I developed frist WD Application Using RFC Adapter.
i did the following steps
1. created the project
2. created the model.
3. created the customer controller and mapped the model of the controller to the model.
4. mapped controller context to the views
5. created one action in the start view
6. created one method in the customer controller.
so please let me know the lines of code to call BAPI using RFC.
and  how to pass input valus to the bapi and how to execute the BAPI
plese send the reply ASAP
regards
mmukesh

Hi
i did like this
In  Start View OnActionSearch () method code
public void onActionsearch (com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
       wdThis.wdGetTestCustControllerController().executeGetlistBapi();
in CustomController Init method
public void wdDoInit()
    Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();
    wdContext.nodeBapi_FlightGetlist_Input().bind(input);
    input.setDestination_From(new Bapisfldst());
    input.setDestination_To(new Bapisfldst());
In CUSTOMECONTROLLER executeGetlistBapi();
METHOD
public void executeGetlistBapi( )
    //@@begin executeGetlistBapi()
    try{
       wdContext.currentBapi_FlightGetlist_InputElement().modelObject().execute();
       wdContext.nodeOutput().invalidate();
    }catch(Exception ex){
       ex.printStackTrace();
Then let me know what is wrong in this
i did as per pdf
please correct if there is any worng in this code.
this is flight example .
regards
mmukesh

Similar Messages

  • How to call BAPI from R/3 system

    hi,
    i am doing small application by using Model. that is calling BAPI from R/3 system. but i am not able to get data from the back end system. please suggest me regarding this problem
    thanx
    tanvi

    steps:
    1) create Model
    2) bind Model to component controller ( you can use data modeler.) 2.1) open data modeler; if your model is not there, you can add by clicking add existing model;
    2.2) create data link between model and controller, it will open map dialog.
    2.3) click and drag BAPI_xxx_Input to context of controller and select all nodes inside
      - if there is any duplicate nodes, just rename it.
    3) map context to view controller
    3.1) map input parameters separately ( which takes value for IMPORT to BAPI. select only that fields
    3.2) do map for output (exact node which contains BAPI output)
    coding:
    1) in component controller you need to instantiate model and bind to context
    BAPI_xxx_Input my_input = new BAPI_xxx_input();
    wdContext.nodeBAPI_xxx_Input my_input().bind( my_input);
    2) create a method in the component controller so that we can execute it from any of views used.
    try{
      wdContext.currentBAPI_xxx_Input my_input().modelObject().execute();
    }catch(WDRFCException e) {
    e.printStackTrace();
    wdContext.node<ExactOutput>().invalidate();
    // this stmt will reflect new values
    3) Go to view and bind values to UI Elements
    in wdDoInit()
    IPrivate<Comp_Name>View.I<ExactOutput>Element  input = wdContext.create<BAPI_xxx_Input>Element();
    // see if this may demand model instance as parameter
    wdContext.node<BAPI_xxx_Input>().addElement( input);
    4) In OnAction you just executes the component controller method
    wdThis.wdGet<Com_Name>Controller().executeMyBapi();
    // executeMyBapi() is the method contains the mentioned try..catch code
    nikhiL

  • How to call BAPI from ABAP Inbound Proxy

    Hi All
    Can some one provide/giude  a sample code on how to call a BAPI from generated Method (Inbound Proxy) and how are the table parameters passed from Proxy to BAPI.
    Thanks
    Ravi/

    Hello Ravi,
    In the proxy before calling the BAPI, construct the table, fill it with the appropiate values by lopping over the proxy request object. Now use this table for calling BAPI
    Cheers,
    Naveen

  • How to call function from a custom module in a grid?

    I have a module with an advanced data grid in it. One of the columns of this grid has an itemRenderer="myCustom"
    MyCustom is a separate MXML Module. In this module, I have defined a vBox with 2 buttons. In the click event of the button how can I call a custom function that is defined in the parent module? click="myCustomFuction()" doesn't work and I get an 1180 warning . I'm thinking something like click="this.parent.myCustomFunction()" but I don't know the proper syntax.

    I tried your suggestion, but it's not working. Can you figure out what I'm doing wrong?
    <mx:Button name="bLotView" label="View" click="Object(this.owner).MyCustomFunction()"
    This button is contained in a VBox which is contained in it's own module: MyVBox
    In the "parent" MyGrid module I have an AdvancedDataGrid and one of the columns of this grid uses ItemRender="MyVBox"
    If I place a button in the parent MyGrid module (not in the grid), and set it's click to MyCustomFunction() then the function fires. But the function never fires from the MyVBox module's button click which is contained in the grid.
    Does Object(this.owner) refer to the owning module or the owning control? If it refers to the owning control, wouldn't this point to the VBox in the same module, not the owning module? Would I have to do something like Object(this.owner.owner.owner).MyCustomFunction()  ??

  • Call BAPI from ITS

    hi all,
    i'm wondering to know about how to call BAPI from ITS. Could I call BAPI from ITS? if yes, please advise me on this.
    Thank you so much for your effort.
    Peerasit

    Not solve yet.
    Thank you.

  • Calling RFC from view/component controller

    I've got a model node in the component controller's context which is mapped to a node in a view controller. Now, when binding the model's input node with an array and executing the RFC from within an event handler in the view controller, everything goes just fine.
    Now, I want to put this functionality in the component controller, so I created a method there, copied the code and call it from the view controller's event handler. When the RFC is called, the input table always contains just 1 element, of which the fields are all initial.
    Any thoughts on what might be going on here?

    Hi friend,
    I too faced the problem what you faced.
    Near to it.
    Ill explain you .
    YOu have your model node.
    1st you will map that to component controller And from there to view controller.
    After that you will bind the elements in this node to some elements in your view after that .
    For example
    Model class name:-Lok_model.
    In the DOINIT method:-
    write this code.
         Lok_model k = new Lok_model();          wdContext.nodeLok_model().bind(k);
    Suppose you have a button in the onaction you write this code.
    wdContext.nodeLok_model().currentLok_modelElement().modelObject().get_details();
    Ill expalin you about this statement Lok_model() is the node in my view which is mapped from the model and by using that i am calling the method get_details() which is in my model class Lok_model.By this data will be automatically populated into the view elements which are being binded to the model attributes.
    Hope this helps you,
    Lokesh

  • How to read the details in the context node of the custom controller

    Hi friends,
        My requirement is i enhanced the component ICCMP_BP_DETAILS , now on EH_ONSAVE i want to read the details of the Context node in the Custom COntroller .
    In custom controller from ICCMP_BP_DETAIL/CuCoBPDuplicate  From this in context node CUSTOMER is there in that attributes first name last name is there i want to read those details
    so can u pls provide the logic for this how can i get the values.
      am very new to the BSP programming
    Regards
    Yogesh

    Hi Suchitha,
    when i am following the above code the lr_entity is not Bound, so can u pls suggest is there any thing is missing
    i used the below mention code but lr_entity is not bound
    DATA: lr_cuco type ref to CL_ICCMP_BP_CUCOBPDUPLICA_IMPL.
                lr_entity type ref to cl_crm_bol_entity.
    lr_cuco ?= me->get_custom_controller( 'ICCMP_BP_DETAIL/CuCoBPDuplicate') .
    CHECK lr_cuco IS BOUND.
    lr_entity ?= lr_cuco->typed_context->customer->collection_wrapper->get_current( ) .
    CHECK lr_entity IS BOUND .
    lr_entityIF_BOL_BO_PROPERTY_ACCESSGET_PROPERTY_AS_VALUE( iv_attibute =  'FIRST_NAME' ev_attribute = lv_firstname ) .
    Please correct the code if any thing is missing
    Regards,
    Yogesh

  • Calling web Service from the Custom Adapter.Is it Possible?

    Hi Experts,
                    I am having requirment in which i have to cal com.sap.aii.mapping.lookup.LookupService for calling web Service from the Custom Adapter.Is it Possible?
    Regards,
    Rajesh.D

    Hi Rajesh..
    Just looking the problem in another angle.. if there is no constraint that you have to use XI specific API to call the web service, why dont you use usual Java API used for calling a web service inside you custom adapter (I have Microsoft background.. donno exactly how it is done in Java,, but in .NET kind of a language it is possible). SInce your adapter is in Java itself and is capable of calling web service.. collect or lookup the data whatever you want and validate...
    Just a thought..
    VJ

  • How to call & pass values to custom page from seeded page table region

    Hi All,
    can anyone tell me how to call & pass values to custom page from seeded page table region(Attribute is not available in seeded page VO)
    it is urgent. plssss
    Regards,
    purna

    Hi,
    Yes, we do this by extending controller, but you can also try this without extending controller.
    1. Create Submit Button on TableRN using personalization.
    2. Set "Destination URI" property to like below
    OA.jsp?page=/<yourname>/oracle/apps/ak/employee/webui/EmpDetailsPG&employeeNumber={@EmployeeId}&employeeName={@EmployeeName}&retainAM=Y&addBreadCrumb=Y
    Give your custom page path instead of EmpDetailsPG.
    EmployeeId and EmployeeName are VO attributes(Table Region)
    If you dont have desired attribute in VO, then write logic in your custom page controller to get required value using parameters passed from URL path.
    In this case, only personalization will do our job. Hope it helps.
    Thanks,
    Venkat Y.

  • Call the BAPI from the program..

    Hey guys,
    can we  call the BAPI from the program..
    if yes how can  we  can show sales orders being loaded..
    thanks its urgent

    Nishant,
    yes easily you can call bapi from program.
    for getting all sales order use:
    BAPI_SALESORDER_GETLIST
    also am providing a program so that you can see how bapi has to call in program.
    CALL FUNCTION 'BAPI_SALESORDER_GETLIST'
                 EXPORTING
                      customer_number    = lf_customernumber
                      sales_organization = if_sales_organization
                      document_date      = lf_document_date_from
                      document_date_to   = lf_document_date_to
    *              PURCHASE_ORDER     = IF_PURCH_ORDER
                      material           = lf_matno
                 IMPORTING
                      return             = ls_return
                 TABLES
                      sales_orders       = sales_orders.
    Am afraid to say you that above solution you get about bapi it is not for showing the list of SO these are for creating SO.
    Edited by: Amit Gujargoud on Jul 3, 2008 3:12 PM

  • How do I delete more than 1 slide at a time from the custom slide show in Elements 8

    How do I Delete more than 1 slide at a time from the custom slide show in Elements 8?

    How to Mass Delete Emails from iPhone and iPad Inbox (with video)
    http://suiteminute.com/how-to-mass-delete-emails-from-iphone-and-ipad-inbox/
     Cheers, Tom

  • Calling a method in the view controller from the component controller

    Hi
    Is there anyway to call a method in the view implementation from the component controller??
    Thanks
    jack

    Thanks for all your replies. I want this kind of a functionality because Im trying to invove a DC (Child DC) from a Parent DC such that the Child DC's view is displayed onto the view container of the Parent DC. I have embedded using 'interface view of a component instance' in the Parent Window and am able to create the component and set usage though the onPlugDefault of the Child View.
    But I observe that when i make a call from the parent, the flow is like this:
    1. The wdDoInit of the Child Component Controller gets triggered first.
    2. Then the wdDoInit of the Child's <b>VIEW</b> gets triggered
    3. and <b>THEN</b> the onPlugDefault of the Child Component Interface View
    What I had actually wanted was to Fire onPlugDefault where Im calling a method LoadData(), after which the Child DC's view must be triggered so it can display the fetched data.
    What is actually happening is the view gets displayed, but no data is displayed in the view.
    Right now I have just given a work around where Im triggering <b>LoadData()</b> of the <b>COmponent COntroller</b> from the <b>wdDoInit</b> of the <b>VIEW</b>.
    Is there a better way to do this? I find it strange that I have to load the Data from the view.
    Thanks
    Jack

  • From rfc how to call bapi

    Hi
    How to call BAPI FM's from RFC ??
    thanks
    kumar

    Hi Palnati,
                      Use statement  :
                      Call FUNCTION     'Bapi................'
                       DESTINATION     Dest(RFC destination in TCODE SM59)
                         EXPORTING      f1 = …
                                                    f2 = …
                         IMPORTING      f3  = …
                         TABLES            T1 = …
                         EXCEPTIONS ……….
    Reward points if helpful.
    Regards,
    Hemant

  • How can I remove the Emergency Call button from the lock screen Xperia Z2

    How can I remove the Emergency Call button from the lock screen on my Z2 phone

    Alecuk wrote:
     It's like the stupid bold font on the hours or the lock screen clock - i've never seen anything so stupid in all my life.
    it's things like this that make a good phone c.r.a.p.
    Hi, well if you do a little bit of research on the forum you will be able to see that you can & very easily able to change the font on the clock 

  • Can we call bapi from SAP or ABAP How? Pls Step by step

    Can we call bapi from SAP How? Pls Step by step
    thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Hi,
    Do you mean you want to access BAPI in ABAP report?
    If yes, then YES we can call,
    1.Create a report -> In pattern write your BAPI name.
    2. It is like your FM , Read correspoding BAPI documentation
    3. Fill required parametes.
    4. Test run and if successful , final run it.
    And from Outside,
    You have to establish a connection and create a wrapper and access using avaialble APIs.
    Reward if useful!

Maybe you are looking for

  • Enhancing the data request in Agent inbox

    Hi , I have a requirement to add more custom fields to search view in Agent inbox and perform the search based on custom field values entered on screen by user. I have added append structure to CRMST_AUINBOX_SEARCH with custom fields and in BSP_WD_WO

  • Pictures not in camera roll

    I recently updated to the iOs 5 on my ipod touch.  I like the new feature that allows you to quickly get to the camera without unlocking the ipod.  However the pictures and videos I took that way can't be found.  Where did they go? 

  • IPod 5G isn't always playing songs without gaps

    I've found that a couple of my albums (encoded in Lame) refuse to play gapless on my iPod even though it plays fine in iTunes. Converting the MP3s to ALAC/AAC both create files which are gapless on the iPod but the original MP3s still won't play righ

  • MOVED: MSI TECHNICAL - URGENTLY NEED NEW BIOS FOR DIAMOND PLUS MOBO

    This topic has been moved to BIOS. https://forum-en.msi.com/index.php?topic=93688.0

  • ValidateData.js file location in version 11.1.2

    Does anybody know where the physical location is for the ValidateData.js file in version 11.1.2? The hp_admin.pdf refers to the /default web application directory/Planning/web/WEB-INF. However, I have not been able to locate the directory. I am using