COMMIT_IN_POSTING

Hi experts
I have a problem with an output type of the sales orders, results that after creating a SAP sales order I need to create the same sales order in an informix system, so I'm connecting with DBCO to the informix database and executing some stores procedures with EXEC SQL. sentence, I have this instructions in the output type, then after executing each store procedure I'm executing and ENDEXEC and a COMMIT WORK, because If I don't use the COMMIT WORK from SAP the records I'm inserting in informix database are not inserted in Informix DATABASE, the program of the output type works fine when I run it separately, but when is executed after the VA01 or VA02, the system  give me a dump with next error :
The question is , do I have another way to send the commit to the Informix database from SAP??.
Thanks
Regards
Soraya
Errores tiempo ejec.   COMMIT_IN_POSTING                                  
       ocurrido el     02.04.2009 a  15:31:26                                                                               
Invalid COMMIT WORK in an update function module.                         
Calling a COMMIT WORK in an update process is not allowed             
because the function modules triggered in a Logical Unit              
of Work cannot then be processed correctly.                           

Do not try COMMIT WORK
Commit the changes on connection
    EXEC SQL.
      COMMIT
    ENDEXEC.
Thanks
Naresh

Similar Messages

  • COMMIT_IN_POSTING error when sending PO as PDF attachment through me23n.

    I am sending PO smartform  as PDF attachment which is created  when print preview option is selected in ME23n .
    Problem is when i use
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    COMMIT_WORK = 'X' 
    If I am using  COMMIT_WORK = 'X'  in this function module. then am able to send the mail ,but at the same time am not able to save any new PO in ME21N.
    Iam getting error  COMMIT_IN_POSTING.
    IF I comment COMMIT_WORK = 'X' 
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      DOCUMENT_DATA = WA_DOC_CHNG
      PUT_IN_OUTBOX = 'X'
    COMMIT_WORK = 'X' 
    then am able to save the new PO in ME21N but unable to send attachment as pdf.
    Plzz provide me solution for the above,,...!
    I have done changes in standard PO driver program from which am calling the samrtform using entry_enu form and with a nace configuration changes.Iam able to creat smartform output and also PDF file of smart form the only problem is sending mail while using 'SO_NEW_DOCUMENT_ATT_SEND_API1 and commit_work parameter.

    Moderator message - Duplicate post locked
    Rob

  • Dump "COMMIT_IN_POSTING" while posting Goods Issue

    Hi All,
    We are trying to post Goods Issue using the FM BAPI_GOODSMVT_CREATE.
    Based on the return status of this FM we are commiting the transaction using BAPI_TRANSACTION_COMMIT.
    On Execution we are getting the dump "COMMIT_IN_POSTING".
    Please let us know if anyone has any idea about this error.
    Regards,
    Lavanya.

    Hi Florian,
    I have commented the BAPI_TRANSACTION_COMMIT, but it is giving same dump since commit work is happening in another FM which I am using in my program. So I have commented that FM, now it is giving a dump MESSAGE_TYPE_X. The dump error analysis is:
    Short text of error message:
    Nested call of PERFORM ON COMMIT: NESTED_PERFORM_ON_COMMIT caller: SAPLM
    BRE program: SAPLMBRE form: DELTA_PUT
    Long text of error message:
    Diagnosis
         During processing of a routine called using PERFORM ... ON COMMIT,
         the system attempted to call PERFORM ... ON COMMIT again. Nesting
         of this is not allowed.
    System Response
    Procedure
         The program indicated after "Caller:" must be changed. This is the
         program that calls the routine indicated after "Form:" during
         COMMIT processing. This routine is part of the program indicated
         after     "Program:".
    Regards,
    Lavanya.

  • Error 00 671 Abap processor : COMMIT_IN_POSTING

    Hi Eexperts,
                       I have a requirement to send a smartform as a fax and mail at the time of saving a Sales Order. I have configured it accordingly. But while saving a Order It is throwing an Error into INBOX as below...
    Update was terminated
    System ID....   DVD
    Client.......   224
    User.....   SEKJ
    Transaction..   VA02
    Update key...   46CB21AFEAF869A4E1000000921B4FA9
    Generated....   08/22/2007, 12:51:42
    Completed....   08/22/2007, 12:51:49
    Error info...   00 671: ABAP/4 processor: COMMIT_IN_POSTING
    Can anybody know what this error is and If possible Please send me OSS Notes regarding this..
    Regards,
    Sekhar.J

    Hi Experts,
    The requirement is to update the Qty & Status during POSTing in MIGO if the material is Kanban managed.
    Requirement :
    Scrapping using 551/ 552 should accordingly increase/ decrease the Kanban Qty and modify the status (visible in PK31 and PKPS table)
    Approach:
    Implemented BADI "MB_MIGO_BADI" & called the FM to update Kanban status & Qty. But got the error of COMMIT_IN_POSTING.
    Any pointers to user-exit/badi which would help to fulfill the above requirement.
    Thanks,
    Best regards,
    Prashant

  • Send Immeditely causes COMMIT_IN_POSTING

    Hi folks,
    I am taking a SAP script Invoice, converting it to a PDF, and sending as an email attachment.
    My program works great when I use output dispatch time of "1 send with periodically scheduled job" and using program RSNAST00, but when I execute using "4 Send immediatley (when saving the application)" it fails with error COMMIT_IN_POSTING.
    Any idea why? How do I fix it?
    Thanks,
    Clint

    Hi Smith ,
    I'm also facing the same problem .
    In the smartform after configuring the message type with '4 SZend Immediately' and saving it ...generates a error message the update is terminated and shows error COMMIT_IN_POSTING.
    Can u please tell me how to overcome this .
    Thanks in advance
    Anil

  • COMMIT_IN_POSTING Dump (SendEmail)

    hi Experts
    I need send Adobe Form as attachment
    this is part of my prog. ******************
    TRY.
    lr_send_request->send(
    EXPORTING
    i_with_error_screen = 'X'
    RECEIVING
    result = lv_sent_to_all ).
    CATCH cx_send_req_bcs INTO lr_send_req_bcs.
    ENDTRY.
    COMMIT WORK.
    but after execute I get Error(Dump):
    *Calling a COMMIT WORK in an update process is not allowed*
    *because the function modules triggered in a Logical Unit*
    *of Work cannot then be processed correctly.*
    I tried to use UpdateFunction(call function in update task), but in this case I get Empty PDF File .
    How can I solve this problem?
    Thanks,
    Larissa

    I think you are calling class cl_bcs inside function module, try with remove the commit work and call bapi_transaction_commit after your function module call

  • Short Dump in VF01 while creating debit memo

    Hi,
    we are trying to create the debit memo in tcode VF01,while saving the doc it is giving dump.
    i went to  ST22 for error analysis,details are "COMMIT_IN_POSTING" error in FM RV_INVOICE_REFRESH.
    Short text
        Invalid COMMIT WORK in an update function module.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "SAPLV60A" had to be terminated because it has
        come across a statement that unfortunately cannot be executed.
    the above text copied from ST22.
    before putting this thread, i have done complete analysis in SDN .
    i have searched for SAP notes.i did't got the proper one.
    KIindly can u provide any solution.
    <removed by moderator>
    Regards,
    Manjunath
    Edited by: Thomas Zloch on Dec 2, 2011 2:39 PM

    Is the debit memo triggering an output type?
    I saw similar thing long back and I remember it was caused by a output type with a print program that was doing an illegal COMMIT WORK. Actually sometimes there may be a function call inside the program attached with the output type that may be doing a COMMIT which is not directly apparent.
    COMMIT WORK causes runtime error when it occurs in functions called in UPDATE TASK or forms called with ON COMMIT.
    Try disabling / deleting the output type (Vf01 -> Goto -> Header -> Output) proposed and then save the debit memo and see if this error goes away. You can also try select the output type and click further data and set dispatch time to '1' (send with periodically scheduled job to avoid this issue.
    Check threads with people facing similar issues because of commit in output type programs
    Send Immeditely causes COMMIT_IN_POSTING
    Need input for error caused while trggering a output type
    COMMIT_IN_POSTING
    COMMIT_WORK in FM, SO_DOCUMENT_SEND_API1

  • Need input for error caused while trggering a output type

    I had created a custom program and assigned it to a custom output type. while processing this output type through VF01(billing doc) it is generating an error saying commit_in_posting. can anyone suggest in this regard........

    1Check for VF01 is there any control routine written for this output type which blocks it from triggering this output.
    2. are there any condition records maintained which are creating problems.
    3 check the out put poecedures aslo....

  • BADI WORKORDER_UPDATE - creation of PO

    Hi,
    I am trying to create a purchase order using the method IN_UPDATE in BADI WORKORDER_UPDATE.
    I am using the BAPI BAPI_PO_CREATE to create the purchase order. However transaction IW32 abends when the BAPI is called with either of the following messages:
    14 005: Internal TSKH error, session terminated
    00 671: ABAP/4 processor: COMMIT_IN_POSTING
    Has anyone had success in creating a PO using this BADI/METHOD?
    Or alternatively does anyone know how of a correction for these messages.
    Thanks in advance,
    Derick

    Hi Andrey,
    Thanks for your suggestion.
    I fixed this by changing my function module to a Remote Enable Module with Immediate Start and calling it in the IN_UPDATE method with the addtion IN BACKGROUND TASK.
    This worked from both IW31 and IW32.
        CALL FUNCTION 'Z_PROCESS_SERVICE_ORDER'
          IN BACKGROUND TASK
          EXPORTING
            i_header = w_header
          TABLES
            it_resb  = it_resb.
    Regards,
    Derick

  • What is luw (logical unit of work)

    pls tell me what is luw (logical unit of work)
    what r the types of luw .
    2 what ispurpose of code inspector and extended program check
    pls expalin the diffrence b/w those two
    3what are the candidate keys in db tables
    4 what is the difference b/w  occurs 1 and occurs 2 clauses
    data : begin of itab occurs 0 .
    data : itab type standard table of structure type initial size 1 with header line
    pls tell diffrence between theese two statements
    5can u pls tell what is the client in sap
    pls tell answers to questions
    pls dont give any websites addresses to see answers
    6 what is the transaction from database point of view
    7 what is the variant in alv reports
    how do we use reuse_alv_grid_variant_get fun module in alvs

    hi,
      this gives complete idea
      SAP LUW
    Since, as a rule, an application program is processed by several work processes in succession, and every change of the work process is linked with an implicit database commit , an application program is not automatically linked with a single database LUW. This applies in particular to dialog-oriented applications, in which one database LUW is assigned to one dialog step.
    To ensure the data consistency of application programs that are executed across different work processes, the application statements are not directly executed in an SAP LUW, rather, are first registered and then executed by a single work process, that is, in a single database LUW.
    Two techniques are available for bundling the change statements in a database LUW:
    Bundling via function modules (update)
    Through the statement CALL FUNCTION...IN UPDATE TASK, an update function module is registered for subsequent execution in an update work process.
    Bundling via function modules (transactional RFC)
    Through the statement CALL FUNCTION... IN BACKGROUND TASK DESTINATION, a remote- compatible function module is registered for subsequent asynchronous execution via the RFC interface (transactional RFC ).
    Bundling via subprograms
    Through the statement PERFORM ... ON COMMIT, a subprogram is registered for subsequent execution in a different work process.
    Statements for SAP LUWs
    A SAP LUW is controlled via the Open SQL statements COMMIT WORK, ROLLBACK WORK and SET UPDATE TASK LOCAL.
    Note
    A function module can be classified either as an update function module or remote-compatible, but not both at the same time. The update helps realize SAP LUWs within an SAP System, while the transactional RFC creates LUWs in distributed systems.
    COMMIT WORK
    Variants:
    1. COMMIT WORK [AND WAIT].
    2. COMMIT CONNECTION con.
    Effect
    Terminates an SAP LUW and stores the changes.
    Variant 1
    COMMIT WORK [AND WAIT].
    Effect
    The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the currenta SAP LUW in the process. In this case, COMMIT WORK performs the following actions:
    It executes all subroutines registered using PERFORM ON COMMIT.
    It triggers an internal event in Object Services that ensures the registration of changes in persistent objects as the last update function module, as well as the subsequent initialization of persistent object attributes.
    It initiates the processing of all registered update function modules in the update work process.
    This executes all high-priority update function modules registered using CALL FUNCTION ... IN UPDATE TASK in the order of their registration and in a common database LUW. If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating). If you specify the addition AND WAIT, however, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).
    If all high-priority update function modules are completed successfully, the statement executes the low-priority update function modules together in a common database LUW.
    In parallel, it also executes the individual function modules registered using CALL FUNCTION ... IN BACKGROUND TASK DESTINATION in a separate database LUW for each destination.
    It handles all SAP locks set in the current program according to the value of the formal parameter _SCOPE of the corresponding lock function modules.
    It triggers a database commit that also terminates the current database LUW.
    The completion of statement COMMIT WORK triggers the event TRANSACTION_FINISHED of the system class CL_SYSTEM_TRANSACTION_STATE, where the parameter KIND has the value of the constant CL_SYSTEM_TRANSACTION_STATE=>COMMIT_WORK.
    If the statement COMMIT WORK is executed by calling special programs, be aware of the following:
    In a program executed using batch input, or if you have called the program using the USING addition of the statement CALL TRANSACTION, COMMIT WORK terminates the batch input processing when using the corresponding settings.
    In a program called using CALL DIALOG, COMMIT WORK initiates the processing of subroutines or updated function modules registered using PERFORM ... ON COMMIT and CALL FUNCTION ... IN UPDATE TASK. Therefore, it does not complete the current SAP LUW. The SAP LUW cannot be completed until you execute the COMMIT WORK statement in the calling program.
    You cannot execute the COMMIT WORK statement during the updating procedure or during the execution of subroutines registered using PERFORM ... ON {COMMIT|ROLLBACK}.
    System fields
    sy-subrc Meaning
    0 You have specified the AND WAIT addition, and the updating of the update function modules was successful.
    4 You have specified the AND WAIT addition, and the updating of the update function modules was not successful.
    The COMMIT WORK statement always sets sy-subrc to 0 if the AND WAIT addition is not specified.
    Note
    The COMMIT WORK statement closes all database cursors . Open SQL statements that access a database cursor later ( SELECT loop and FETCH) raise an exception that cannot be handled.
    Variant 2
    COMMIT CONNECTION con.
    Note
    This statement is for internal use only.
    It cannot be used in application programs.
    Effect
    The COMMIT command is not executed on the standard database, but only on the secondary database connection specified by con. con is the name of the database connection as it was specified in the table DBCON in the column CON_NAME. The database connection con can also be specified dynamically in the form (source_text) - the source_text field contains the name of the database connection. The source_text field must be of the type C or STRING.
    On the specified secondary database connection, the database commit:
    Closes all open database cursors (OPEN CURSOR)
    Releases all database locks
    Note
    Note that the COMMIT CONNECTION DEFAULT statement unlike COMMIT WORK executes a pure database commit on the DEFAULT connection.
    Exceptions
    Non-Catchable Exceptions
    Cause: COMMIT WORK is not possible in a FORM that was called using PERFORM ... ON COMMIT.
    Runtime Error: COMMIT_IN_PERFORM_ON_COMMIT
    Cause: COMMIT WORK is not allowed in the update.
    Runtime Error: COMMIT_IN_POSTING
    ROLLBACK WORK
    Variants:
    1. ROLLBACK WORK.
    2. ROLLBACK CONNECTION con.
    Effect
    Terminates a SAP-LUW without storing the changes.
    Variant 1
    ROLLBACK WORK.
    Effect
    The statement ROLLBACK WORK closes the current SAP-LUW and opens a new one. In doing so, all change requests of the current SAP-LUW are canceled. To do this, ROLLBACK WORK carries out the following actions:
    Executes all subprograms registered with PERFORM ON ROLLBACK.
    Deletes all subprograms registered with PERFORM ON COMMIT.
    Raises an internal exception in the Object Services that makes sure that the attributes of persistent objects are initialised.
    Deletes all update function modules registered with CALL FUNCTION ...IN UPDATE TASK from the VBLOG and deletes all transactional remote Function Calls registered with CALL FUNCTION ... IN BACKGROUND TASK from ARFCSSTATE and from ARFCSDATA.
    Removal of all SAP locks set in the current program in which the formal parameter _SCOPE of the lock function module was set to the value 2.
    Triggers a database rollback, which also ends the current database-LUW.
    After completion of the statement COMMIT WORK, the event TRANSACTION_FINISHED of the system class CL_SYSTEM_TRANSACTION_STATE is raised, in which the parameter KIND has the value of the constant CL_SYSTEM_TRANSACTION_STATE=>ROLLBACK_WORK.
    Variant 2
    ROLLBACK CONNECTION con.
    Note
    This statement is for internal use only.
    It cannot be used in application programs.
    Effect
    The ROLLBACK-statement is not executed on the standard database but only on the secondary database connection, specified through con. con is the name of the database connection as it was specified in table DBCON in column CON_NAME. The database connection con can also be specified dynamically in the form (source_text), in which the field source_text contains the name of the database connection. The field source_text must be of the type C or STRING.
    Notes
    As all opened database cursors on the respective database connections are closed at ROLLBACK, the attempt to continue a SELECT-loop after a ROLLBACK, leads to a runtime error. Due to the same reason, a FETCH after a ROLLBACK to the then closed cursor, leads to a runtime error. You have to make sure that cursors that are still open, are no longer used after ROLLBACK.
    After execution of the statement ROLLBACK, SY-SUBRC is always equal to 0. It is not necessary to check if SY-SUBRC is unequal to 0 after ROLLBACK.
    ROLLBACK must not be used during update (CALL FUNCTION ... IN UPDATE TASK) or during the execution of FORMs, which were registered with PERFORM ... ON COMMIT resp. PERFORM ...ON ROLLBACK.
    The statement ROLLBACK WORK is implicitly executed if a message of the type A is treated with the addition ERROR_MESSAGE when calling a function module with CALL FUNCTION.
    Exceptions
    Non-Catchable Exceptions
    Cause: ROLLBACK WORK is not allowed within a FORM that is called with PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK.
    Runtime Error: ROLLBACK_IN_PERFORM_ON_COMMIT
    Cause: ROLLBACK WORK is not allowed within an update.
    Runtime Error: ROLLBACK_IN_POSTING
    SET UPDATE TASK LOCAL
    Syntax
    SET UPDATE TASK LOCAL.
    Effect
    This statement specifies that the high-priority update function modules - registered during the current SAP LUW using CALL FUNCTION ... IN UPDATE TASK - are registered in the ABAP memory instead of the VBLOG database table. In addition, it specifies that the current work process and not the update work process run these modules during the current database LUW, when the COMMIT WORK statement is executed. This statement has no effect on low-priority update function modules.
    At the beginning of every SAP LUW, the local update function is deactivated. If you wish to use it, you must reactivate it again before the first update function module is registered.
    System fields
    sy-subrc Meaning
    0 The local update function is activated.
    1 The local update function has not been activated, because the program has already registered at least one update function module for the normal updating procedure in the current SAP-LUW.
    Notes
    The local update function performs a synchronous update according to the COMMIT WORK statement, independent of the addition AND WAIT.
    The occurrence of a database rollback during the local update affects all previous change requests.

  • Alternative for BAPI_REQUISITION_CHANGE, to run this in update process.

    Hi,
         I'm using BAPI_REQUISITION_CHANGE, to change a purchase requisition Qty related to a purchase order. This Bapi is used in a report program which inturn is triggered by an output type, on Purchase Order creation.
    Now, when this BAPI is executed, it ends up in dump saying "Invalid COMMIT WORK in an update function module".
    The search criterion it gave was ..
    "COMMIT_IN_POSTING" C
    "SAPLBAPT" or "LBAPTU05"
    "TRANSACTION_END"
    And the error analysis as
    Calling a COMMIT WORK in an update process is not allowed
    because the function modules triggered in a Logical Unit
    of Work cannot then be processed correctly.
    This clearly shows that commit is being done inside the BAPI. Is there any other way that I can update Purchase Requisition Qty?
    Thanks for your time on this.
    Regards,
    Srikanth Peri

    Hi,
       This issue is now resolved. I have found BAPI_PR_CHANGE and tried using it. It works perfectly in update mode.
    Thanks and apologies for your time on this.
    Regards,
    Srikanth Peri

  • Smartform - PDF attachment through E-mail issue

    Hi,
    A custom form and custom program was created to print the Purchase order information through ME21N, 22n and 23n.
    It also has E-mail option. when output medium 5(Simple mail) and 7(External send), email will be send to respective mail-id's with the PDF attachment.
    I have issue at the time of saving PO which processed with medium 5. when i save A popup appears "Express document update was terminated received from author". Brief message about it is
    "Error Info... 00 671: ABAP/4 processor: COMMIT_IN_POSTING"
    In Smartform driver program i am using below function modules to convert OTF into PDF and send through e-mail.
    Function Module: CONVERT_OTF.
    Function Module: SO_DOCUMENT_SEND_API1.
    I am not sure, what i missed out. Can you guys tell is this the correct way to send PDF attachment through E-mail or i missed out any function module for commit.
    Regards,
    Hemanth.
    Edited by: keerthipati hemanth on Jul 31, 2008 1:15 PM
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Jul 31, 2008 3:14 PM

    Hi Hemant,
    Below is the code for the  downloading of the smartform into the PDF Format.
    * Program Name : ZPPREP_SHOPFLOOR_VIEWER_ZOOM
    REPORT zppeerep_shorepfloor_viewer_zoom.
    * T A B L E S    D E C L A R A T I O N
    *---Tables Used.
    TABLES: afpo,
            mara,
            marc,
            aufk,
            afko,
            itcoo,
            nast,                          "Messages
            *nast,                         "Messages
            tnapr,                         "Programs & Forms
            addr_key,
            arc_params,                    "Archive parameters
            toa_dara.                      "Archive parameters
    * I N T E R N A L    T A B L E S     D E C L A R A T I O N
    *--Internal Tables Used.
    * D A T A     D E C L A R A T I O N
    *--Global Variables Used.
    DATA: ws_matnr LIKE afpo-matnr,
          ws_werks LIKE aufk-werks,
          ws_mtart LIKE mara-mtart,
          ws_wrkst LIKE mara-wrkst,
          ws_fname TYPE rs38l_fnam,
          ws_ctrlp TYPE ssfctrlop,
          ws_optns TYPE ssfcompop,
          w_padest LIKE tsp03l-padest.                          "BMC01+
    DATA: da_message_printed(1) TYPE c,
          da_preview_processed(1) TYPE c,
          repeat(1) TYPE c,
          da_subrc LIKE sy-subrc.
    DATA: w_otfdata  TYPE ssfcrescl.
    DATA: BEGIN OF it_itcoo OCCURS 0.
            INCLUDE STRUCTURE itcoo.
    DATA: END OF it_itcoo.
    DATA: w_otf  TYPE itcoo.
    *--Data Declaration for Printing Layout
    DATA: ls_itcpo     TYPE itcpo.
    DATA: lf_repid     TYPE sy-repid.
    DATA: lf_device    TYPE tddevice.
    DATA: cf_retcode   TYPE sy-subrc.
    DATA: ls_recipient TYPE swotobjid.
    DATA: ls_sender    TYPE swotobjid.
    DATA: ls_control_param   TYPE ssfctrlop.
    DATA: ls_composer_param  TYPE ssfcompop.
    DATA: ls_addr_key        LIKE addr_key.
    DATA: w_screen(1) TYPE c.
    DATA: xscreen(1) TYPE c.
    DATA: da_mess LIKE vbfs OCCURS 0 WITH HEADER LINE.
    * C O N S T A N T S
    CONSTANTS: c_fas1(8)  TYPE c VALUE 'PRINTFAS',
               c_fas2(15) TYPE c VALUE 'PRINTFASDRAWING',
               c_wip1(8)  TYPE c VALUE 'PRINTWIP',
               c_wip2(15) TYPE c VALUE 'PRINTWIPDRAWING'.
    * S E L E C T I O N - S C R E E N.
    SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-bl1.
    * Production order
    PARAMETERS: p_aufnr LIKE afpo-aufnr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK bl1.
    START-OF-SELECTION.
    *--Begin of Commenting                   "
    *--Get Partially processed orders
      MOVE: sy-mandt         TO nast-mandt,
            'V1'             TO nast-kappl,
            p_aufnr          TO nast-objky,
            p_aufnr          TO nast-parnr,
            sy-langu         TO nast-spras,
            sy-datum         TO nast-erdat,
            '1'              TO nast-nacha,
            '3'              TO nast-vsztp,
            'X'              TO nast-manue,
            sy-uname         TO nast-usnam,
            'DFLT'           TO nast-ldest,
            sy-langu         TO nast-tdspras,
            'Shop Floor Papers' TO nast-tdcovtitle,
            '1'              TO nast-tdarmod,
            'BUS2032'        TO nast-objtype.
    *--Printer settings
      CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
        EXPORTING
          pi_nast       = nast
          pi_repid      = sy-repid
        IMPORTING
          pe_returncode = cf_retcode
          pe_itcpo      = ls_itcpo
          pe_device     = lf_device
          pe_recipient  = ls_recipient
          pe_sender     = ls_sender.
      MOVE-CORRESPONDING ls_itcpo TO ls_composer_param.
      ls_control_param-device      = 'PRINTER'.
      ls_control_param-no_dialog   = 'X'.
      ls_control_param-preview     = 'X'.
      ls_control_param-getotf      = ls_itcpo-tdgetotf.
      ls_control_param-langu       = sy-langu.
    *--End   of Commenting                   "
    *--Start of Addition                     "
      CLEAR:   ws_werks.
      SELECT   SINGLE werks
               INTO   ws_werks
               FROM   aufk
               WHERE  aufnr = p_aufnr.
      CLEAR:   ws_matnr.
      SELECT   SINGLE plnbez
               INTO   ws_matnr
               FROM   afko
               WHERE  aufnr = p_aufnr.
      CLEAR:   marc.
      SELECT   SINGLE matgr
               INTO   marc-matgr
               FROM   marc
               WHERE  matnr = ws_matnr
               AND    werks = ws_werks.
    *--End   of Addition                     "
    *  CHECK NOT ws_matnr IS INITIAL.       
      IF NOT ws_matnr IS INITIAL.          
    *--Start of Addition                    
        SELECT   SINGLE matgr
                 INTO   marc-matgr
                 FROM   marc
                 WHERE  matnr = ws_matnr
                 AND    werks = ws_werks.
    *--Start of Addition BY Rapidigm01_01+
      ELSE.
        marc-matgr = c_wip1.
      ENDIF.
    *--End Of Addition BY Rapidigm01_01+
    *--End   of Addition                     "
    END-OF-SELECTION.
      PERFORM call_smartform.
    * F O R M    R O U T I N E S
    *&      Form  call_smartform
    *       text
    FORM call_smartform.
      CLEAR: ws_ctrlp, ws_optns, ws_fname.
    *--Start of Addition                                 "
      TRANSLATE marc-matgr TO UPPER CASE.
      IF marc-matgr = c_fas1 OR
         marc-matgr = c_fas2.
        PERFORM call_paper_a.
      ELSEIF marc-matgr = c_wip1 OR
             marc-matgr = c_wip2.
        PERFORM call_paper_b.
      ENDIF.
    *--End   of Addition                                 "
    ENDFORM.                    "call_smartform
    *&      Form  call_paper_a
    *       text
    FORM call_paper_a.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
    *>>BC SPARTA03    DATE: 19/05/2008
    *      formname           = 'ZPPSF_SHOP_FLOOR_PAPER_A'  "Rapidigm03_01-
          formname           = 'ZPPSF_SHOP_FLOOR_PAPER_C'  "Rapidigm03_01-
    *<<EC SPARTA03    DATE: 19/05/2008
    *       formname  = 'ZPPSF_SHOP_FLOOR_PAPER_A_2893'   "Rapidigm03_01+
        IMPORTING
          fm_name            = ws_fname
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      CHECK NOT ws_fname IS INITIAL.
      CLEAR w_otfdata.
      ls_control_param-getotf = 'X'.
      CALL FUNCTION ws_fname
        EXPORTING
          archive_index      = toa_dara
          archive_parameters = arc_params
          control_parameters = ls_control_param
          mail_recipient     = ls_recipient
          mail_sender        = ls_sender
          output_options     = ls_composer_param
          user_settings      = ' '
          is_nast            = nast
          aufnr              = p_aufnr
          flag_orig          = 'X'
        IMPORTING
          job_output_info    = w_otfdata
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 5.
      LOOP AT w_otfdata-otfdata INTO w_otf.
        APPEND w_otf TO it_itcoo.
      ENDLOOP.
      CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
        TABLES
          otf_table = it_itcoo.
    ENDFORM.                    "call_paper_a
    *&      Form  call_paper_b
    *       text
    FORM call_paper_b.
      DATA: ws_doknr TYPE draw-doknr,
            ws_dokvr TYPE draw-dokvr.
      CLEAR: ws_doknr, ws_dokvr.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZPPSF_SHOP_FLOOR_PAPER_B'
        IMPORTING
          fm_name            = ws_fname
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      CHECK NOT ws_fname IS INITIAL.
      CLEAR w_otfdata.
      ls_control_param-getotf = 'X'.
      CALL FUNCTION ws_fname
        EXPORTING
          archive_index      = toa_dara
          archive_parameters = arc_params
          control_parameters = ls_control_param
          mail_recipient     = ls_recipient
          mail_sender        = ls_sender
          output_options     = ls_composer_param
          user_settings      = ' '
          is_nast            = nast
          aufnr              = p_aufnr
          doknr              = ws_doknr
          dokvr              = ws_dokvr
          flag_orig          = 'X'
        IMPORTING
          job_output_info    = w_otfdata
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 5.
      LOOP AT w_otfdata-otfdata INTO w_otf.
        APPEND w_otf TO it_itcoo.
      ENDLOOP.
      CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
        TABLES
          otf_table = it_itcoo.
    ENDFORM.                    "call_paper_b

  • COMMIT_WORK in FM, SO_DOCUMENT_SEND_API1

    Hi,
    I use this FM to send e-mail in VA01 for a certain output type. I passed a parameter, COMMIT_WORK with an 'X'. But then when creating sales order upon saving, i got an update terminate. Studying the dump error, it is an error of COMMIT_IN_POSTING. The error explains that is is the invalid commit_work in an update function module. This function module is SO_DOCUMENT_SEND_API1. When I tried to delete the parameter, COMMIT_WORK, i can save the order but then cannot send the e-mail when executing the output type to send e-mail. But the message to be sent is still no entry in queue when checking in transaction SOST.
    Please help me in analyzing the cause.

    remove commit and use this code:
    SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    [Send external email from within ABAP program |http://wiki.sdn.sap.com/wiki/x/-dc]

  • MB_MIGO_BADI

    Hi Experts,
    I have implemented badi "MB_MIGO_BADI" in ECC 6.0.
    I am using method "POST_DOCUMENT" to call another FM 'BAPI_KANBANCC_WITHDRAWQUANTITY'.
    But since the above BADI is called in Update Task, its giving error at runtime
    Error Info...   00 671: ABAP/4 processor: COMMIT_IN_POSTING
    This is bcz, COMMIT WORK is called in a BADI which is executed in Update Task.
    I tried to submit a background program which will call the above FM & do commit work. Still facing the same problem.
    Any pointers to achieve the functionality.
    Thanks,
    Best regards,
    Prashant

    Hi Experts,
    The requirement is to update the Qty & Status during POSTing in MIGO if the material is Kanban managed.
    Requirement :
    Scrapping using 551/ 552 should accordingly increase/ decrease the Kanban Qty and modify the status (visible in PK31 and PKPS table)
    Approach:
    Implemented BADI "MB_MIGO_BADI" & called the FM to update Kanban status & Qty. But got the error of COMMIT_IN_POSTING.
    Any pointers to user-exit/badi which would help to fulfill the above requirement.
    Thanks,
    Best regards,
    Prashant

  • RE:logical unit of work

    Hi guys,
    What do u mean by logical unit of work...Can anyone explain me with an example.
    Regards,
    Alex.

    hi,
    this gives complete idea
    SAP LUW
    Since, as a rule, an application program is processed by several work processes in succession, and every change of the work process is linked with an implicit database commit , an application program is not automatically linked with a single database LUW. This applies in particular to dialog-oriented applications, in which one database LUW is assigned to one dialog step.
    To ensure the data consistency of application programs that are executed across different work processes, the application statements are not directly executed in an SAP LUW, rather, are first registered and then executed by a single work process, that is, in a single database LUW.
    Two techniques are available for bundling the change statements in a database LUW:
    Bundling via function modules (update)
    Through the statement CALL FUNCTION...IN UPDATE TASK, an update function module is registered for subsequent execution in an update work process.
    Bundling via function modules (transactional RFC)
    Through the statement CALL FUNCTION... IN BACKGROUND TASK DESTINATION, a remote- compatible function module is registered for subsequent asynchronous execution via the RFC interface (transactional RFC ).
    Bundling via subprograms
    Through the statement PERFORM ... ON COMMIT, a subprogram is registered for subsequent execution in a different work process.
    Statements for SAP LUWs
    A SAP LUW is controlled via the Open SQL statements COMMIT WORK, ROLLBACK WORK and SET UPDATE TASK LOCAL.
    Note
    A function module can be classified either as an update function module or remote-compatible, but not both at the same time. The update helps realize SAP LUWs within an SAP System, while the transactional RFC creates LUWs in distributed systems.
    COMMIT WORK
    Variants:
    1. COMMIT WORK [AND WAIT].
    2. COMMIT CONNECTION con.
    Effect
    Terminates an SAP LUW and stores the changes.
    Variant 1
    COMMIT WORK [AND WAIT].
    Effect
    The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the currenta SAP LUW in the process. In this case, COMMIT WORK performs the following actions:
    It executes all subroutines registered using PERFORM ON COMMIT.
    It triggers an internal event in Object Services that ensures the registration of changes in persistent objects as the last update function module, as well as the subsequent initialization of persistent object attributes.
    It initiates the processing of all registered update function modules in the update work process.
    This executes all high-priority update function modules registered using CALL FUNCTION ... IN UPDATE TASK in the order of their registration and in a common database LUW. If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating). If you specify the addition AND WAIT, however, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).
    If all high-priority update function modules are completed successfully, the statement executes the low-priority update function modules together in a common database LUW.
    In parallel, it also executes the individual function modules registered using CALL FUNCTION ... IN BACKGROUND TASK DESTINATION in a separate database LUW for each destination.
    It handles all SAP locks set in the current program according to the value of the formal parameter _SCOPE of the corresponding lock function modules.
    It triggers a database commit that also terminates the current database LUW.
    The completion of statement COMMIT WORK triggers the event TRANSACTION_FINISHED of the system class CL_SYSTEM_TRANSACTION_STATE, where the parameter KIND has the value of the constant CL_SYSTEM_TRANSACTION_STATE=>COMMIT_WORK.
    If the statement COMMIT WORK is executed by calling special programs, be aware of the following:
    In a program executed using batch input, or if you have called the program using the USING addition of the statement CALL TRANSACTION, COMMIT WORK terminates the batch input processing when using the corresponding settings.
    In a program called using CALL DIALOG, COMMIT WORK initiates the processing of subroutines or updated function modules registered using PERFORM ... ON COMMIT and CALL FUNCTION ... IN UPDATE TASK. Therefore, it does not complete the current SAP LUW. The SAP LUW cannot be completed until you execute the COMMIT WORK statement in the calling program.
    You cannot execute the COMMIT WORK statement during the updating procedure or during the execution of subroutines registered using PERFORM ... ON {COMMIT|ROLLBACK}.
    System fields
    sy-subrc Meaning
    0 You have specified the AND WAIT addition, and the updating of the update function modules was successful.
    4 You have specified the AND WAIT addition, and the updating of the update function modules was not successful.
    The COMMIT WORK statement always sets sy-subrc to 0 if the AND WAIT addition is not specified.
    Note
    The COMMIT WORK statement closes all database cursors . Open SQL statements that access a database cursor later ( SELECT loop and FETCH) raise an exception that cannot be handled.
    Variant 2
    COMMIT CONNECTION con.
    Note
    This statement is for internal use only.
    It cannot be used in application programs.
    Effect
    The COMMIT command is not executed on the standard database, but only on the secondary database connection specified by con. con is the name of the database connection as it was specified in the table DBCON in the column CON_NAME. The database connection con can also be specified dynamically in the form (source_text) - the source_text field contains the name of the database connection. The source_text field must be of the type C or STRING.
    On the specified secondary database connection, the database commit:
    Closes all open database cursors (OPEN CURSOR)
    Releases all database locks
    Note
    Note that the COMMIT CONNECTION DEFAULT statement unlike COMMIT WORK executes a pure database commit on the DEFAULT connection.
    Exceptions
    Non-Catchable Exceptions
    Cause: COMMIT WORK is not possible in a FORM that was called using PERFORM ... ON COMMIT.
    Runtime Error: COMMIT_IN_PERFORM_ON_COMMIT
    Cause: COMMIT WORK is not allowed in the update.
    Runtime Error: COMMIT_IN_POSTING
    ROLLBACK WORK
    Variants:
    1. ROLLBACK WORK.
    2. ROLLBACK CONNECTION con.
    Effect
    Terminates a SAP-LUW without storing the changes.
    Variant 1
    ROLLBACK WORK.
    Effect
    The statement ROLLBACK WORK closes the current SAP-LUW and opens a new one. In doing so, all change requests of the current SAP-LUW are canceled. To do this, ROLLBACK WORK carries out the following actions:
    Executes all subprograms registered with PERFORM ON ROLLBACK.
    Deletes all subprograms registered with PERFORM ON COMMIT.
    Raises an internal exception in the Object Services that makes sure that the attributes of persistent objects are initialised.
    Deletes all update function modules registered with CALL FUNCTION ...IN UPDATE TASK from the VBLOG and deletes all transactional remote Function Calls registered with CALL FUNCTION ... IN BACKGROUND TASK from ARFCSSTATE and from ARFCSDATA.
    Removal of all SAP locks set in the current program in which the formal parameter _SCOPE of the lock function module was set to the value 2.
    Triggers a database rollback, which also ends the current database-LUW.
    After completion of the statement COMMIT WORK, the event TRANSACTION_FINISHED of the system class CL_SYSTEM_TRANSACTION_STATE is raised, in which the parameter KIND has the value of the constant CL_SYSTEM_TRANSACTION_STATE=>ROLLBACK_WORK.
    Variant 2
    ROLLBACK CONNECTION con.
    Note
    This statement is for internal use only.
    It cannot be used in application programs.
    Effect
    The ROLLBACK-statement is not executed on the standard database but only on the secondary database connection, specified through con. con is the name of the database connection as it was specified in table DBCON in column CON_NAME. The database connection con can also be specified dynamically in the form (source_text), in which the field source_text contains the name of the database connection. The field source_text must be of the type C or STRING.
    Notes
    As all opened database cursors on the respective database connections are closed at ROLLBACK, the attempt to continue a SELECT-loop after a ROLLBACK, leads to a runtime error. Due to the same reason, a FETCH after a ROLLBACK to the then closed cursor, leads to a runtime error. You have to make sure that cursors that are still open, are no longer used after ROLLBACK.
    After execution of the statement ROLLBACK, SY-SUBRC is always equal to 0. It is not necessary to check if SY-SUBRC is unequal to 0 after ROLLBACK.
    ROLLBACK must not be used during update (CALL FUNCTION ... IN UPDATE TASK) or during the execution of FORMs, which were registered with PERFORM ... ON COMMIT resp. PERFORM ...ON ROLLBACK.
    The statement ROLLBACK WORK is implicitly executed if a message of the type A is treated with the addition ERROR_MESSAGE when calling a function module with CALL FUNCTION.
    Exceptions
    Non-Catchable Exceptions
    Cause: ROLLBACK WORK is not allowed within a FORM that is called with PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK.
    Runtime Error: ROLLBACK_IN_PERFORM_ON_COMMIT
    Cause: ROLLBACK WORK is not allowed within an update.
    Runtime Error: ROLLBACK_IN_POSTING
    SET UPDATE TASK LOCAL
    Syntax
    SET UPDATE TASK LOCAL.
    Effect
    This statement specifies that the high-priority update function modules - registered during the current SAP LUW using CALL FUNCTION ... IN UPDATE TASK - are registered in the ABAP memory instead of the VBLOG database table. In addition, it specifies that the current work process and not the update work process run these modules during the current database LUW, when the COMMIT WORK statement is executed. This statement has no effect on low-priority update function modules.
    At the beginning of every SAP LUW, the local update function is deactivated. If you wish to use it, you must reactivate it again before the first update function module is registered.
    System fields
    sy-subrc Meaning
    0 The local update function is activated.
    1 The local update function has not been activated, because the program has already registered at least one update function module for the normal updating procedure in the current SAP-LUW.
    Notes
    The local update function performs a synchronous update according to the COMMIT WORK statement, independent of the addition AND WAIT.
    The occurrence of a database rollback during the local update affects all previous change requests.
    Regards
    vasu

Maybe you are looking for

  • Adobe reader not displaying the images

    I am trying to open pdf document includes with the images. Text is showing correctly but the images are grayed out. I can open same document with images in Nitro Pro but not with Adobe, that means no issue with the file damaging.

  • First PKGBUILD - looking for review

    Hello all, I have created my first PKGBUILD for some new scientific computing libraries and corresponding examples related to my field. I am looking for input before submitting this to the authors for inclusion on their site (and possibly to the AUR

  • Dreamweaver CS3 Not Displaying Some Images

    Hi, About a week ago, certain images that have always displayed correctly within Dreamweaver started appearing as the "broken page" icon. A table background image I just created today decided it was going to act up as well. These images display fine

  • Safari iCloud History Sync not working

    Good morning, I've read on forums, people annoyed by the sync of Safari History between iPhone, Mac, etc On my Mac (clean install) of Yosemite and iPhone 6 (clean install) iOS 8.1, it seems Safari doesn't sync the history. Although, tabs, reading lis

  • App created by Automator simply quits upon opening

    Made a great script that speaks my ical events. It runs beautifully in the automator app. So I saved it as an application. But when I try to run it; the app just quits. 2008-11-01 04:06:13 -0400: Find Events in iCal completed 2008-11-01 04:06:14 -040