Commit work in FQevents in FICA(PERFORM commitroutine ON COMMIT )

Hello Experts,
i am trying to create an event to trigger a workflow using function module swe_event_create.
i am doing this in an FICA event 5500 after triggering this workflow i need to stop the further processing so i am using Error message statement.
when i am calling swe_event_create without commit work the event is not getting triggered .
when i checked the documentation of this event it was written that
To ensure the consistency of the system, note that you must not use the following language elements in events:
COMMIT WORK
ROLLBACK WORK
CALL FUNCTION 'DEQUEUE ALL'
Deletion of locks that you have not set yourself.
If you update additional data in an event and use the construction PERFORM commitroutine ON COMMIT to do this, note that:
At the end of the commitroutine, all internal tables from which data was updated must be initialized again to prevent a duplicate update in the next call.
A PERFORM rollbacktroutine ON ROLLBACK must also be called. In the rollbackroutine initialize the same data that is initialized at the end of the commitroutine.
If you want to carry out checks in an event, when you issue messages, note that background processing of the process terminates with warning messages. You should therefore avoid issuing warning messages if possible. However, you should definitely issue warning messages if the value of SY-BATCH is initial.
how i can use PERFORM commitroutine ON COMMIT could you please paste the code for this
also plz tell me
why my event is not getting generated without commit work . do we have any better way to do it

Hi Anit,
  The FM SWE_EVENT_CREATE does its job, only when 'COMMIT WORK' is executed, after it. Now, as per the general programming guidelines (quoted in your question), you can't write COMMIT WORK in your code. You shouldn't, because it would write half baked document into database. Something that's undesirable. The workaround prescribed in the event documentation (again, as quoted in your question) allows to achieve the goal in following manner-
1. Do all calculations in your event and put the final values - that are necessary for the workflow - in global variables. Refer to the ABAP documentation for PERFORM ... ON COMMIT for choosing global variables over parameter passing.
2. Once that's done, make the call to the FM, as given below-
PERFORM start_wf ON COMMIT.   "Within the FM implementing the event 5500.
*&      Form  start_wf
*       The form routine to initiate the workflow
FORM start_wf.
  CALL FUNCTION 'SWE_EVENT_CREATE'
    EXPORTING
      objtype           = objtype
      objkey            = objkey
      event             = event
    TABLES
      event_container   = event_container
    EXCEPTIONS
      objtype_not_found = 1
      OTHERS            = 2.
  IF sy-subrc <> 0.
    RETURN.
  ENDIF.
  CLEAR: objtype.
  CLEAR: objkey.
  CLEAR: event.
  CLEAR: event_container.
  "And all other global variables that are used in your call for this FM
ENDFORM.                    "start_wf
3. Note that you need to clean up the global variable set up in step 1 (also mentioned in the event documentation) . It is to ensure that some other call to the same FM doesn't use those values.
You needn't issue a COMMIT WORK statement anywhere in your code written in event 5500 implementation. The standard FMs, that update the SAP tables with document information have COMMIT WORK in them. As you have registered the FM 'start_wf' by PERFORM ... ON COMMIT, it would be executed along with the database update triggered by standard FM.

Similar Messages

  • Commit work in FQEVENT 295

    Hi all,
    I am working on F!CA event 295, copied standard function module and created as Z_FI_295_MULTIPLE_NSF.
    Here i am updating business partner using function module BUPA_IDENTIFICATION_CHANGE, after calling BUPA_IDENTIFICATION_CHANGE if i use BAPI_TRANSACTION_COMMIT then only record is updating otherwise record is not updating. But as per function module documentation we shouldn't use BAPI_TRANSACTION_COMMIT.
    Could you please anybody tell me how to use commit work in FQEVENTS.
    Thanks,
    Rami

    Hello,
      You definitely should not use BAPI_TRANSACTION_COMMIT in an FQEVENT. As the documentation says, it may lead to inconsistencies by saving data at the wrong time.
    If you are really sure that event 285 doesn't save BP changes, I suggest that you raise an OSS Note.
    No 'commit work' should be required.
    We don't use that 285 event at our site, so unfortunately I can't confirm that it works for us.
    good luck!
    Paul Bakker

  • Reg. commit work in a follow-up action

    friends
       i am using the following approach to solve a requirement which is posted in this thread..How to send a mail after a usage decision is made in QA11?
    got a nice reply too
      i have defined a follow-up action and assigned a customized mail-sending fm to it..my doubts are, i am on 4.7..am able to send the mail to an internal id, but the problem is without using commit work and submit rsconn01 commands, am failing in doing the same...i have read in a thread that commit work or submit (if the called program uses commit work) will cause data inconsistencies and will trigger locks if it's used in any user-exit or badi...but in my case, when will a follow-up action actually take place? will it happen after all the database commits? if so, then i believe that even i use commit work and submit commands in my z mail sending fm, it wouldn't cause any problems...am just sort of afraid whether this approach is the correct one? or triggering the mail code from the last user exit or badi itself will solve the purpose? i believe not..please guide me on this friends...helpful replies will be appreciated and awarded..thanks in advance
    Regards,
    Sathish. R

    less views and no answers:-(

  • How to use commit work in class cl_bls

    Hi,
    When i have used commit work after email sent,
    it goes into dump.
    Here is the code segment:
      try.
        -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
        -------- create and set document -------------------------------
          pdf_content = cl_document_bcs=>xstring_to_solix( pdf_tab ).
          document = cl_document_bcs=>create_document(
                i_type    = 'PDF'
                i_hex     = pdf_content
                i_length  = bytecount
                i_subject = sub ).  "#EC NOTEXT
        add document object to send request
          send_request->set_document( document ).
        --------- add recipient (e-mail address) -----------------------
        create recipient object
          recipient = cl_cam_address_bcs=>create_internet_address( recip-recip ).
        add recipient object to send request
          send_request->add_recipient( recipient ).
        ---------- send document ---------------------------------------
          sent_to_all = send_request->send( i_with_error_screen = 'X' ).
         commit work.
          if sent_to_all is initial.
            message i500(sbcoms) with recip.
          else.
            message s022(so).
          endif.
      ------------ exception handling ----------------------------------
      replace this rudimentary exception handling with your own one !!!
        catch cx_bcs into bcs_exception.
          message i865(so) with bcs_exception->error_type.
      endtry.
    What could be the reason?
    Is there any way to use commit work in class while sending email as in SO_NEW_DOCUMENT_ATT_SEND_API1 fm?
    Thanks.

    Hi,
    I have used
    submit program.....
    but in update task i have used it.
    "Z_SD_ORDER_UPDATE".    program is a print driver program.
    However error says:
    There is probably an error in the program
    "Z_SD_ORDER_UPDATE".  
    This program is triggered in the update task. There, the
    following ABAP/4 statements are not allowed:
    -  CALL SCREEN
    -  CALL DIALOG
    -  CALL TRANSACTION
    -  SUBMIT
    I used submit as:
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                      WITH output = ' '
                    AND RETURN.
    Instead of submit i want to use commit work but i also get a dump after commit work too.
    How can i use commit work in above code?
    Thanks.

  • How can i set the IDOC Status to 03 without doing a "COMMIT WORK"

    Hello Geeks,
       I want to set the status of the Outgoing IDOC to 03 , without doing a "COMMIT WORK" . Actually only after i do a commit work are my IDOCs dispatched. But with a commit work the IDOCs are dispatched immidiately. I do not want to dispatch it immidiately. Instead i want to hol the IDOCs till my LUW finishes , but the IDOC status should be set to "03" instead of "30".
    Thanks,
    Bashir

    Hi,
    After collecting all the idocs which are under status 30, run the program RSEOUT00 to change the status from 30 to 03.
    If you want to do this process automatically then set the program RSEOUT00 in background.
    Regards,
    Lokeswari.

  • COMMIT work in BADI

    Hi all,
    Can anyone tell me about, is COMMIT WORK is allowed in BADI or USER EXIT?
    If not, what is the aalternative for that?
    Thanks in advance.
    Best Regards,
    Prasad

    Hi Prasad.
    I would like to suggest a couple of references,
    [SDN - Reference - Call Transaction / Bapi and Commit work in a Update task|Call Transaction / Bapi plus Commit work in a Update task?;
    [SDN - Reference - COMMIT WORK on BADI BUPA_GENERAL_UPDATE|COMMIT WORK on BADI BUPA_GENERAL_UPDATE;
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

  • Transaction se37 include any implicit commit work?

    Hi guys,
    I'm testing bapi_material_savedata in se37. the modification to material will be save into database. The sametime this bapi can be rollback in my testing program. 
    So I'm wondering does bapi have any commit work inside itself. or se37 has an implicit commit work for this bapi ?
    I can share my testing code
    DATA: ls_headdata2  TYPE bapimathead.
    DATA: ls_plantdata TYPE bapi_marc,
          ls_plantdatax TYPE bapi_marcx,
          ls_return TYPE bapiret2,
          lt_return TYPE bapi_matreturn2 OCCURS 0.
    ls_headdata2-material = 'WDAIREZHOU2010691'.
    ls_headdata2-sales_view ='X'.
    ls_plantdata-plant = 'DCX1'.
    ls_plantdata-availcheck = 'KP'.
    LS_plantdata-profit_ctr = 'DCX1-1000'.
    ls_plantdataX-plant = 'DCX1'.
    ls_plantdataX-availcheck = 'X'.
    LS_plantdataX-profit_ctr = 'X'.
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
       headdata                    = ls_headdata2
       PLANTDATA                   = ls_plantdata
       PLANTDATAX                  = ls_plantdatax
    IMPORTING
       RETURN                      = ls_return
    TABLES
       RETURNMESSAGES              = lt_return[] .
    ROLLBACK WORK.
    Any ideas, welcome
    thanks,
    irene

    Sorry, I haven't read you question carefully. I though that it's a standard question about how to commit data created by BAPI in SE37. You are right. Unfortunately, some BAPIs have COMMIT statement inside. As far as I remember your BAPI is this case. But if you want to be sure you can use new debugger to put break point on every COMMIT statement or use SE30 to get full stack trace.
    Cheers

  • Differences between commit work and commit work & wait

    Hi people,
    I have a theory question:
    What differences are there between commit work and commit work & wait?
    Thx

    Hi,
    <b>COMMIT WORK:</b>
    This statement will apply any outstanding database updates and wait until they have actually been put on the database before proceeding to the next statement.
    An ordinary commit work will initiate the process to update the databases in a separate task and will press on in your abap.
    COMMIT WORK: ( Asynchronous)
    Your program does not wait for any acknowledgement. it just start executing the next statment after COMMIT WORK.
    <b>COMMIT WORK and WAIT</b>: (Synchronous)
    Whereas For <b>COMMIT WORK and WAIT</b>, the system waits for the acknowledgment, and then moves to the next statement.
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • BCS: Performance Issue - Most of the time is spent doing commit work.

    Hello,
    We are experiencing performance issues with our BI server. This performance issue can been seen during our BCS runs. Our DBA has indicated that he sees a very high percentage of time time is spent doing "commit work".
    Curretly, we are running BI7 nw2004s, Basis 700, support pack 14.
    Anyone else experience this? As the BCS run is mainly stanard SAP code, I was wondering if there may be some snotes that correct this?
    Thank you for any help you could provide us.

    If it is related to SEM-BCS and new EHP releases, then there are still big problems with the monitor and tasks status management (meaning problems with performance). Is it the case? If yes, then you'd better  look for already released notes reg this and formulate your own OSSs if you don't find anything relevant.

  • COMMIT WORK - performance problem

    Dear Fellow SDNers,
    I seek your help on the following problem:
    Scenario : Inbound idoc which updates an Outbound delivery with Picked quantity, posts the goods issue and then creates billing document
    Approach : I am using the function module SD_DELIVERY_UPDATE_PICKING to update the delivery from the idoc data and to post goods issue. Thereafter, i use BAPI_BILLINGDOC_CREATEMULTIPLE to create the billing document. Before calling this BAPI, I use a COMMIT WORK statement to update the relevant tables so as to enable invoice creation properly.
    Problem: The COMMIT WORK statement takes a lot of time to execute (I have no update tasks that could lead to this), so much that the idoc (probably) has a timeout and ends up in status 64. As a result, the succeeding part of the code (after COMMIT WORK) is not executed and the billing document is not created.
    When I debug this, the COMMIT WORK statement leads to a strange screen (which looks like a blank report output screen, with its title as "UPDATE CONTROL". However (of course), there is no timeout while debugging and the billing document is successfully created.
    Could anyone provide some pointers to solve this problem?
    regards,
    Priyank

    i have a custom function module Y_IDOC_INPUT_WMSPICK001 which is responsible for idoc inbound processing. SAP PI sends the inbound data to ECC and once this is done, this function module is executed.
    This FM has the following code sequence inside it...
    1) Call the FM SD_DELIVERY_UPDATE_PICKING
    2) COMMIT WORK AND WAIT.
    3) Call the BAPI_BILLINGDOC_CREATEMULTIPLE
    Step1 is successfully executed,  the step 2 takes a long time, and after that, the step 3 is not executed at all and the idoc ends up with a yellow light (status 64).
    hope it clarifies what I am doing
    regards,
    Priyank

  • COMMIT WORK on BADI BUPA_GENERAL_UPDATE

    Hi all,
    We're trying to propagate partner functions from the BP to associated business transactions.
    We're using the instruction commit work in the BUPA_GENERAL_UPDATE. The problem comes when we propagate the partner functions more than once in the BP, because the first time works but the second causes a short dump (only in PC-UI, in SAP GUI it works properly).
    We need to commit to unlock the modified opportunities.
    Anyone knows the adecuate method to commit the work in PC-UI for transaction BP?
    Thanks in advance, any help will be appreciated.
    David

    Hi David,
    My first try would be to issue the COMMIT statement inside a Form (<i>commitroutine</i>)and call this form in as
    PERFORM <i>commitroutine</i> ON COMMIT.
    Let me know if it works.
    Hope it helps.
    Thanks, Debasish

  • How to execute Update Module FM after final commit work for a T-code.

    Hello Folks,
    I have a bit complex issue with my current object.
    We have modified MM41/MM42 transactions and added a subscreen to fulfill the requirement.
    We have designed the subscreen and embedded the same to MM41/MM42 through SPRO configuration.
    Now for update business logic,i am trying to execute one Function module(Update Module) in update Task...so that it will be executed once after the final commit work will be done for MM41/MM42.
    But its not executing.
    To fulfill my requirement i need to execute the FM only after Final Commit work for MM41/MM42.
    Please suggest in this regard.
    Even i can see few BADI's which are triggering through MM01/MM02 but not through MM41/MM42.
    BADI_ARTICLE_REF_RT
    BADI_MATERIAL_CHECK
    BADI_MAT_F_SPEC_SEL
    Code with which i am trying is given below.
    After PAI event of the subscreen---
    1:        MODULE USER_COMMAND_9001.
    2:       MODULE user_command_9001 INPUT.
                        PERFORM sub_save_mara ON COMMIT.
              ENDMODULE.
    3:       FORM sub_save_mara.
                         CALL FUNCTION 'ZMMUPDATE_MARA_APPEND_STRUCT' "IN UPDATE TASK
                                        EXPORTING
                                                 materialno = gv_matnr
                                                 appendmara = ty_zzmara.
             ENDFORM.                    "sub_save_mara
    4:                FUNCTION zmmupdate_mara_append_struct.
                      ""Update Function Module:
                       ""Local Interface:
                      *"  IMPORTING
                   *"     VALUE(MATERIALNO) TYPE  MATNR
                   *"     VALUE(APPENDMARA) TYPE  ZZMARA
    Data Declaration for Local use
      DATA : w_mara TYPE mara.
    Selecting the latest values for the material.
      SELECT SINGLE * FROM mara INTO w_mara WHERE matnr = materialno.
      IF sy-subrc = 0.
      Move the ZZMARA values to structure MARA
        MOVE-CORRESPONDING appendmara TO w_mara.
      Update the values in table MARA.
        MODIFY mara FROM w_mara.
      ENDIF.
    ENDFUNCTION.
    Kindly suggest.Thanks in advance.
    Regards
    Ansumesh

    Hi..
    The code given by me will work fine provided the Final commit should happen.
    Because to execute FM with update task,final commit work should happen which is mandatory and after that it will call the update task.
    In my case final commit work was not happeneing because..SAP standard program was not able to detect wether there is any change in my sub-screen or not as the standard program & my custom program,subscreens are different.
    As it was not able to detect the change,so final commit was not happening and hence update task also.
    To provide the reference of change in my subscreen to standard program ,i set a flag as per the change in the subscreen
    And exported the same to memory.
    Then Implemented one enhacement spot in MATERIAL_CHANGE_CHECK_RETAIL Fm where i have Imported the flag value.
    Based on my custom flag value,i have set one standard flag FLG_AENDERUNG_GES which tells SAP standard program for MM42 wether any change has happened or not.
    The above solved my purpose.
    Regards
    Ansumesh

  • SO_OBJECT_SEND function does not work without an explicit COMMIT WORK

    Hi,
    We have used this Function module (SO_OBJECT_SEND) inside a custom BAdI Implementation , which sends e-mails when some of the fields inside an infotype are modified using transaction PA30 (HR-Maintain master data).
    After the system was upgraded to BASIS version 7.0 , as per SAP note 489286 ,the calling program of the send interface must execute an explicit COMMIT WORK.But inside an update , COMMIT WORK should not be executed.
    So we did not execute explicit COMMIT WORK  inside BAdI.
    But after this upgrade, the emails are not sent out of R/3 , and the status message 672 (Still no entry in queue) is displayed on the program 'Administration of External Send Processes' - Transaction SOST.
    Can anyone suggest a solution , if you have used this Function module (SO_OBJECT_SEND) inside a BAdI during update?
    Thanks,
    Kiran

    Hi Kiran,
    create one remote enable function module, write your required logic in this remote enableD function module.
    Now call this function module in Badi as below,
    eg. suppose Remote enable function module created is 'ztest'.
    then,
    In BadI write logic,
    CALL FUNCTION 'ZTEST' SEPARATE TASK 'T'
    EXPORTING ......
    IMPORTING.......
    also inside this function module
    call function 'SO_OBJECT_SEND' separate task 'T'
    exporting....
    importing....
    committwork.
    after doing this what will happen is your mail logic will be in saperate session, so your current program will pass the data and execution of this RFC and Program having BADI, will be in two saperate sessions, so although you are using committ work standred program will not get affected.
    This will improve performance too...:)
    Please Give points if it is going to help you.

  • COMMIT WORK and WAIT FOR n SECONDS

    I am designing a WebDynpro Java application.  It makes an update call followed immediately by a display call which should return the data that was just updated.  However, it appears that there is some DB latency involved and the data takes a few seconds to update.  The application displays old data if the display call is performed too quickly after the update call.
    All suggestions I could find point to having a Thread sleep on the Java side for a few seconds or have a WAIT FOR n SECONDS and/or COMMIT WORK AND WAIT statement in the ABAP function module.  Neither of these solutions is acceptable in a company-wide application where database latency could vary significantly based on traffic.
    I tried all kinds of functions (i.e. BAPI_TRANSACTION_COMMIT) as well as various forms of COMMIT WORK... nothing except a WAIT works correctly.  There must be a statement out there that waits for the database write to be complete!  How is this solved without picking an arbitrary WAIT time?  What am I missing?
    Thanks in advance!

    You can write the other way.
    declare one variable
    data : wa_try type i.
    wa_try = 10. -> set as 10 ,even you do not get value ,keep on incresing.
    after BAPI FM
    you can call comitt fm.
    after BAPI_TRANSACTION_COMITT
    just use simple logic.
    do wa_try.
    select * from table into table
                                  where record = bapi fm record ( You get in RET2 Message).
    if sy-subrc eq 0.
    exit.
    endif.
    Thanks
    Seshu

  • Commit work

    Hi all,
    Please help me in this issue,
    When we using Update ABAP statement what is the need of using again a commit statement if we dont use commit statement.
    Thanks & Regards
    Reddy

    Hello Reddy,
    COMMIT is used when you code directly in ABAP and make changes in the database and want to reflect in the database immediately.
    When you perform COMMIT , all the LUW s work will be reflected to the database,
    COMMIT WORK is the key word to make the database change. And whereas ROLLBACK is the opposite to commit work,
    This statement will apply any outstanding database updates and wait until they have actually been put on the database before proceeding to the next statement.
    An ordinary commit work will initiate the process to update the databases in a separate task and will press on in your abap.
    COMMIT WORK: ( Asynchronous)
    Your program does not wait for any acknowledgement. it just start executing the next statment after COMMIT WORK.
    <u><b>For your kind reference please check the below link</b></u>
    <b>http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3b64358411d1829f0000e
    829fbfe/content.htm</b>
    <b>
    Reward points for all useful answers....
    Cheers !
    Moqeeth.</b>

Maybe you are looking for

  • How to get header and item data in ME_PROCESS_PO_CUST ?

    Hi all, How can I get header and item data in me_process_po_cust~process_account ? I have to do some validation for account assignment catagory in item overview.

  • Problem allocating service packages to users via delegated admin

    I've created a custom service package using the sample templates. Upon assigning this newly created package to a user via Delegated Administrator I receive the following message "cannot create user - all service packages of this type have been alloca

  • Jdbc Error-urgent Pz

    hai friends, I know how to connect to database using JDBC-ODBC driver... but my problem is how to connect to database using 2 way-native driver

  • OSX authentication to a windows network

    We have a user in our company who purchased a new Macbook to use for her job.  We run a websense internet filter here that grants access depending on what group your user account is assigned to in Active Directory.  This user needs to have elevated p

  • Canon Vixia HF R300.

    A year ago I made a movie in iMovie and shared it to iDVD.  The quality was crisp.  Now I finalize a new project and the final quality is poor.  I have tried to adjust all settings to no avail.  Please help! i am using 27-inch, Late 2009 Processor  3