Events in Bapi

Hello,
How do Handle the "Events in Bapi "?
Where do we write the code to trigger the Events ?
Please explain me clearly.
Thanks in Advance.

Hi,
The Event inside the BAPI (Business Object) can be called by following Function Module:
CALL FUNCTION 'SWE_EVENT_CREATE'
  EXPORTING
    objtype                       = 'ZWOCONT'                   " Business Object Name
    objkey                        = v_objkey                        " Document Number  i.e. Input Parameter
    event                         = 'ZWEMODIFIED'              " Event Name in the BAPI to be called
EXCEPTIONS
   OBJTYPE_NOT_FOUND             = 1
   OTHERS                        = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Rgds,
Ramani N

Similar Messages

  • Portal Eventing calls BAPI  -  result FAILURE!

    Hi All,
    I have an interesting delima.
    BAPI_SALESORDER_GETSTATUS - using portal eventing to set "Salesdocument" model/mapped context value. When executing Bapi, no results display in my table (mapped to the output values).
    In further testing, I added an InputField that was mapped to "Salesdocument" to see that it was being set properly before the Bapi execution. That worked so I could see that portal eventing was working correctly. Still no results though.
    When I changed the "onEnter" event of the InputField to use my method that executes the Bapi, then the results showed up just fine. It appears that somehow the results only display if a InputField submits the value it is looking for.
    Any ideas on how to get the results to display? I thought maybe it had to do with the data type, but the context only asks for a string value.
    Max reward points for the person(s) who help me the most.
    Much Thanks,
    Cameron

    Hi Cameron,
    If I understand you correctly, the parameter <i>dataObject</i> in the action handler <b>onActionGetSalesDocument</b>
    refers the value the you want to pass to the Import parameter <i>SALESDOCUMENT</i>.
    If yes, then try doing the following two modifications.
    Define a new parameter <i>dataObject</i> of type <i>String</i> for the method <i>execute_Bapi_Status_Details_GetList</i>
    Change the action handler onActionGetSalesDocument as follows.
    public void onActionGetSalesDocument(IWDCustomEvent wdEvent, String dataObject)
      wdContext.currentContextElement().setSalesDoc(dataObject);
      wdThis.wdGetStatusDetailComponentController()
    .execute_Bapi_Status_Details_GetList(dataObject);
      wdThis.wdFirePlugToDetailView();
    Add a line of code to the execute_Bapi_Details_Getlist as follows:
    public void execute_Bapi_Status_Details_GetList(String dataObject){
    try{
          <b>wdContext.currentStatusDetailsModelElement()
    .setSalesDocument(dataObject);</b> 
        wdContext.currentStatusDetailsModelElement()
    .modelObject().execute();
          <b>wdContext.nodeOutput().invalidate();</b> 
    }catch(Exception e){
          <b>wdComponentAPI.getMessageManager.raiseException(e.getMessage(), true);</b>
    Bala

  • BAPI - Methods and Events

    Hi Experts,
    Can you tell me know what is the difference between Methods and Events in BAPI?
    Regards
    Dinesh

    Hi,
    Events are triggered if a user triggers some action...
    Methods are similar to FM where you write your logic to be followed...
    Also go through this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/71/a8a77955bc11d194aa0000e8353423/frameset.htm
    http://www.erpgenie.com/abaptips/content/view/481/62/
    http://help.sap.com/saphelp_nw04/helpdata/en/4c/4c0e99725311d396a80004ac96334b/frameset.htm

  • BAPI  STRUCTRE

    HI,
    I am samba, new for bapi consept; please help me on bapi. what is line structure. why we are not use line structure in bapi, and why bapi does not taken the same structures used in existing applications.
        And explain about key field and event in bapi, what we will do on events and where we will write the code for this event, what happen by this event and key field.
    Please explain clearly..
    Thanks
    Samba

    Hi,
    go through the below links
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://help.sap.com/saphelp_46c/helpdata/en/a5/3ec8464ac011d1894e0000e829fbbd/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm
    Regards,
    Nagaraj

  • How do I Create Business Events ala PSV1

    I can get business events using SAP standard bapis such as RH_GET_PLVAR and RH_GET_EVENT_DATES. I then pass these to a web app for display. What I need to do is to also edit those events and create new events using bapis. This is the same thing you could do using PSV1. But, of course, I will need to do it through bapi calls.
    I have had no luck finding out what bapis I need to use to do this. Can anyone help me out? Thanks!

    Pages is mostly for making documents , but there is a great app in the app store called business card design , it let's you create and print business cards .

  • Diffrence between RFC & BAPI

    hi good morning all ,
    please tell me the exact diffrence between RFC & BAPI  .
    thanks in advance .
    regards ,
    srinivas

    Hi,
    1)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 ( ) and Remove ( ) The BAPI Add adds a
    subobject to an existing object inst! ance and the BAPI and
    Remove removes a subobject from an object instance. These BAPIs
    are instance methods.
    2) No it is not possible to connect SAP to Non-SAP systems to retrieve data
    using RFC alone. RFC can acces the SAP from outside only through BAPI and
    same is for vice versa access.
    3) Each Bapi Object has Interface, Key Fields, Attributes,Methods and
    Events.
    Bapi Function Modules can be attached to these Bapi objects .Function module
    has a single bound functionality while a BAPI object can contain many
    functionalities
    Rgds
    Yogesh

  • How to fing out the details of PO item befor replicating to the back end.

    Hi SRM Guru
    We are working on the SRM 4.0 and extended classic scenario.
    I want to see all the details which are send to the back end for creation of the purchase Order.
    I will specify the steps I follow.
    Create the SC( waiting for approval ) , Approver approves the SC then SC will be created in SRM and the replicated in the Back end .
         I have tried to find out this through the external debugging
    I have set the break points @ BBP_DOC_SAVE_BADI and BBP_DOC_CHANGE_BADI, CL_HANDLER ( Methods ), but I am not able to reach the point to the PO creation in SRM and its replication in the back end.
    1     Does any one tell me the sequence of the badiu2019s coming?
    2     How the PO gets replicated in the back end ?
         which bapi(BAPI CREATEPO) is called ?
         After which event this bapi  called ?
         Which data is passed for the creation of PO ?
    3     where I will get the information on the structures/internal tables which are getting      populated during the debugging.
    With Regards
    DSS

    U mean u want to know at runtime?
    Get the output from ur proxy as a string, count the number of "<" characters and divide it by 2. :-P
    Of course, you'll have to treat the header fields separately.
    Regards,
    Henrique.

  • CRM_ORDER_MAINTAIN, CRM_ORDER_READ

    AS I am new to CRM I have simple doubt  CRM_ORDER_MAINTAIN, CRM_ORDER_READ are function modules or  BAPI's.
    I know all BAPI 's are REMOTE enabled Function Modules.
    In which situations we will use RFC and in which situation we will use BAPI's
    Thanks,
    vis

    Hey Vis ,
    Each Bapi Object has  Interface, Key Fields, Attributes,Methods and Events.  Bapi Function Modules can be attached to these Bapi objects .Function module has a single bound functionality  while a BAPI object can contain many functionalities.
    So as far as possible try to use BAPI's if available. If you want to call the FM in R3 from any other system say CRM or SRM, in that case you need to use RFC.
    Hope this will help to you.
    Regards,
    Nikhil

  • Update DFKKOP in during FPCOPARA

    Hi experts,
    1) I am printing an Invoice thru FPCOPARA and needs to update some custome fields in DFKKOP table. can you please let me know which event or BAPI in need to call for updating the custom fields.
    2) After creating the invoice - thru application form (smartform), i need to covert it into XML and send it to legacy system. Can you please tell me the steps for this too.
    Thanks,
    Govind Parmar

    Hi Govind,
    As mentioned, you are using SMARTFORMS, for the application form type. So, there is an output option provided for the smartform, XSF (XML for Smartforms), that would give the XML format output.
    So, when you are running the FPCOPARA tcode, for the print parameter select the output type as XSF format, and for the spool that are generate you should be able to get the XSF format output.
    Also, for updating the DFKKOP table during printing, you need to handle the same in the User Exit for the application form. For DFKKOP, you can use FM 'BAPI_CTRACDOCUMENT_CHANGE' to change the document as already mentioned above.
    Hope this helps!!
    Regards,
    Rajesh Popat

  • Problem using BAPI_CTRACCONTRACTACCOUNT_CR1

    Hi!
    We need to create Contract Accounts using BAPI_CTRACCONTRACTACCOUNT_CR1. We set all the required parameters but always recieve two erros on the RETURN table:
    - Enter a value in field Account Determ. ID
    - Enter a value in field Payment Terms
    We searched all the fields of all BAPI parameters and we can't find those two. Can anyone help us with this?
    Kind regards,
      Mário Espinheira

    Hi Mário Espinheira,
    You could use event 9501 to fill the fields (Account Determination ID and
    payment Terms). These fields are part of structure FKKVKP_S_DI Contract Account: BP-Specific Data (Direct Input):
    INCLUDE SI_FKKVKPS_DI  FI-CA Extended: Contract Account Direct Inpu
    KOFIZ_SC      Account Determination ID
    ZAHLKOND_SC   Payment Terms
    There is also another possibility to supply the fields via BAPI interface:
    You can fill additional the customer enhancements table:
    'EXTENSIONIN' with structure BAPI_TE_FKKVKPI togehter with the data.
    STRUCTURE                      VALUEPART1
    BAPI_TE_FKKVKPI             *enter value for KOFIZ & Payment Terms
                                                with leading 0's
    About how to enable this event 9501->
    You can start SPRO:Contract Accounts Receivable and Payable
    -> Program Enhancements-> Define Customer-Specific Function Modules Or you just call transaction code FQEVENTS.Then select event 9501 BAPI: Create Contract Account. Within the tab function modules you can enter a customer function module. Please click in the pen on Installation-specific Function Modules.
    Hope the above infor. are useful to you!
    Best Regards,
    Gladys xing

  • "Customer" BAPI in Distribution Model for Training and Events

    We have an HR box with Training and Events - When booking an attendee on a course, you can select the "contact person" tab. Our SD box is separate from HR, so all the contact persons are maintained there. Is it possible to use the "Customer" BAPI in a distribution model so that when we search in the HR box for a contact person, it actually fetches the data from the SD box?
    I remember reading up on this a while back but I can't find the documentation I had back then...
    I know that in BD64 I can create a distribution model, and if I remember correctly, i should be able to "Add BAPI" and use object type "Customer" - Then add all the methods that I need... (like Find, List, Search etc) In essence, once this model has been distributed to the other system, if I go to transaction XD03 in the HR box, I should be able to display customer master details that only exist on the SD box - Is that correct?
    Please help as I am not able to get this to work...

    Ok I figured it out...
    I have created a distribution model with the HR system as the source, and the SD system as the target.
    In change mode, click the "Add BAPI" button and choose object BusPartnerEmployee, method CheckExistence
    Do the same for the following:
    BusPartnerEmployee.Display
    BusPartnerEmployee.GetList
    Customer.CheckExistence
    Customer.Display
    Customer.ExistenceCheck
    Customer.Find
    Customer.GetContactList
    Customer.GetDetail2
    Customer.GetInternalNumber
    Customer.GetList
    Customer.GetSalesAreas
    Customer.Search1
    Ok so I know that this might be a little over-kill, especially all the Customer methods that I added, but it works

  • BUFFER_REFRESH when using "BAPI technology" in SAP event exits

    We wrote some custom function modules which are similar to the BAPI technology to maintain custom data tables.
    Let's say we have
    a function Z_DATA_CREATE,
    a function Z_DATA_CHANGE and
    a function Z_DATA_READ.
    These function modules are RFC functions which can be called from outside SAP and have to reflect the transactional mechanism. That means that the caller can call any of these functions in an arbitrary sequence and has to control the commit or rollback.
    E.g.
    Step 1 : call function Z_DATA_CREATE
    Step 2 : some external logic
    Step 3 : call function Z_DATA_CHANGE
    Step 4 : call function Z_DATA_CREATE
    Step 5 : ...
    Step 6 : call function Z_DATA_READ
    Step X : call function BAPI_TRANSACTION_COMMIT
    The data will not be written to the database until the COMMIT statement is called. Therefore all manipulated data are stored in the global memory of the function module in the meanwhile. The functions first check if there is data in the memory (prepared for SAVING) before they check the database tables. Essential for the data integrity in this model is that the memory is being refreshed when the COMMIT or ROLLBACK is fired. With BAPIs this is done by subscribing the delete functions which are called by the BUFFER_REFRESH_ALL function. BUFFER_REFRESH_ALL is called in the BAPI_TRANSACTION_COMMIT or rather BAPI_TRANSACTION_ROLLBACK function. So this works fine.
    Now we want to use our function modules (Z_DATA_* ) in user exits of SAP standard processes. For example in event exits (transaction FQEVENTS ). I assume that these SAP programs only fire a COMMIT without calling the BUFFER_REFRESH_ALL .
    But we have to ensure that the memory (the global data of the function modules) is being refreshed after a commit.
    Do you have any idea how I could do this???
    Thanks for your help!

    Thanks Sharad,
    your ideas helped me to find a possible solution (at least for the case that  I don't use SET UPDATE TASK LOCAL).
    I do the buffer refresh in a form which I call on commit (dialog process). As the update task works in a separate context and doe not access the dialog buffer anymore, it doesn't matter when the refresh is called after the COMMIT has been fired.
    I'm not sure if your second suggestion would work as you don't have access to the same context data in the update task. Typically the buffer data are in the dialog context which is separated from the data in update task. So the REFRESH must take place during the dialog process.
    Thanks a lot for your contribution!

  • FM or BAPI for Time Events Calculation

    Hi Experts,
        Is there any standard BAPI or FM that calculates time events and get total working hours?

    Hi,
    Function Modules for Time Events
    HR_BALANCE_TIMES_AGAINST_DWS
    HR_CUT_TIMES_WITH_DWS
    HR_TIME_AND_DURATION
    HR_CC1_TIMEEVENT_GETDETAIL
    HR_CC1_TIMEEVENT_INSERT
    HR_CC1_TIMEEVENT_POST
    HR_TIME_EVALUATION

  • How to handle the events of business object (BAPI)

    Hi,
    How to register to BAPI event and handle?
    For example, for a business object 'inv', there is an event as 'created'.
    I want to insert entry in a z table when an inv is created.
    I assume that the 'created' event is triggered when an inv is created.
    How i can register to that event and handle that event so that i can
    insert an entry in z table.
    Thanks,
    Prasad

    ComponentListener?
    : jay

  • Function or BAPI for Resource Detail Selection on Bussiness Event

    Hello,
    I want to do a initial data load of Business Events (TEM). I need to load its resources in a detail form (dates and hours when resource is used by this business event). Does anybody knows any BAPI, function or class that load data in this detail form?.
    I just want to replicated how works PSV2 (or PV10) transaction when you push the resource selection button, select the resource type and a detailed selection but as funtion or BAPI.
    Regards,

    HI Zafar,
    How did you resolve this issue??
    We are working on the same issue, could you please share the possible solution with us.
    Thanks,
    Adi.

Maybe you are looking for