FUNCTION MODULE TO COMMIT & ROLL BACK.

Hi all,
I am working on an interface , in case power interruptions  while running file extraction, the program should roll back completely and the the file should be scheduled  later.
could any body give suggest me the solution and  the function module name .
Regards
Sre

Hi,
for BAPI's to commit use FM BAPI_TRANSACTION_COMMIT
to undo all the changes use FM BAPI_CHARACT_ROLLBACK

Similar Messages

  • BAPI/FM to create commitment item which can be commit/roll back externally

    Hi experts,
    Is there any BAPI/FM to create commitment item????
    I can use BDC but problem is that it can't be roll back. In my requirement  i want to roll back based on condition.
    i am creating GL and commitment item, if GL creation is failed commitment item should be roll back.
    Is there way to solve this issue ? please help me.
    Thanks in advance.
    Regards.

    Hi ,
    There is no fm for commitment item, In BDC what you can do is create two recording with 'SAVE' button clicked & not clicked. For test run use the recording where save button is not clicked and for actual run the other.
    You can also have a look into the program RFFMMDBI85 where the function FM_COM_ITEM_NO_SCREEN_CREATE is used. In that particular fm you have a parameter callsed i_flg_test
    Edited by: Keshav.T on Feb 10, 2012 11:56 AM

  • Need a function module for commit

    Hi Experts,
    I have a requirement of displaying a PO report in alv and when the user clicks the po it showed navigate to ME23N to display the PO.
    Here the user can go in change mode to change some details in po, and when he returns back, the report should show the changes in the PO.
    I am able to update the report once the user return back to the report from ME23N.
    But only thing is there is a lag(5 Secs) of updating the database table when the user saves the PO.
    So we need to commit once the user return to the report and then fetch the data from database.
    I tried to use the " Commit work Statement" but it does't update as early.
    can some one please telll me some commit Fucntion module which can update the ME23N related tables qiuckly.?
    Regards,
    Venkatesh.

    >
    kartik tarla wrote:
    > since the same answer is already given above there's no need to post again.
    Especially when that answer is wrong...
    As we talk about a standard transaction here, the COMMIT is included in the standard transaction, so it does not make any sense to do it once more in an FM, or directly in the ABAP program (not mentioning that the LUW is closed already, so there is nothing to commit...)
    On the other hand, the replies with WAIT UP TO ... are very strange, because now the time is 5 seconds, but next time it could be 7 seconds, who knows... this is not a stabile solution.
    The only reply is worth considering is the one from Thomas!

  • Function module L_TO_CREATE_MULTIPLE and commit

    Hi,
    Does anyone knows if in one report I call function module L_TO_CREATE_MULTIPLE with parameter I_COMMIT_WORK = SPACE and if in the main report after the call of the function module i do a commit command that allows that the transfer order is created ? And are the tables received if the call of L_TO_CREATE_MULTIPLE correct with the information of the created transfer order ?
    Or in other way if I really want to create the transfer order, I must pass the parameter I_COMMIT_WORK = 'X' ?
    Thanks in advance,
    Paulo Sousa

    Hi Paulo,
    The main Idea here is COMMIT should get called once the callto Function module L_TO_CREATE_MULTIPLE is executed so it really doesn't makes different if you call L_TO_CREATE_MULTIPLE with I_COMMIT = 'X'
    or you call L_TO_CREATE_MULTIPLE with I_COMMIT = SPACE and later to this call to Function module do COMMIT WORK, both are effectively same.
    One thing that needs to be taken care is if you are calling L_TO_CREATE_MULTIPLE in LOOP you have to do COMMIT after each call.
    Hope this helps!
    Regards
    Shital

  • Difference between Function Module Vs Method in Class Module

    1) Can you please tell the difference between the Function module used in abap program and the method of the class module used in abap programming.
    2) does it necessary to do commit statement after calling the function module.
    Thankyou for you time.
    Bhaskar.

    Hi,
    1)
    Check this difference..
    The main difference between real object orientation and function groups is that although a program can work with the instances of several function groups at the same time, it cannot work with several instances of a single function group. Suppose a program wanted to use several independent counters, or process several orders at the same time. In this case, you would have to adapt the function group to include instance administration, for example, by using numbers to differentiate between the instances.
    2) COMMIT WORK is required for BAPI..And not required when you normally call a function module..Unless required ..
    Example
    Update function modules requires COMMIT WORK to execute the function module.
    Thanks,
    Naren

  • Problem with BAPI_TRANSACTION_COMMIT function module

    I am updating the two fields of a custom table through a custom BAPI function module.
    After this I am using "BAPI_TRANSACTION_COMMIT" function module to commit the LUW.
    but after calling this FM one field is updated in the table and another field is disappearing from the table.
    Could anybody help me in this please?

    Hi  RAJENDRA
    You can also update the table directly:
        UPDATE Table SET field1=Value1, field2=Value2, ... fieldN=ValueN
        WHERE Condition;
        commit work.
    Hope this information is help to you.
    Regards,
    José

  • Authorization to run function module

    I am facing a peculiar problem, We have 2 kinds of users in the system, one with debug display rights and other rights that a developer has, the second user has got authorization for TCODES and is a end user, i.e. Order-Delivery-Billing Rights.
    Now in the billing exit we have put a Function Module, which will do the some back end movement for the user. Now the dilemma is, the user with debug rights is able to do the transaction and the function module runs at the back end without the knowledge of the user, but when the end user runs the same T Code, the function module doesnu2019t run at the back end.
    How do I give authorization to the end user, so that function module runs in his ID even though he does not have debug rights, or what object has to be attached to the user??

    Execute the transaction SU53 just after run the program with the invalid user.
    This transaction shows yous what is the authoritation that is failed.
    Regards,

  • Commit for Asynchronous Function Module

    Halo Experts,
    I am working on an Perfomance Optimization project . I am trying to optimize the program by scehduling the individual methods inside the program via asynchronous function modules . By this way I can run this independent methods parallely ( and not sequentailly) . for eg
    if the program has
    me->m1( ).
    me->m2( ).
    me->m3( )
    if m2 and m3 are independent of each other I schedule them parallely by
    me->run_m2_m3_parallely(  ) see the below code
    CALL FUNCTION 'ZM2'
        STARTING NEW TASK 'FUNC1'
        DESTINATION 'NONE'
        CALLING ZCLASS=>set_flag_4_m2 ON END OF TASK.
    CALL FUNCTION 'ZM3'
        STARTING NEW TASK 'FUNC2'
        DESTINATION 'NONE'
        CALLING ZCLASS=>set_flag_4_m3 ON END OF TASK.
      WAIT UNTIL l_m2_flag = 'X' AND
                 l_m3_flag = 'X'.
    the FMs ZM2 and ZM3 are updating Z Database tables( say ZM2  and  ZM3 ) . Do I need an explicit commit work for Individual FMs or a single commit work for both the FMs.
    How can I roll back both the updates to the database if a dump occurs ?
    How should the commit work statement be in this case ?
    Regards
    Arshad

    I think you can solve your issue by using the KEEPING TASK addition.
    In your ZCLASS=>set_flag_4_m2 method try this:
    METHOD set_flag_4_m2.
      RECEIVE RESULTS FROM FUNCTION 'ZM2 ' KEEPING TASK.
    ENDMETHOD.
    METHOD set_flag_4_m3.
      RECEIVE RESULTS FROM FUNCTION 'ZM3 ' KEEPING TASK.
    ENDMETHOD.
    And after your wait you can try to do this:
    WAIT UNTIL l_m2_flag = 'X' AND
                 l_m3_flag = 'X'.
    * In set_func2_commited you must receive results from BAPI_tRANSACTION_COMMIT and set global flag g_func2_commit
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        STARTING NEW TASK 'FUNC2'
        DESTINATION 'NONE'
        CALLING ZCLASS=>set_func2_commited ON END OF TASK.
    * In set_func3_commited you must receive results from BAPI_tRANSACTION_COMMIT and set global flag g_func3_commit
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        STARTING NEW TASK 'FUNC3'
        DESTINATION 'NONE'
        CALLING ZCLASS=>set_func3_commited ON END OF TASK.
    WAIT UNTIL g_func3_commit EQ 'X' and g_func2_commit EQ 'X'.

  • Invalid COMMIT WORK in an update function module.

    Hi,Experts,
         Currently We got a problem for posting PO's GR with t-code MIGO. Our requirement is that can create Delivery by automaitcly after PO's GR is saving. Then I have tailored a program for creating delivery.The program will be triggered in an output type when saving action is done.
    Error info is as below
    "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."
    Any help will be appreciated
    Thanks in advance
    Richard Zhou

    Hi Richard,
    First create an implementation for the BADI in se19,
    then in any of the methods put break point and run MIGO
    You can clearly see in the debugger what all values come
    Please note that u have 2 methods
    one works in update task and another as normal function module..to view the documentation of the BADI->go to se18 -> enter the name of the BADI -> Display -> click on documentation to View the purpose and use of the BADI you have mentioned,Please note that all BADIs may not have documentations.............
    Also if u feel that the replies are helping you out please reward points....this way the SDN members will be willing to do a bit more homework for you and help you out...
    To proceed with the BADI
    Please check the documentation below
    Business add-ins when creating a material document
    The enhancement MB_DOCUMENT_BADI has two methods that are called up by the same interface, though at different times. All material document data from the following tables is transferred to this business add-in:
    MKPF (material document header)
    MSEG (material document items)
    VM07M (update data)
    This data can be used in other programs, but cannot be changed.
    The methods differ according to the time at which they are called up:
    The method MB_DOCUMENT_BEFORE_UPDATE is called up before the FI document is created. This means that it is called up even if the program is terminated by an error during the subsequent processing. The update of data in separate tables should always be contained in function modules that are called up with the addition 'in update task'. This ensures that all the data is updated consistently.
    The method MB_DOCUMENT_UPDATE is not carried out until update. This means that all updates are carried out immediately in their own tables and do not have to be contained in 'update task' in function modules. For performance reasons, you should not re-read the tables or carry out any time-consuming routines at this point.
    You should always call up MB_DOCUMENT_BEFORE_UPDATE before MB_DOCUMENT_UPDATE, particularly if time is a critical factor when posting the material documents. The method MB_DOCUMENT_UPDATE is processed after the FI document numbers are called. As a result, no other FI documents can be posted until this document is completely updated.
    Even if the two methods are in the same class, you cannot access the same global fields, as the methods are called up at different times and are therefore carried out in another roll area.
    From the business add-in display, you can go to coding examples for both methods by choosing Goto -> Example coding -> Display
    Note
    The enhancement does not transfer any data to the material document, that is, you cannot change material document data before it is updated.
    If this business add-in is not set up properly, it may result in an inconsistency between the documents and the stocks and between the material documents and the accounting documents. Inconsistencies like these may be caused by the following elements in the business add-in:
    COMMIT WORK
    Remote function call (CALL FUNCTION ... DESTINATION)
    Own updates in document tables or stock tables (for example, update in tables MBEW, MARD, MSEG)
    The unlocking of data (for example, via DEQUEUE_ALL)
    Before the two business add-ins are called up, data is already flagged for the UPDATE. If a COMMIT WORK or a Remote Function Call is transmitted in the enhancement, these are written in the database. If another error occurs after the business add-ins are processed, you cannot carry out a complete ROLL BACK, as the data up to the COMMIT or Remote Function Call has already been written in the database. This can result in an inconsistent status (for example, material document without accounting document), which can only be repaired with considerable cost and effort.
    The business add-ins are not suitable for customer-specific updates in the stock tables, as updates like these destroy the standard stock update.
    Unlocking the data (for example, via DEQUEUE_ALL) is also critical, as the data that is to be updated is no longer protected from updates from external systems, and inconsistencies can result from parallel updates.
    Before you activate an enhancement, check carefully that the business add-in does not contain any critical coding places.
    If data inconsistencies have already occurred in your system as a result of the business add-in, remove the critical coding so that it does not cause any further inconsistencies.
    Regards
    Byju

  • Differences between Commit work, Logical Unit of Work and Roll back work

    Hi all,
    Can any one explain me in details what is the difference between Commit Work, Logical Unit of Work and Roll back work. Pls explain by providing some example.
    and also explain me where and when these are used and what are the importance of using these.
    Thanks in advance.
    Regards
    Ramana Prasad.T

    Hi Ramana Prasad,
    A Logical Unit of Work (LUW or database transaction) is an inseparable sequence of database operations which must be executed either in its entirety or not at all. For the database system, it thus constitutes a unit.
    LUWs help to guarantee database integrity. When an LUW has been successfully concluded, the database is once again in a correct state. If, however, an error occurs within an LUW, all database changes made since the beginning of the LUW are canceled and the database is then in the same state as before the LUW started.
    An LUW begins
    o each time you start a transaction
    o when the database changes of the previous LUW have been confirmed (database
    commit) or
    o when the database changes of the previous LUW have been cancelled (database rollback)
    An LUW ends
    o when the database changes have been confirmed (database commit) or
    o when the database changes have been canceled (database rollback)
    COMMIT WORK.
    Executes a database commit and thus closes a logical processing unit or Logical Unit of Work ( LUW ) (see also Transaction processing ). This means that
    all database changes are made irrevocable and cannot be reversed with ROLLBACK WORK and
    all database locks are released.
    COMMIT WORK also
    calls the subroutines specified by PERFORM ... ON COMMIT * executes asynchronously any update requests (see CALL FUNCTION ... IN UPDATE TASK ) specified in these subroutines or started just before,
    processes the function modules specified in CALL FUNCTION ... IN BACKGROUND TASK ,
    cancels all existing locks (see SAP locking concept ) if no update requests exist,
    closes all open database cursors (see OPEN CURSOR ) and
    resets the time slice counter to 0.
    COMMIT WORK belongs to the Open SQL command set.
    Return code value
    The SY-SUBRC is set to 0.
    ROLLBACK WORK.
    Closes a logical processing unit by reversing all database changes made since the last COMMIT .
    You use this statement if you cannot be certain that all the database changes have been executed correctly.
    The update routines are not performed.
    ROLLBACK WORK belongs to the Open SQL command set.
    Note
    If the ROLLBACK statement occurs within a SELECT loop, the processing cannot continue because the database cursor is invalid. After the ROLLBACK statement, you should therefore ensure that all SELECT processing has been explicitly terminated.
    <b>Plz. Avoid Duplicate Threads.</b>
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Commit work and roll back with simple language and simple example

    hi guru
    commit work and roll back with simple language and simple example

    Hi,
    The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the current SAP LUW in the process. In this case, COMMIT WORK performs the following actions:
    It executes all subroutines registered using PERFORM ON COMMIT.
    The sequence is based on the order of registration or according to the priority specified using the LEVEL addition. Execution of the following statements is not permitted in a subroutine of this type:
    PERFORM ... ON COMMIT|ROLLBACK
    COMMIT WORK
    ROLLBACK WORK
    The statement CALL FUNCTION ... IN UPDATE TASK can be executed.
    ROLL BACK:
    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:
    1) Executes all subprograms registered with PERFORM ON ROLLBACK.
    2) Deletes all subprograms registered with PERFORM ON COMMIT.
    3) Raises an internal exception in the Object Services that makes sure that the attributes of persistent objects are initialised.
    4) Deletes all update function modules registered with CALL FUNCTION ...IN UPDATE TASK from the VBLOG database table and deletes all transactional remote Function Calls registered with CALL FUNCTION ... IN BACKGROUND TASK from database tables ARFCSSTATE and ARFCSDATA.
    5) 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.
    6) Triggers a database rollback, which also ends the current database-LUW.

  • Not able to use Commit after the function module STATUS_OBJECT_CREATE

    I am using function module   STATUS_OBJECT_CREATE
       CALL FUNCTION 'STATUS_OBJECT_CREATE'
              EXPORTING
               CHGKZ         = 'X'
               CLIENT        = SY-MANDT
                OBJNR         = LV_OBJNR3
                OBTYP         = 'IWE'
                STSMA         = 'ZS_RE_01'
              IMPORTING
                OBJNR         = LV_OBJNR3.
                STONR                        = LV_STONR.
            IF SY-SUBRC = 0.
                COMMIT WORK.
            ENDIF.
    i am getting error after the COMMIT WORK .
    I am not getting any issue in the function module .after the function module i am using the COMMIT WORK and i am getting the following error message
    Category               ABAP Programming Error
    Runtime Errors         SAPSQL_ARRAY_INSERT_DUPREC
    Except.                CX_SY_OPEN_SQL_DB
    ABAP Program           SAPLBSVU
    Application Component  CA-GTF-TS-SMT
    Date and Time          03/17/2014 07:01:29
    |Short text                                                                                        |
    |    The ABAP/4 Open SQL array insert results in duplicate database records.                       |
    |What happened?                                                                                    |
    |    Error in the ABAP Application Program                                                         |
    |                                                                                                  |
    |    The current ABAP program "SAPLBSVU" had to be terminated because it has                       |
    |    come across a statement that unfortunately cannot be executed.                                |
    |What can you do?                                                                                  |
    |    Note down which actions and inputs caused the error.                                          |
    |                                                                                                  |
    |                                                                                                  |
    |    To process the problem further, contact you SAP system                                        |
    |    administrator.                                                                                |
    |                                                                                                  |
    |    Using Transaction ST22 for ABAP Dump Analysis, you can look                                   |
    |    at and manage termination messages, and you can also                                          |
    |    keep them for a long time.                                                                    |
    |Error analysis                                                                                    |
    |    An exception occurred that is explained in detail below.                                      |
    |    The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught                 |
    |     in                                                                                           |
    |    procedure "STATUS_UPDATE" "(FUNCTION)", nor was it propagated by a RAISING                    |
    |     clause.                                                                                      |
    |    Since the caller of the procedure could not have anticipated that the                         |
    |    exception would occur, the current program is terminated.                                     |
    |    The reason for the exception is:                                                              |
    |    If you use an ABAP/4 Open SQL array insert to insert a record in                              |
    |    the database and that record already exists with the same key,                                |
    |    this results in a termination.                                                                |
    |                                                                                                  |
    |    (With an ABAP/4 Open SQL single record insert in the same error                               |
    |    situation, processing does not terminate, but SY-SUBRC is set to 4.)                          |
    |How to correct the error                                                                          |
    |    Use an ABAP/4 Open SQL array insert only if you are sure that none of                         |
    |    the records passed already exists in the database.                                            |
    |                                                                                                  |
    |    If the error occures in a non-modified SAP program, you may be able to                        |
    |    find an interim solution in an SAP Note.                                                      |
    |    If you have access to SAP Notes, carry out a search with the following                        |
    |    keywords:                                                                                     |
    |                                                                                                  |
    |    "SAPSQL_ARRAY_INSERT_DUPREC" "CX_SY_OPEN_SQL_DB"                                              |
    |    "SAPLBSVU" or "LBSVUU01"                                                                      |
    |    "STATUS_UPDATE"                                                                               |
    |                                                                                                  |
    |    If you cannot solve the problem yourself and want to send an error                            |
    |    notification to SAP, include the following information:                                       |
    |                                                                                                  |
    |    1. The description of the current problem (short dump)                                        |
    |                                                                                                  |
    |       To save the description, choose "System->List->Save->Local File                            |
    |    (Unconverted)".                                                                               |
    |                                                                                                  |
    |    2. Corresponding system log                                                                   |
    |                                                                                                  |
    |       Display the system log by calling transaction SM21.                                        |
    |       Restrict the time interval to 10 minutes before and five minutes                           |
    |    after the short dump. Then choose "System->List->Save->Local File                             |
    |    (Unconverted)".                                                                               |
    |                                                                                                  |
    |    3. If the problem occurs in a problem of your own or a modified SAP                           |
    |    program: The source code of the program                                                       |
    |       In the editor, choose "Utilities->More                                                     |
    |    Utilities->Upload/Download->Download".                                                        |
    |                                                                                                  |
    |    4. Details about the conditions under which the error occurred or which                       |
    |    actions and input led to the error.                                                           |
    |                                                                                                  |
    |    The exception must either be prevented, caught within proedure                                |
    |    "STATUS_UPDATE" "(FUNCTION)", or its possible occurrence must be declared in                  |
    |     the                                                                                          |
    |    RAISING clause of the procedure.                                                              |
    |    To prevent the exception, note the following:                                                 |
    |System environment                                                                                |
    |    SAP Release..... 702                                                                          |
    |    SAP Basis Level. 0010                                                                         |
    |                                                                                                  |
    |    Application server... "sds6ci"                                                                |
    |    Network address...... "11.224.101.53"                                                         |
    |    Operating system..... "Linux"                                                                 |
    |    Release.............. "2.6.18-194.el5"                                                        |
    |    Hardware type........ "x86_64"                                                                |
    |    Character length.... 16 Bits                                                                  |
    |    Pointer length....... 64 Bits                                                                 |
    |    Work process number.. 17                                                                      |
    |    Shortdump setting.... "full"                                                                  |
    |                                                                                                  |
    |    Database server... "gctsdb01lds.hsi.hugh"                                                     |
    |    Database type..... "ORACLE"                                                                   |
    |    Database name..... "DS6"                                                                      |
    |    Database user ID.. "SAPDS4"                                                                   |
    |                                                                                                  |
    |    Terminal.......... "GCTEMP02VDI"                                                              |
    |                                                                                                  |
    |    Char.set.... "C"                                                                              |
    |                                                                                                  |
    |    SAP kernel....... 720                                                                         |
    |    created (date)... "Sep 14 2013 05:28:14"                                                      |
    |    create on........ "Linux GNU SLES-9 x86_64 cc4.1.2 use-pr130820"                              |
    |    Database version. "OCI_102, 10.2.0.5.0, V2, default"                                          |
    |                                                                                                  |
    |    Patch level. 500                                                                              |
    |    Patch text.. " "                                                                              |
    |                                                                                                  |
    |    Database............. "ORACLE 10.1.0.*.*, ORACLE 10.2.0.*.*, ORACLE 11.2.*.*.*"               |
    |    SAP database version. 720                                                                     |
    |    Operating system..... "Linux 2.6, Linux 3"                                                    |
    |                                                                                                  |
    |    Memory consumption                                                                            |
    |    Roll.... 1317248                                                                              |
    |    EM...... 0                                                                                    |
    |    Heap.... 0                                                                                    |
    |    Page.... 0                                                                                    |
    |    MM Used. 1242912                                                                              |
    |    MM Free. 53400                                                                                |
    |User and Transaction                                                                              |
    |    Client.............. 160                                                                      |
    |    User................ "DV018458"                                                               |
    |    Language key........ "E"                                                                      |
    |    Transaction......... "SE38 "                                                                  |
    |    Transaction ID...... "5323C30FC9364665E10000000BE06533"                                       |
    |                                                                                                  |
    |    EPP Whole Context ID.... "002655EE0F241ED3ABB7D81260A28C44"                                   |
    |    EPP Connection ID....... 00000000000000000000000000000000                                     |
    |    EPP Caller Counter...... 0                                                                    |
    |                                                                                                  |
    |    Program............. "SAPLBSVU"                                                               |
    |    Screen.............. "RSM13000 3000"                                                          |
    |    Screen Line......... 2                                                                        |
    |    Debugger Active..... "none"                                                                   |
    |Information on where terminated                                                                   |
    |    Termination occurred in the ABAP program "SAPLBSVU" - in "STATUS_UPDATE".                     |
    |    The main program was "RSM13000 ".                                                             |
    |                                                                                                  |
    |    In the source code you have the termination point in line 60                                  |
    |    of the (Include) program "LBSVUU01".                                                          |
    |    The program "SAPLBSVU" was started in the update system.                                      |
    |    The termination is caused because exception "CX_SY_OPEN_SQL_DB" occurred in                   |
    |    procedure "STATUS_UPDATE" "(FUNCTION)", but it was neither handled locally nor                |
    |     declared                                                                                     |
    |    in the RAISING clause of its signature.                                                       |
    |                                                                                                  |
    |    The procedure is in program "SAPLBSVU "; its source code begins in line                       |
    |    1 of the (Include program "LBSVUU01 ".                                                        |
    |Source Code Extract                                                                               |
    |Line |SourceCde                                                                                   |
    |   30|  LOOP AT jsto_upd WHERE chgkz = 'X'.                                                       |
    |   31|    CHECK: jsto_upd-chgnr > '000',                                                          |
    |   32|           jsto_upd-stsma NE jsto_upd-stsma_old.                                            |
    |   33|    CLEAR jcdo_tab.                                                                         |
    |   34|    MOVE-CORRESPONDING jsto_upd TO jcdo_tab.                                                |
    |   35|    MOVE-CORRESPONDING chdat    TO jcdo_tab.                                                |
    |   36|    jcdo_tab-stsma_new = jsto_upd-stsma.                                                    |
    |   37|    APPEND jcdo_tab.                                                                        |
    |   38|  ENDLOOP.                                                                                  |
    |   39|* Änderungen zu Einzelstatus (Insert)                                                       |
    |   40|  LOOP AT jest_ins WHERE chgkz = 'X'.                                                       |
    |   41|    CHECK jest_ins-chgnr > '000'.                                                           |
    |   42|    CLEAR jcds_tab.                                                                         |
    |   43|    MOVE-CORRESPONDING jest_ins TO jcds_tab.                                                |
    |   44|    MOVE-CORRESPONDING chdat    TO jcds_tab.                                                |
    |   45|    jcds_tab-chind = 'I'.                                                                   |
    |   46|    APPEND jcds_tab.                                                                        |
    |   47|  ENDLOOP.                                                                                  |
    |   48|* Änderungen zu Einzelstatus (Update)                                                       |
    |   49|  LOOP AT jest_upd WHERE chgkz = 'X'.                                                       |
    |   50|    CHECK jest_upd-chgnr > '000'.                                                           |
    |   51|    CLEAR jcds_tab.                                                                         |
    |   52|    MOVE-CORRESPONDING jest_upd TO jcds_tab.                                                |
    |   53|    MOVE-CORRESPONDING chdat    TO jcds_tab.                                                |
    |   54|    jcds_tab-chind = 'U'.                                                                   |
    |   55|    APPEND jcds_tab.                                                                        |
    |   56|  ENDLOOP.                                                                                  |
    |   57|* Verbuchung Statusobjekte                                                                  |
    |   58|  DESCRIBE TABLE jsto_ins LINES sy-tabix.                                                   |
    |   59|  IF sy-tabix > 0.                                                                          |
    |>>>>>|    INSERT jsto CLIENT SPECIFIED                                                            |
    |   61|                FROM TABLE jsto_ins.                                                        |
    |   62|  ENDIF.                                                                                    |
    |   63|  DESCRIBE TABLE jsto_upd LINES sy-tabix.                                                   |
    |   64|  IF sy-tabix > 0.                                                                          |
    |   65|    field-symbols <fs_jsto_line> like jsto_upd.                                             |
    |   66|    loop at jsto_upd assigning <fs_jsto_line>.                                              |
    |   67|      IF <fs_jsto_line>-chgnr = '000'.                                                      |
    |   68|        <fs_jsto_line>-chgnr = '999'.                                                       |
    |   69|      ENDIF.                                                                                |
    |   70|* on change of status profile delete user status related to old profile                     |
    |   71|      IF <fs_jsto_line>-STSMA NE <fs_jsto_line>-STSMA_OLD.                                  |
    |   72|        DELETE FROM JEST CLIENT SPECIFIED WHERE                                             |
    |   73|               MANDT = <fs_jsto_line>-MANDT AND                                             |
    |   74|               OBJNR = <fs_jsto_line>-OBJNR AND                                             |
    |   75|               STAT  LIKE 'E%'.                                                             |
    |   76|        DELETE FROM JCDS CLIENT SPECIFIED WHERE                                             |
    |   77|               MANDT = <fs_jsto_line>-MANDT AND                                             |
    |   78|               OBJNR = <fs_jsto_line>-OBJNR AND                                             |
    |   79|               STAT  LIKE 'E%'.                                                             |

    i tried with out using commmit but it is not creating Status.
    When i see the function module help and they are trying to COMMIT
    FU STATUS_OBJECT_CREATE
    Short Text
    Create Status Object
    Functionality
    The function module generates a status object.
    Take the object number from the object number management (function modules OBJECT_NUMNBER_GET_xx).
    If no object number is given, the module takes a temporary object number that must be replaced later (function module STATUS_OBJECT_SWITCH_NUMBER).
    Example
    Creating an internal order with number 100123 (object type "ORC") for status profile "STATSCHEM" with final object number
    call function 'OBJECT_NUMBER_GET_OR'
      exporting
        aufnr = '100123'
      importing objnr = objektnummer.
    call function 'STATUS_OBJECT_CREATE'
      exporting
        objnr = objektnummer
        obtyp = 'ORC'
        stsma = 'STATSCHEM'.
    commit work.
    Creating the same order with a temporary object number
    data: objectkey like ionra.
    * TBO00-REFSTRUCT for object type 'OR' is 'IONRA'
    objectkey-aufnr = '100123'.
    call function 'STATUS_OBJECT_CREATE'
      exporting
        i_objectkey = objectkey
        obtyp       = 'ORC'
        stsma       = 'STATSCHEM'.
      importing
        objnr       = objektnummer.
    call function 'OBJECT_NUMBER_GET_OR'
      exporting
        aufnr = '100123'
      importing objnr = objektnummer_neu.
    call function 'STATUS_OBJECT_SWITCH_NUMBER'
      exporting
        objnr_old = objektnummer
        objnr_new = objektnummer_neu.
    commit work.
    Notes

  • How to take back the control from RFC function module to calling program

    Hi,
    In our system landscape, more than 200 child systems are connected to Solution manager(SMP). I have copied a RFC enabled function module into all the child systems and calling that FM from Sol Man in sychronous mode.
    Here goes my code in SolMan.
    LOOP AT it_dest INTO wa_dest.
      CALL FUNCTION 'Z_GET_LOGIN_DETAILS' DESTINATION wa_dest-rfcdest
        EXPORTING
          date_fr               = s_date-low
          date_to               = s_date-high
        TABLES
          tab_data              = it_val
        EXCEPTIONS
          communication_failure = 1
          system_failure        = 2
          OTHERS                = 3.
      IF sy-subrc EQ 0.
    *     Updates zuserlogon
          MODIFY zt_logon_det FROM TABLE it_val.
          COMMIT WORK.
          WRITE:/'RFC for Destination', wa_dest-rfcdest, 'succesfully updated.'.
      ELSE.
          WRITE:/'RFC for Destination', wa_dest-rfcdest, ' failed.'.
      ENDIF.
    ENDLOOP.
    Few child systems are very slow & takes more than 20 minutes(Many of the times system hangs) to return the result. But I should not wait for so long. Even if the child system doesn't return any values in 5 minutes I shoud continue with other system ignoring the current one.
    I tried calling the FM in asynchronous mode(STARTING NEW TASK) but no success because only 6 DIA processes possible but as I said I have more than 200 systems connected to SolMan.
    Please help me resolving this problem.
    Thanks,
    Prathap

    If there are only few child systems with bad response time, use asynchronous call using a CALL FUNCTION func STARTING NEW TASK task DESTINATION dest PERFORMING subr or CALLING meth ON END OF TASK. Count asynchronous calls still running/waiting (increment a counter when creating a task (not the one used for task id). In the form/method performed at end of a call decrement the counter. When counter is lower than a limit, 4-5 if 6 processes (*), perform an asynchronous call else perform a synchronous call or wait until the counter falls below the limit.
    Regards,
    Raymond
    (*) Use SPBT_INITIALIZE at start of program to get actual number of free/available processes.

  • Function module to read Comma Seperated File (CSV)

    Hi,
    Is there any Function module to read CSV file from presentation server or Application server?
    Regards,
    Madhu

    Hi madhukeshwar,
    1. Exactly for this purpose,
    i have developed an independent FORM
    where we give inputs
    a) file name (eg. abcd.txt)
    b) separator (eg , COMMA in your case)
    c) internal table (eg. t001)
    2. It will provide the data
    in proper format
    (no matter what the separator)
    (it can work with any kind of separator)
    3. just copy paste in new program.
    REPORT abc.
    change your table declaration and file name
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    PERFORM myupload TABLES t001 USING 'd:\t001.txt' ','.
    BREAK-POINT.
    in debug see t001
    INDEPENDENT FORM
    FORM myupload TABLES orgtab
    USING filename separator.
    Data
    DATA : BEGIN OF itab OCCURS 0,
    myline(1000) TYPE c,
    END OF itab.
    DATA : extension(5) TYPE c.
    DATA : name(100) TYPE c.
    DATA : newfilename TYPE string.
    Step 1
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = filename
    TABLES
    data_tab = itab.
    Step 2
    LOOP AT itab.
    REPLACE ALL OCCURRENCES OF separator IN itab-myline WITH
    cl_abap_char_utilities=>horizontal_tab.
    MODIFY itab.
    ENDLOOP.
    Step 3
    DATA : path LIKE pcfile-path.
    path = filename.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    extension = extension
    name = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    invalid_drive = 1
    invalid_extension = 2
    invalid_name = 3
    invalid_path = 4
    OTHERS = 5
    Step 4
    newfilename = filename.
    REPLACE name IN newfilename WITH 'temp'.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = newfilename
    TABLES
    data_tab = itab
    FIELDNAMES =
    Step 5
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = newfilename
    has_field_separator = 'X'
    TABLES
    data_tab = orgtab.
    ENDFORM. "myupload
    3.
    regards,
    amit m.

  • Invalid COMMIT WORK in an update function module. in VKM1 Tcode

    Hi All,
    I am getting the short dump with message "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.
    in FM : SO_DOCUMENT_SEND_API1
    Prev. it was giving error in one of my driver program where I had written the commi Work after calling FM for sending fax :
    "CONVERT_OTF_AND_FAX" .
    call function 'CONVERT_OTF_AND_FAX'
        exporting
          FAXOPTIONS = W_ITCPP
          USER       = NAST-USNAM
        importing
          MSGID      = W_MSGID
          MSGNO      = W_MSGNO
          MSGV1      = W_MSGV1
          MSGV2      = W_MSGV2
          MSGV3      = W_MSGV3
          MSGV4      = W_MSGV4
        tables
          OTF        = IT_OTF.
    if sy-subrc eq 0.
      commit work.
      submit RSCONN01 with MODE = 'FAX' and return.
    endif.
    Please explain me where and how I can change my code so that this error should not come?
    Rgds.
    MAdhuri

    Hello, Suhas!
    I am getting the short dump with message "Invalid COMMIT WORK in a COMMIT WORK or ROLLBACK WORK."
    Short text
        Invalid COMMIT WORK in a COMMIT WORK or ROLLBACK WORK.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "CL_FDT_CC_SERVICES============CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        The call of a COMMIT WORK in a FORM, that will not be executed until
        the commit or rollback point of the caller using the variant
        PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK is not permitted.
    etc.
    Could you help me to solve the issue?
    Regards,
    Kseniya Tsyganchuk

Maybe you are looking for