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

Similar Messages

  • 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 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

  • How to call data from backend ECC system in Gateway Hub System?

    Hi Experts,
    We have a scenario where the GR process has to be done on Mobile app. We have a SMP 3.0 and Netweaver gayeway deployed as Hub.
    I really need quick pointers on how should we go about  this?
    My queries are mentioned below:
    1.I don't see SAP data in Gateway system.So will we need to create RFCs in ECC and call them in Gateway system.
    2. Will we need to install IW_BEP in backend system? Can someone explain its real purpose?
    3. How do we do our data modelling? How do i define it if I don't have my SAP data structures in Gateway system.
    Your guidance will really be appreciated.
    Regards,
    Saket.

    Hi sanket,
    Answering to your second question,
    IW_BEP Component is used to handle the events and actions activated in the SAP system and to publish these events and actions through SAP NetWeaver Gateway.
    The BEP functionality enables you to:
    Obtain and publish Business Object Repository (BOR) events without writing code. For example events raised as a result of changes in a business object: because of changes in a sales inventory, an event is raised and published to SAP NetWeaver Gateway.
    Obtain and send events for SAP Business Workflow, for example, an event is raised for a workflow user decision step.
    Obtain and send events from your code, for example, events raised as a result of implemented customer code, such as BAdI implementations.
    Read more about IW_BEP at:
    Business Enablement Provisioning (IW_BEP)
    https://help.sap.com/saphelp_gateway20sp08/helpdata/en/a2/15f0b42f2948f6bb9e51f98e8c39e9/content.htm
    Development with IW_BEP in SAP Netweaver Gateway
    https://help.sap.com/saphelp_gateway20sp05/helpdata/en/64/472d8e21a342ba9d83e403ff4cd9db/content.htm
    Hub Odata Channel without IW_BEP
    http://help.sap.com/saphelp_gateway20sp06/helpdata/en/32/5895449ac74783a3bd80a782c82f85/content.htm
    Regards,
    KK

  • 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.

  • 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

  • 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!

  • Calling Bapi from Dot Net

    Hi All,
    We are Trying to upload Bapi's From Dot Net.
    When we are uploading Sales Order upload i will get this error ""ERROR: Sales document type DG-1 is not defined"" ,But If i Call Again It is not giving the any error and simply its updating the SAP data base.Not only Sales Order upload but Customer Master upload also First time iam getting :"" Invalid form of address text"" This Error...After Second Exectuion I am getting Sucess Message.
    Why My Bapi Call is Not Sucess for First Call and why it is Getting sucess in Second Exection When i am calling bapi from .Net
    how can i solve my Problem?
    Thank you,
    Madhu
    Edited by: madhubabu rao on Oct 24, 2008 8:20 AM

    Hello,
           Refer to the below Thread & Link respectively.
    Re: Call BAPI WS from .NET
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/12f6d390-0201-0010-e18d-cdb4554a9e75
    Thought it might give you some inputs.
    Thanks and Regards,
    Venkat Phani Prasad Konduri

  • Any program for calling bapi from ABAP step by step

    any program for calling bapi from ABAP step by step
    points will be rewarded,
    thank you,
    Jagrut BharatKumar Shukla

    Hi Jagrut,
    BAPI stands for Business API(Application Program Interface).
    A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
    You can make your function module remotely enabled in attributes of Function module but
    A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
    BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
    The following standardized BAPIs are provided:
    Reading instances of SAP business objects
    GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.
    The BAPI GetList() is a class method.
    GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type
    The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.
    Create( ) and CreateFromData! ( )
    The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.
    Change( )
    The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.
    Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.
    The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.
    Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.
    Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.
    ex BAPI:
    API_SALESORDER_CREATEFROMDAT1
    BAPI_SALESORDER_CREATEFROMDAT2
    You can get good help form the following links,
    BAPI-step by step
    http://www.sapgenie.com/abap/bapi/example.htm
    list of all bapis
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    for BAPI's
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
    http://www.planetsap.com/Bapi_main_page.htm
    http://www.topxml.com/sap/sap_idoc_xml.asp
    http://www.sapdevelopment.co.uk/
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    Also refer to the following links..
    www.sappoint.com/abap/bapiintro.pdf
    www.sap-img.com/bapi.htm
    www.sap-img.com/abap/bapi-conventions.htm
    www.planetsap.com/Bapi_main_page.htm
    www.sapgenie.com/abap/bapi/index.htm
    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://sap-img.com/bapi.htm
    <b>EG::</b>
    <b>Here is the step by step procedure for creating BAPIs.</b>
    There are 5 different steps in BAPI.
    - Create BAPI Structure
    - Create BAPI Function Module or API Method.
    - Create BAPI object
    - Release BAPI Function Module.
    - Release BAPI object.
    Step1. Creating BAPI Structure:
    - Go to <SE11>.
    - Select Data Type & Enter a name.
    - Click on Create.
    - Note: Always BAPI should be in a development class with request number (Not Local Object).
    - Select Structure & hit ENTER.
    - Enter the fields from your database. Make sure that the first field is the Primary Key Field.
    - Then SAVE & ACTIVATE.
    Step 2. Creating BAPI module:
    - Enter TR.CODE <SE37>.
    - Before entering any thing, from the present screen that you are in, select the menu
    Goto -> Function Groups -> Create Group.
    Enter a name (Note: This name Must start with ZBAPI)
    Let this screen be as it is and open another window and there, enter TR.CODE <SE80).
    Click on the Third ICON that says Inactive Objects.
    Select the group that you just created and click on Activate.
    Notice that the group you created will disappear from the list of inactive objects.
    - Go back to ><SE37> screen and enter a name and hit <ENTER>. Then enter the group name that you just created and activated.
    NOTE: When you release a function module the respective group will be attached to that particular application. It cannot be used for any other application. NEVER include an already existing group that is attached to another module.
    Now click on the first Tab that says [ATTRIBUTES] and select the radio button that says remote-enabled module since we will be accessing this from any external system.
    Then click on the second tab that says [IMPORT].
    Enter a PARAMETER NAME, TYPE and the structure you created in the first step. Also select the check box ‘Pa’. All remotely enabled functional modules MUST be Pa enabled, where Pa means ‘Passed by Value’ and if you don’t select ‘Pa’, then that means it will be passed by reference..
    Then click on tab that says [EXPORT].
    Enter the following as is in the first three fields
    RETURN TYPE BAPIRETURN (These 3 field values are always same)
    Here also select ‘Pa’ meaning Pass by value.
    Note: BAPIRETURN contains structure with message fields.
    Then SAVE and ACTIVATE.
    Step 3. Creating BAPI object:
    - Enter Tr.Code <SWO1> (Note. It is letter ‘O’ and not Zero).
    - Enter a name and then click on create. Enter details.
    NOTE: Make sure that that Object Type and Program name are SAME.
    - Enter Application ‘M’, if you are using standard table Mara. If you are using your own database then select ‘Z’ at the bottom.
    - Then hit <ENTER>.
    - Now we have to add ‘Methods’. High light METHODS and then select the following from the menu:
    Goto Utilities -> API Methods -> Add Methods.
    - Enter function Module name and hit <ENTER>.
    - Select the second FORWARD ARROW button (>)to go to next step.
    - Check if every thing looks ok and again click on FORWARD ARROW button (>).
    - Then select ‘YES’ and click on <SAVE>.
    - Now on a different screen goto TR.CODE <SE37>. Enter Function Module name and select from the top menu Function Module -> Release -> Release.
    - Goback to TR.CODE <SWO1>.
    Here select the menu combination shown below in the same order.
    - Edit -> Change Release Status -> Object Type Component -> To Implemented.
    - Edit -> Change Release Status -> Object Type Component -> To Released.
    - Edit -> Change Release Status -> Object Type -> To Implemented.
    - Edit -> Change Release Status -> Object Type -> To Released.
    - Then click on <SAVE>.
    - Then click on Generate Button (4th button from left hand side looks like spinning wheel).
    - Then Click on the button that says ‘PROGRAM’ to see the source code.
    To check if this is present in work flow goto TR.CODE <BAPI>.
    Here it shows business object repository.
    - First click on the middle button and then select “ALL” and hit ENTER.
    - Goto tab [ALPHABETICAL] and look for the object that you created. This shows that the BAPI object has been created successfully
    <b>Reward pts if found usefull :)</b>
    regards
    Sathish

  • Related documents or links on how to call webservices from WDJ

    Hi all
    i need documents & links on how to call webservices from Webdynpro for Java.
    if anybody send the documents on sample scenarios on the same then it is the great help to me...
    Thanks
    Sunil

    Hi Sunil,
    May these links help you.
    http://help.sap.com/saphelp_nw04/helpdata/en/f7/f289c67c759a41b570890c62a03519/frameset.htm
    http://help.sap.com/saphelp_nwce10/helpdata/en/64/0e0ffd314e44a593ec8b885a753d30/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/d2/0357425e060d53e10000000a155106/frameset.htm
    and  the below thread to call weservices in java.
    Re: How to call a web service from Java
    Regards,
    Supraja

  • How 2 call BAPI & pass table name so that it will insert table data 2 SAP

    Hi guys,
    Has anyone tried calling BAPI from BODS; Please share screen shots and details. I want to call BAPI fron BODS which will take table name as a parameter and insert that table data to SAP.

    HI,
    in case you mean BusinessObjects Data Services with BODS then I would suggest you post your question into the EIM area of the SDN forums.
    Ingo

  • How to add error message to return structure of calling BAPI from a BADI

    i have a bapi where a badi is triggered.this badi method has just importing and changing parameters.is there any way with which i can add error message to the return structure of calling bapi.please reply at the earliest.High points can be expected.

    thanks got it

  • How to call infotypes from webdynpro applications

    Hi friends
    My requirement is, I need to call infotypes in r/3 system. Exact requirement is I got a dropdown, which gets the data from infotype, I got a textview which also gets the the data from other infotype.My question how to call  these infotypes. Is this is the same way like importing bapis or different. Please let me know the detail procedure, and any doccuemnts mail me to [email protected]
    Regards
    keerthi

    Hello Keerthi,
    it is no special way to call infotypes, you have to find a Bapi which return data you want (or part of this thata). When there is no Bapi which fill your requirements (or you must call to much bapis) i think you should write your own bapi. Last step is using this (own or found) in wdp.
    Regards
    Bogdan

  • How to call infotypes from webdynpro application

    Hi friends
    My requirement is, I need to call infotypes in r/3 system. Exact requirement is I got a dropdown, which gets the data from infotype, I got a textview which also gets the the data from other infotype.My question how to call these infotypes. Is this is the same way like importing bapis or different. Please let me know the detail procedure, and any doccuemnts mail me to [email protected]
    Regards
    keerthi

    For reading HR infotypes you have to do the following
    a. Create a Remote enabled function module (FM) in the HR syste. This FM shall wrap the standard FM HR_READ_INFOTYPE.
    b. Create a Model in your webdynpro project for the FM you developed in step a.
    Thanks and Regards,
    Prasanna Krishnamurthy

  • How to call methods from within run()

    Seems like this must be a common question, but I cannot for the life of me, find the appropriate topic. So apologies ahead of time if this is a repeat.
    I have code like the following:
    public class MainClass implements Runnable {
    public static void main(String args[]) {
    Thread t = new Thread(new MainClass());
    t.start();
    public void run() {
    if (condition)
    doSomethingIntensive();
    else
    doSomethingElseIntensive();
    System.out.println("I want this to print ONLY AFTER the method call finishes, but I'm printed before either 'Intensive' method call completes.");
    private void doSomethingIntensive() {
    System.out.println("I'm never printed because run() ends before execution gets here.");
    return;
    private void doSomethingElseIntensive() {
    System.out.println("I'm never printed because run() ends before execution gets here.");
    return;
    }Question: how do you call methods from within run() and still have it be sequential execution? It seems that a method call within run() creates a new thread just for the method. BUT, this isn't true, because the Thread.currentThread().getName() names are the same instead run() and the "intensive" methods. So, it's not like I can pause one until the method completes because they're the same thread! (I've tried this.)
    So, moral of the story, is there no breaking down a thread's execution into methods? Does all your thread code have to be within the run() method, even if it's 1000 lines? Seems like this wouldn't be the case, but can't get it to work otherwise.
    Thanks all!!!

    I (think I) understand the basics.. what I'm confused
    about is whether the methods are synced on the class
    type or a class instance?The short answer is; the instance for non-static methods, and the class for static methods, although it would be more accurate to say against the instance of the Class for static methods.
    The locking associated with the "sychronized" keyword is all based around an entity called a "monitor". Whenever a thread wants to enter a synchronized method or block, if it doesn't already "own" the monitor, it will try to take it. If the monitor is owned by another thread, then the current thread will block until the other thread releases the monitor. Once the synchronized block is complete, the monitor is released by the thread that owns it.
    So your question boils down to; where does this monitor come from? Every instance of every Object has a monitor associated with it, and any synchronized method or synchonized block is going to take the monitor associated with the instance. The following:
      synchronized void myMethod() {...is equivalent to:
      void myMethod() {
        synchronized(this) {
      ...Keep in mind, though, that every Class has an instance too. You can call "this.getClass()" to get that instance, or you can get the instance for a specific class, say String, with "String.class". Whenever you declare a static method as synchronized, or put a synchronized block inside a static method, the monitor taken will be the one associated with the instance of the class in which the method was declared. In other words this:
      public class Foo {
        synchronized static void myMethod() {...is equivalent to:
      public class Foo{
        static void myMethod() {
          synchronized(Foo.class) {...The problem here is that the instance of the Foo class is being locked. If we declare a subclass of Foo, and then declare a synchronized static method in the subclass, it will lock on the subclass and not on Foo. This is OK, but you have to be aware of it. If you try to declare a static resource of some sort inside Foo, it's best to make it private instead of protected, because subclasses can't really lock on the parent class (well, at least, not without doing something ugly like "synchronized(Foo.class)", which isn't terribly maintainable).
    Doing something like "synchronized(this.getClass())" is a really bad idea. Each subclass is going to take a different monitor, so you can have as many threads in your synchronized block as you have subclasses, and I can't think of a time I'd want that.
    There's also another, equivalent aproach you can take, if this makes more sense to you:
      static final Object lock = new Object();
      void myMethod() {
        synchronized(lock) {
          // Stuff in here is synchronized against the lock's monitor
      }This will take the monitor of the instance referenced by "lock". Since lock is a static variable, only one thread at a time will be able to get into myMethod(), even if the threads are calling into different instances.

Maybe you are looking for

  • I no longer have App Store on my iPhone 5 - where do I go to download it?

    I no longer have the App Store on my iPhone 5 - where do I go to download it? Help!!!

  • I have a question about socket

    I've got a socket question that haven't to work out for two days . If you know something about this question please give me a hand , Thank you ............. =================================================== I want to write a program about PortMappi

  • Question in RSA5

    Hi all, It may be simple questions for you but they bother me a while. Please help. --Do I HAVE TO press 'select delta' before I transfer datasource by clicking 'transfer datasource' in RSA5? --I transfer  application hierarchy AFTER I transfer busin

  • Cannot create JVM message box in WLS 92 admin console

    Hi, I want to open a new windows process from weblogic admin console. I wanted to know if there is a way to launch a jvm from console. If I use Runtime.getRuntime().exec(cmd), cmd is a javaw command, in my console extension, I get "cannot create JVM"

  • Jdbc to multi idocs

    After a message is sent to xi through sender jdbc adapter, I need to map this message to several idocs according to the key value of the rows in message. For example, the following message should be mapped to two idocs as we have two different key va