* Commit work on table  using UPDATE statement.*

HI,
   This is Anil . I have problem regarding Commit work and Wait up to 2 seconds.
I am using Commit work on one Update table statement but it is not working . While doing debugging it is working
(means it is updating Table.) but while running the transaction directly it is not updating the table.
Check the statements :
Commit work.
Some Select stmt on <table>.
IF <condition.>
Update  <table > statement.
if sy-subrc EQ 0.
    Commit work . ( This is not working while running transaction mean it is not updating table. While debuggint it it updating table.)
     wait up to 2 seconds.
endif.
endif.
Will that above Commit work causing any problem or  what is the reason it is not updating table.
Please give some suggestion in this case.
Regards,
Anilreddy.

Hi
the below code with commit work is working finr for me.
only thing i suggest is to check sy-subrc value.
commit work.
update spfli set test = '1234' where carrid = 'AA'.
if sy-subrc eq 0.
commit work.
wait up to 2 seconds.
endif.
write: / sy-subrc.

Similar Messages

  • Updating data without using update statement

    Hi,
    A quick question...
    Can any table data could be updated without using update statement from backend.
    Just wanted to make sure.
    Thanks in advance.

    Hi,
    What is your definition of Update?
    Since your question is vague and you dont explain what exactly you mean.
    here are my thoughts
    1) A record can be deleted and isnerted with new values.Where the nes values have only few columns changed from previous ones.
    2) I use pl/sql developer.If i need to update i can write select.. for update.Change the values (as in notepad)Commit.
         This is infact a update but with nice UI
    3) even your application can update data in your tables, if you code it and give correct privileges to the userRegards,
    Bhushan

  • FETCHING VALUES IN MULTI RECORD BLOCK FROM ANOTHER TABLE USING SELECT STATEMENT.

    Hi,
    I have one multi record block in which i want to fetch values
    (more then one record) from another table using select statement
    IN KEY NEXT ITEM.I am getting following error.
    ORA-01422: exact fetch returns more than requested number of rows
    Thanks in advance.

    In your case I see no reason to use non-database block and to try to populate it from a trigger with a query, instead of using the default forms functionality where you can associate the block and the fields with table, create where clause using bind variables and simply use execute_query() build-in to populate the block. The power of the forms is to use their build-in functionality to interact with the database.
    Also, you can base your block on a query, not on a table and you dynamically change this query using set_block_property() build-in. You can use any dynamic queries (based on different data sources) and you simply need to control the column's data type, the number of the columns and their aliases. Something like creating inline views as a block data source.
    However, you can replace the explicit cursor with implicit one like
    go_block('non_db_block_name');
    first_record();
    FOR v_tab IN (SELECT *
    FROM tab
    WHERE col_name = :variable)
    LOOP
    :non_db_block_name.field1 := v_tab.col1;
    :non_db_block_name.field2 := v_tab.col2;
    next_record();
    END LOOP;

  • Copy records of one table into another using Update statement

    Supposing I have 2 tables test and test1.
    Test has columns col1 and col2. and test1 has only one table col1.
    select * from test returns:
    COL1 COL2
    a
    b
    c
    d
    e
    select * from test1 returns
    COL1
    p
    q
    r
    s
    t
    Suppose i want to copy values of test1.col1 to test.col2 so tht final result of
    select * from test should be
    COL1 COL2
    a p
    b q
    c r
    d s
    e t
    I found a query in the OCP introduction book:
    update test set col2=(select col1 from test11)
    this works fine only when we have a single record in test1 table but fails otherwise.
    how can this be achieved using the update statement ?

    SQL> desc test
    Name Null? Type
    COL1 VARCHAR2(10)
    COL2 VARCHAR2(30)
    SQL> desc test1
    Name Null? Type
    COL1 VARCHAR2(10)
    SQL> insert into test values ('a','');
    1 row created.
    SQL> insert into test values ('b','');
    1 row created.
    SQL> insert into test values ('c','');
    1 row created.
    SQL> insert into test values ('d','');
    1 row created.
    SQL> insert into test1 values ('e');
    1 row created.
    SQL> insert into test1 values ('f');
    1 row created.
    SQL> insert into test1 values ('g');
    1 row created.
    SQL> insert into test1 values ('h');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> ed
    Wrote file afiedt.buf
    1 select a.col1, b.col1, a.rn from
    2 (select row_number() over (order by col1) rn, col1 from test) a,
    3 (select row_number() over (order by col1) rn, col1 from test1) b
    4* where a.rn = b.rn
    SQL> /
    COL1 COL1 RN
    a e 1
    b f 2
    c g 3
    d h 4
    SQL> ed
    Wrote file afiedt.buf
    1 update test set col1 =
    2 (
    3 select forupd from (
    4 select a.col1, b.col1 test1col, a.col1||' '||b.col1 forupd, a.rn from
    5 (select row_number() over (order by col1) rn, col1 from test) a,
    6 (select row_number() over (order by col1) rn, col1 from test1) b
    7 where a.rn = b.rn
    8* ) z where z.col1 = test.col1)
    SQL> /
    4 rows updated.
    SQL> commit;
    Commit complete.
    SQL> select * from test;
    COL1 COL2
    a e
    b f
    c g
    d h
    SQL>
    This will work only if you have the same number of lines in COL1 in both tables. If you have different number of lines, then you need to code more at join (outer, inner).
    But for complicated cases, please post sample data.
    Michael
    PS: And supossing that the values are distinct in TEST table. Else update will fail, because more rows will be retrived.
    If more values in TEST table in COL1, then you need to assign a row number on TEST also, and in WHERE of query you need to place one more join condition:
    something like:
    8* ) z where z.col1 = test.col1
    and z.rn = test.rn)
    SQL> /
    But as i said, get more specifications.
    Message was edited by:
    kjt
    Added the PS.

  • Error in updating custom database table using UPDATE SET Command

    Hi,
    I developed an automated collection system program in one of our clients simulating FBE1 (Payment Advice Creation) and F-28 (Posting of Incoming Payments) transaction codes. Upon posting, we encountered an error in PRD server wherein, for some of the posted items, the STATUS field in our custom table was not successfully updated. We tried to reverse the clearing document and debug the program. Upon posting, we were able to successfully update the status. We could not simulate the error in QAS since all the postings in QAS were successful and all status' relating to these postings were updated as well. We tried posting multiple times and the program seems to be working fine. In PRD, this behavior is just random and there is no specific pattern as to how the error occured. Provided below is the code I used for updating custom table ZFIACSF28. The STATUS field should be equal to '4' once the posting is successful. We are not sure if this is a database related issue. 7 users are authorized to do the postings in PRD and they are using the same user account.
    CODE:
      CALL TRANSACTION 'F-28' USING gt_bdcdata
                              MODE   'E'
                              UPDATE 'S'
                              MESSAGES INTO gt_messtab.
      READ TABLE gt_messtab INTO wa_messtab WITH KEY msgtyp = 'S'
                                                     msgnr  = '312'.
      IF sy-subrc EQ 0.
    update status for items cleared bearing the same OR Number*
        UPDATE zfiacsf28 SET status       = '4'
                             zsapdocument = wa_messtab-msgv1(10)
                             zruntime     = sy-uzeit
                             zrundate     = sy-datum
                       WHERE zor          = gv_zor
                       AND   customer     = gv_customer.
        COMMIT WORK.
    ENDIF.

    Hi,
    it's not possible that status isn't updated in zfiacsf28 while date and time are updated there, because it's hard coded.
    There must be other programs that also change your table zfiacsf28 and maybe clear those fields. Maybe the key fields zor and customer cannot provide  duplicate access, what is the meaning of field zor ?
    Please check the where used list of table zfiacsf28 to find other update programs.
    Regards,
    Klaus

  • How to lock a row before update using UPDATE statement ?

    I want to lock a row before updating using the UPDATE statement! is there any "reserved word" that I can append to an update statement so, that the row get locked!, also, will the lock gets released automatically once the update is done or do I have to explicitly release the lock?
    how can I do this ?
    any help is greatly appreciated.
    Thanks,
    Srini.

    For detail information, see http://otn.oracle.com/doc/server.815/a67779/ch4l.htm#10900
    The lock will be released by "commit".
    FOR UPDATE Examples
    The following statement locks rows in the EMP table with clerks located in New York and locks rows in the DEPT table with departments in New York that have clerks:
    SELECT empno, sal, comm
    FROM emp, dept
    WHERE job = 'CLERK'
    AND emp.deptno = dept.deptno
    AND loc = 'NEW YORK'
    FOR UPDATE;
    The following statement locks only those rows in the EMP table with clerks located in New York. No rows are locked in the DEPT table:
    SELECT empno, sal, comm
    FROM emp, dept
    WHERE job = 'CLERK'
    AND emp.deptno = dept.deptno
    AND loc = 'NEW YORK'
    FOR UPDATE OF emp.sal;

  • COMMIT WORK AND WAIT USE

    Hi Friends,
    what is mean by COMMIT WORK AND WAIT.
    when we use ths syntax...??
    situation pls.
    regards,
    venu.

    Hi,
    To apply the changes made to the runtime objects of persistent classes to the actual persistent objects in the database, execute the COMMIT WORK statement. (Alternatively, use COMMIT WORK AND WAIT or SET UPDATE TASK LOCAL). Unless you are executing an object-oriented transaction from within the Transaction Service, you must include the COMMIT WORK statement explicitly in the program. Otherwise, it is encapsulated in the Transaction Service. (If you explicitly include the COMMIT WORK statement as described here, the t op-level transaction runs in compatibility mode).
    The function of the COMMIT WORK statement is extended when you use it in conjunction with Object Services. Before COMMIT WORK closes the SAP LUW and triggers an update, it calls internal methods of the Persistence Service. These methods bundle the changes made to managed objects of the Persistence Service and pass them to a special update function module using CALL FUNCTION ... IN UPDATE TASK. Thus the Persistence Service works with traditional update methods. The update module is usually registered after any update modules that have already been registered. The update is then triggered and the update task executes the update module in the order in which they were registered.
    After the system executes the COMMIT WORK statement, it sets the attributes of each persistent object in the ABAP program to initial. (That is, it calls the IF_OS_STATE~INVALIDATE method).
    Local Update
    If you want to change managed objects directly, rather than using the update module, you must change the update mode of the implicitly used Transaction Service. That is, the following statements must be executed before the COMMIT WORK statement:
    DATA TM type ref to IF_OS_TRANSACTION_MANAGER.
    DATA T type ref to IF_OS_TRANSACTION.
      TM = CL_OS_SYSTEM=>GET_TRANSACTION_MANAGER( ).
    T = TM->GET_CURRENT_TRANSACTION( ).
    T->SET_MODE_UPDATE( OSCON_DMODE_DIRECT ).
    COMMIT WORK.
    To ensure database consistency, the local update is activated internally using SET UPDATE TASK LOCAL. In such cases, the system raises an exception if there are already update modules registered in the update task. You can only register additional classical update modules after setting the mode. They will then also be updated locally.
    COMMIT
    Basic form
    COMMIT WORK.
    Addition
    ... AND WAIT
    Effect
    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.
    Notes
    All subroutines called with PERFORM ... ON COMMIT are processed in the LUW concluded by the COMMIT WORK command. All V1 update requests specified in CALL FUNCTION ... IN UPDATE TASK are also executed in one LUW . When all V1 update requests have been successfully concluded, the V2 update requests ("update with start delayed") are processed, each in one LUW . Parallel to this, the function modules specified in CALL FUNCTION ... IN BACKGROUND TASK are each executed in one LUW per destination.
    COMMIT WORK commands processed within CALL DIALOG processing
    - execute a database commit (see above),
    - close all open database cursors,
    - reset the time slice counter and
    - call the function modules specified by CALL FUNCTION IN
    BACKGROUND TASK in the CALL DIALOG processing.
    However, subroutines and function modules called with PERFORM ... ON COMMIT or CALL FUNCTION ... IN UPDATE TASK in the CALL DIALOG processing are not executed in the calling transaction until a COMMIT WORK occurs.
    Since COMMIT WORK closes all open database cursors, any attempt to continue a SELECT loop after a COMMIT WORK results in a runtime error. For the same reason, a FETCH after a COMMIT WORK on the now closed cursors also produces a runtime error. You must therefore ensure that any open cursors are no longer used after the COMMIT WORK .
    With batch input and CALL TRANSACTION ... USING , COMMIT WORK successfully concludes the processing.
    Addition
    ... AND WAIT
    Effect
    The addition ... AND WAIT makes the program wait until the type V1 updates have been completed.
    The return code value is set as follows:
    SY-SUBRC = 0 The update was successfully performed.
    SY-SUBRC <> 0 The update could not be successfully performed.
    Note
    Runtime errors
    COMMIT_IN_PERFORM_ON_COMMIT : COMMIT WORK is not allowed in a FORM callled with PERFORM ... ON COMMIT .
    COMMIT_IN_POSTING : COMMIT WORK is not allowed in the update task.
    if its useful reward points

  • How to use Update Statement in ODI Procedure

    Hi,
    How can I use an update statement inside an ODI procedure.
    Thanks

    Hi,
    You do not need the BEGIN and END. ODI procedures are free text, so you can simply write your update statement, as you would in toad/sql developer etc etc. Just make sure you set the Technology and the logical schema. It is how ever best practice to also use the API:
    <%=odiRef.getSchemaName("YOUR_LOGICAL_SCHEMA_NAME", "D")%>. to prefix tables. This way, you select data from different schema's in the same instance (as long a your user has the correct privs).
    Cheers
    Bos
    Edited by: Bos on Jun 22, 2011 3:09 PM

  • JDBC and using update statements

    I have a program that connects to a microsoft access DB using JDBC-ODBC Bridge, but i dnt know how to write a correct update statement. I use servlets & it should call a function that retrieves a specific value, adds 1 to that integer value and updates the DB,but it didn't work. i also need to know how to delete all records in a DB.
    Thanks in advance

    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.sql.*;
    public class first_count extends HttpServlet {
       private Statement statement = null;
       private Connection connection = null;
       private String URL = "jdbc:odbc:rjdemo";
       public void init( ServletConfig config )
          throws ServletException
          super.init( config );
          try {
      Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
          connection =DriverManager.getConnection( URL, "", "" );
            }//try
           catch ( Exception e )
             e.printStackTrace();
             connection = null;
          }//catch
       public void doPost( HttpServletRequest req,
                           HttpServletResponse res )
          throws ServletException, IOException
          String cnt;
          cnt = req.getParameter( "big" );
    //takes the parameter of a radio button in a form
         PrintWriter out = res.getWriter();
          res.setContentType( "text/html" );
         if ( cnt.equals("big1"))
    //if the value of the radio button equals big1
             int i=0;
             out.println("The number retrieved = " + big_counter(i));
                      }//if
            out.close();
    int big_counter(int i)
          try {
             i=0;
             statement = connection.createStatement();
             ResultSet r= statement.executeQuery("select beg_count from User");
             r.first();
             i=r.getInt("beg_count");
    //the name of column is beg_count it's a number
             i++;
             statement.executeUpdate("UPDATE User SET beg_count="+i);
             statement.close();
          }//try
          catch ( Exception e )
          }//catch
    return i;
       public void destroy()
          try {
             connection.close();
          catch( Exception e ) {

  • Fill table using different statements for each field (newbie question)

    Hi all, I'm about to fill table table1 (field1, field2, etc.) using different statements (and maybe variables) for each field.
    My statements are too different to combine them into one query, but my example is simple:
    statement 1:
    SELECT ttt AS field1 FROM dual
    statement 2:
    SELECT yyy AS field2 FROM dual
    Each statement returns one value. Maybe I need some variable for each value, so var_field1 = field1, var_field2 = field2, etc.
    As a result I have to fill table table1 using my variables, so it must be some procedure.
    I know I can do it using one statement below, but I have more than 100 queries, so they should be executed one by one.
    with t1 as(
    select (SELECT 'ttt' FROM dual) field1, (SELECT 'yyy' FROM dual) field2 from dual
    select * from t1;
    Could you please show me some example, how this procedure should be written?
    Thanks ahead.

    This hasn't got anything to do with Oracle Reports, but here we go anyway. Your query can simply be:
    with t1 as(
    select 'ttt' field1, 'yyy' field2 from dual
    select * from t1;
    FIE FIE
    ttt yyy
    1 row selected.But maybe your example was an over simplification of your problem.

  • Add entries to database tables using update function module

    Hi All,
    I have a small requirement, in which I need to update Z-tables usimg update function module in update task. In the calling program, I have gathered the data in a field symbol value of type any. I need to pass the same to that function module to update the data which is in the field symbol.
    Please guide me how to achieve this technically.
    Thanks in advance,
    Pradipta .

    Hi,
    I believe you already have evrything with you.....Start Coding the same and come back with any Coding issue.
    I believe you will not be able to pass the Field Symbol in FM Interface.....You need to pass the Variable which Field Symbol is referring....

  • Commit after 2000 records in update statement but am not using loop

    Hi
    My oracle version is oracle 9i
    I need to commit after every 2000 records.Currently am using the below statement without using the loop.how to do this?
    do i need to use rownum?
    BEGIN
    UPDATE
    (SELECT A.SKU,M.TO_SKU,A.TO_STORE FROM
    RT_TEMP_IN_CARTON A,
    CD_SKU_CONV M
    WHERE
    A.SKU=M.FROM_SKU AND
    A.SKU<>M.TO_SKU AND
    M.APPROVED_FLAG='Y')
    SET SKU = TO_SKU,
         TO_STORE=(SELECT(
              DECODE(TO_STORE,
              5931,'931',
              5935,'935',
              5928,'928',
              5936,'936'))
              FROM
              RT_TEMP_IN_CARTON WHERE TO_STORE IN ('5931','5935','5928','5936'));
    COMMIT;
    end;
    Thanks for your help

    I need to commit after every 2000 recordsWhy?
    Committing every n rows is not recommended....
    Currently am using the below statement without using the loop.how to do this?Use a loop? (not recommended)

  • How to get the sum in BSEG table using select statement

    hai all
    i made the internal tale "itab1" .. i want to get the som  feild of  DMBTR in BSG table my code is here but its not working gave som error massage (Aggregate functions and the addition DISTINCT are not supported in field lists for pooled and cluster tables.)  plz tel me how should i do it..... i want to get the som of that feild....          
    loop at itab1
         SELECT sum( DMBTR  ) from bseg INTO itab1-DMBTR141_45
             where GJAHR = itab1-GJAHR
             and   BELNR = itab1-BELNR.
    endloop.
    regard
    nawa

    SELECT BELNR GJAHR SHKZG DMBTR
                 from bseg
                 INTO table it_bseg
                 for all entries in itab1
                 where GJAHR = itab1-GJAHR
                   and BELNR = itab1-BELNR.
    loop at it_bseg.
        IF it_bseg-shkzg = 'H'.
          it_bseg-dmbtr = it_bseg-dmbtr * ( -1 ).
        ELSE.
          it_bseg-dmbtr = it_bseg-dmbtr.
        ENDIF.
        MODIFY it_bseg.
    endloop.
    loop at it_bseg.
    READ TABLE itab1 with key belnr = it_bseg-belnr
                               gjahr = it_bseg-gjahr.
    if sy-subrc = 0.
    collect it_bseg into it_bseg_amount.
    endif.
    endloop.
    U can use the collect statement
    Regards
    Gopi

  • Format a field using update statement

    Hello,
    What I am trying to do is update a field by using values from two fields from the same table. When I entered the following query, I got the error message ORA-00903: invalid table name. Any suggestions?
    Update [Select Reg1.State _Field, Reg1.Route, Reg1.County
    From Reg1
    Where Reg1.State _Field Is Null]
    Set Reg1.State_Field=
    Reg1.Route &Reg1.County;

    [Select Reg1.State
    Are you using SQL server or Oracle?

  • Moving internal table to another internal table using ASSIGN statement.

    Hi,
    We have a requirement to move an internal table form one program(SAPMV60A) to the internal table of the include(RV61B9xx) using the following statement.
    [  xvbrp is a internal table in SAPMV60A.  ]
    ASSIGN ('(SAPMV60A)xvbrp')  TO <ls_xvbrp>.
    We tried all the combinations for declaring <ls_xvbrp> as table.
    It is going to dump in our system,
    " Type conflict with ASSIGN in program "SAPLV61B ".".
    Your efforts will be rewarded with points.
    Thanks in Advance,
    Warm Regards,
    Baburaj

    Hi
    If you declare your field-symbols as table you should use []
    FIELD-SYMBOLS: <ls_xvbrp> TYPE TABLE.
    ASSIGN ('(SAPMV60A)xvbrp[]') TO <ls_xvbrp>.
    else
    FIELD-SYMBOLS: <ls_xvbrp> TYPE ANY.
    ASSIGN ('(SAPMV60A)xvbrp') TO <ls_xvbrp>.
    But I believe in this case you'll assign the header line of xvbrp.
    Max

Maybe you are looking for

  • Proforma Invoice or Quotation from Project

    Hi Experts, My client requirement is like this: 1. Receives request for procurement of goods/service from different user departments. 2. Will send estimation to the user departments and will proceed further. I want to map like this through PS (SD mod

  • External Content Server configuration

    Hi, Can anybody provide me how to configure External content server for Archivelink. Regards Laxmi Bhushan

  • Printer Button Event

    Hi, We are wanting to record each time a report is printed off. We are using VS.NET2005 and CRXI. We want to do this by entering a ReportName and DateTime record into a Table that will hold information about the Report Print We are trying to find the

  • Documents "Modifed Date" changes just by opening?

    We're seeing that Word, Excel & various other doc's change their "Date Modified" to today's date where they are ONLY opened...not modified. All we're doing is opening and closing, no changes.... Is this a Micro$oft issue or can I change a preference

  • Can you place a mask on a guide

    Hello, I am trying to learn some masking techniques and I was making a file that looks like a flashlight is going across the screen and revealing its masked layer. I would love to be able to make the spotlight move all over the page, and so I wanted