Commit - Within Loop

Hello All,
I am stuck up with ABAP Dump - DBIF_RSQL_ERROR.
In my code i am fetching data from database tables ZOMLT and ZOMLG. The main objective being delete the orphan entries
available in ZOMLT. (ZOMLT and ZOMLG have 5 primary keys in common)
Step 1 : Based on conditions i have retrieved data from ZOMLT.
Step 2 : Retrieved data from ZOMLG and placed them into i_ZOMLT and i_ZOMLG internal tables respectively.
The total records that are selected are for ZOMLT - *38838 and for ZOMLG - 10622.
I have declared a variable of size 6 as a counter to get the total number of records in internal table, that is the reason
why the * (So, the reords fetched cross the 6 digits).
Step 3 : Then i am looping at i_ZOMLT and reading i_ZOMLG.
If the records available in ZOMLT does not match with the record present in ZOMLT i build the Orphan internal table (IF
SY-SUBRC NE 0 then build Orphan itab).
The total records in the Orphan tab is *17594, this is the place i get the ABAP/4 processor: DBIF_RSQL_SQL_ERROR - no more
locks available.
Once the Prohan table is populated i use the mass delete statement DELETE ZOMLT client specified from ITAB ORPHAN_TAB.
Would be great if your views/suggestions are provided on how to retrieve a smaller data from ZOMLT and ZOMLG and delete the
entries and then proceed for further data.
Regards,
- PSK

Hi Sravan,
From your message I understood that the error is due to some issue with locking. Possible reasons for this could be;
Do not have sufficient table space
Size of the rollback segment
If you can send me the shortdump, I can give more specific answer.
Instead of populating all the orphan records in the itab and then delete from ZOMLT, as soon as the orphan itab is filled with 10,000 records, delete from ZOMLT and do a commit work.
Thanks
Vinod

Similar Messages

  • Trap error within loop and process next record

    Hi,
    I am processing each record inside a loop. Now if any exception occurs processing with a single record within loop I want to continue with the next record with proper error message in the log.
    How to achieve the above scenario? Shall I create a savepoint and whenever any error occurs inside the loop I will rollback to that savepoint. Once it is done shall it process the next record automatically?
    Thanks in advance for your reply.
    Thanks,
    Mrinmoy

    Relational databases are about sets.
    They are not about files and records
    Processing records in a loop will make your code slow, and you should avoid using this strategy.
    That said
    Simply enclose the code in it's own begin end block.
    beginn
    <your code>
    exception
    when <your exception> then
    <process the exception not reraising it>
    end;
    No savepoints required.
    Sybrand Bakker
    Senior Oracle DBA

  • How to Edit names within Loop Library

    I've edited a MIDI Apple Loop from Jam Packs and saved it as an MIDI Apple Loop in the library.
    What I typed in as a name for the file is not what appeared in the loop library?
    1. Why did the text alter from I typed?
    2. How can I edite the name in the within loop library.
    3. How do I delete apple loops I've created from the apple loop library?
    Thank you
    - I did look in the manual and within the user help in Logic, but could find nothing. I know I must be looking under the wrong 'key word' search.
    What can I say!
    Message was edited by: StyleSupport

    StyleSupport wrote:
    1. Why did the text alter from I typed?
    You must select the green loop in the Arrange and go to Region menu "Add loop to the library" something like that or drag and drop the region to the Library in the Media dock.
    This way a new dialog will show( see the picture below ) where you need to fill new "unique" name or to add some user (sub name), choose the group etc.
    2. How can I edite the name in the within loop library.
    3. How do I delete apple loops I've created from the apple loop library?
    You "user" green loop is stored to ...user/Library/Audio/Apple Loops/User Loops.
    Browse to this dir and edit or delete the loop.
    You "user" green loop is stored to ...user/Library/Audio/Apple Loops/User Loops.
    Browse to this dir ( you will find a folder labeled as "Single" or something like that open it ) and edit or delete the loop in question.
    !http://img42.imageshack.us/img42/508/greenloops.gif!
    !http://img59.imageshack.us/img59/4967/aglogo45.gif! [www.audiogrocery.com|http://www.audiogrocery.com]

  • Oracle.xml.sql.OracleXMLSQLException:Cannot enable auto commit within JTS transaction

    Hi All,
    OracleXMLSave class in the Oracle XDK is being used to load XML data into an 8170 database. The Java code is running in IBM WebSphere with container-managed transactions. When JTA is enabled with the Merant JDBC driver for Oracle, we get the following error when the XML is loaded:
    oracle.xml.sql.OracleXMLSQLException: Cannot enable auto commit within JTS
    transaction
         at java.lang.Throwable.fillInStackTrace(Native Method)
         at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2213)
         at oracle.xml.sql.dml.OracleXMLSave.insertXML(Compiled Code)
    This suggests the OracleXMLSave class is not aware of the fact that it is now operating in a JTS transaction where control is managed elsewhere. i.e. should also not attempt to commit or rollback, as this is the responsibility of the container.
    Is there a property which needs to set to prevent the above or does the XDK not work with J2EE (JTS) transactions?.
    If you have any useful comments, let me know. Testing the above presents me with a number of problems so if this is easily explained , let me know.
    Thanks,
    Malcolm

    Clearly , there does seem to be something a bit odd with the above stack.
    <Bug:1917808> mentions OracleXMLSave in context of plsql equivalent : dbms_xmlsave . i.e dbms_xmlsave is a wrapper around OracleXMLSave class.
    disabling autocommit on connection as follows should help:
    conn = DriverManager.getConnection("connect string","scott","tiger");
    conn.setAutoCommit(false);
    to disble auto commit and see if this has an effect.
    This issue might be <Bug:1497506>. If disabling autocommit does not work then it appears that it could be this issue .
    Malcolm
    Hi All,
    OracleXMLSave class in the Oracle XDK is being used to load XML data into an 8170 database. The Java code is running in IBM WebSphere with container-managed transactions. When JTA is enabled with the Merant JDBC driver for Oracle, we get the following error when the XML is loaded:
    oracle.xml.sql.OracleXMLSQLException: Cannot enable auto commit within JTS
    transaction
         at java.lang.Throwable.fillInStackTrace(Native Method)
         at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2213)
         at oracle.xml.sql.dml.OracleXMLSave.insertXML(Compiled Code)
    This suggests the OracleXMLSave class is not aware of the fact that it is now operating in a JTS transaction where control is managed elsewhere. i.e. should also not attempt to commit or rollback, as this is the responsibility of the container.
    Is there a property which needs to set to prevent the above or does the XDK not work with J2EE (JTS) transactions?.
    If you have any useful comments, let me know. Testing the above presents me with a number of problems so if this is easily explained , let me know.
    Thanks,
    Malcolm

  • Cannot enable auto commit within JTS using websphere

    i suddenly encountered some exceptions like this yet the process seems to be ok. i am pretty new to websphere, help please:
    java.lang.IllegalStateException: Cannot enable auto commit within JTS transaction
         at com.ibm.ejs.cm.pool.ConnectO.setAutoCommit(ConnectO.java:2085)
         at com.ibm.ejs.cm.proxy.ConnectionProxy.setAutoCommit(ConnectionProxy.java:594)

    I'm setting autoCommit to false in some of my code and it works. Here is the example:
    //This code works for the Oracle Thin Driver
                   conn.setAutoCommit(false); // <- required!
                 // initialize LOB reference
                 GDate curDate = new GDate();
                 ps = conn.prepareStatement("insert into Calculated_Rate_Import values (empty_clob(), ?)");
                 //conn.createStatement().executeUpdate("insert into Calculated_Rate_Import values (empty_clob(), TO_DATE('" + GDate.getSafeSqlDate(curDate) + "'))");
                 ps.setTimestamp(1, GDate.getSafeTimestamp(curDate));
                 ps.executeUpdate();
                 ps = conn.prepareStatement("select Calculated_Rate_Import from Calculated_Rate_Import where Import_Date = ? for update");
                 ps.setTimestamp(1, GDate.getSafeTimestamp(curDate));
                   results = ps.executeQuery();
                 results.next();
                 // get lob reference from write lock
                     //oracle.sql.CLOB clob = ((oracle.jdbc.driver.OracleResultSet)results).getCLOB(1);
                   oracle.sql.CLOB clob = (oracle.sql.CLOB)results.getClob("Calculated_Rate_Import");
                 // create statement for update
                 ps = conn.prepareStatement("update Calculated_Rate_Import set Calculated_Rate_Import = ? where Import_Date = ?");
                 // stream data into lob
                 java.io.OutputStream os = ((oracle.sql.CLOB)clob).getAsciiOutputStream();
                 try{
                      os.write(fileContents.getBytes());
                           os.close();
                 }catch(IOException e){
                      e.printStackTrace();
                 // execute update
                 //((oracle.jdbc.driver.OraclePreparedStatement)ps3).setCLOB(1, clob);
                 ps.setClob(1, clob);
                 ps.setTimestamp(2, GDate.getSafeTimestamp(curDate));
                 ps.executeUpdate();
                 // close lock
                 results.close();
                 conn.commit();
                 //finished inserting CLOB
                 //set the auto commit back to true, required!
                   conn.setAutoCommit(true);

  • Skip error record within loop

    Hi all,
       How to skip error records within loop.
    Regards,
    bala

    Hi krithika,
    1. we can use this logic
    2. Loop at itab.
      check field1 = 'wrong value'
      check field3 = 'wrong value'
      *--- OTHER GOOD CODE
      ENDLOOP.
    regards,
    amit m.

  • Can we put subroutines within loops?

    q]     Can we put subroutines within loops?- i mean not the PERFORM Statement  but the FORMENDFORM statement

    Hi
    If your question means .. calling Performs within Loops ?
    Then its possible..
    LOOP.
    PERFORM P1. ( THIS IS OK )
    ENDLOOP.
    But this is not correct..
    LOOP.
    FORM P1.
    ENDFORM.
    ENDLOOP.
    Thanks
    Hope it Helps.
    Praveen

  • Delete Itab within Loop at ITAB ?

    Hi,
    Help needed to remove this delete from within the loop.
    {code
    Loop at itab where <condition>.
    <statements>
    delete itab index sy-tabix.
    Exit.
    Endloop.
    {code}
    The functionality of the code should not be affected.
    Useful help would be awarded

    Hi,
    Instead of deleting data from itab use another internal table of same type (itab1) and append it. Use itab1 data for further processing.
    check below logic...
    {code
    Loop at itab1 into wa_itab1 where <condition>.
    <statements>
    if <condition>
    append wa_itab1 to itab2.
    exit.
    endif.
    Endloop.
    refresh itab1.
    itab1[] = itab2[].
    {code}
    regards,
    N M Poojari.

  • Find All Occurrences always fails within loop

    Dear forumers,
    There's this strange problem that requires a fix.
    Finding all occurences of '#' works fine here:-
    REPORT  zz_test.
    DATA: lv_text TYPE string,
          ls_result TYPE match_result,
          et_release type table of yytc_release,
          lt_result  TYPE match_result_tab.
    lv_text = '"RFC-1234#Create ""Payroll"" under NL directory"'.
      FIND ALL OCCURRENCES OF REGEX '#'
                IN lv_text
                RESULTS lt_result IGNORING CASE IN CHARACTER MODE.
      IF sy-subrc = 0.   " SY-SUBRC is always 0
        READ TABLE lt_result INTO ls_result INDEX 1.
        WRITE :'Offset: ' .
        WRITE: ls_result-offset .
        WRITE: lv_text+00(ls_result-offset).
      ENDIF.
    But it always fails here, within a loop at an internal table:-
    SELECT * .... INTO TABLE it_jira ...
    LOOP AT it_jira ASSIGNING <jira>.
      <release>-summary = <jira>-summary.
      IF <release>-type CS 'Subtask'.
        " <release>-summary is of data type CHAR255
        PERFORM get_subtask USING <release>-summary.  
      ENDIF.
    ENDLOOP.
    FORM get_subtask  USING    pv_summary TYPE yytc_release-summary.
      DATA:
        lv_string  TYPE char255,
        lv_final   TYPE char255,
        lv_summary TYPE string,
        lv_strlen  TYPE i,
        lt_result  TYPE match_result_tab.
      lv_string = pv_summary.     " LV_STRING = '"RFC-1234#Create ""Payroll"" under NL directory"''
      CONDENSE lv_string.
      lv_strlen = STRLEN( lv_string ).
      lv_strlen = lv_strlen - 1.
      IF lv_string+0(1) = '"' AND lv_string+lv_strlen(1) = '"'.
        lv_strlen = lv_strlen - 1.
        WRITE lv_string+1(lv_strlen) TO lv_final+1(254).
      ENDIF.
      lv_summary = lv_final.
    "  FIND ALL OCCURRENCES OF '#'
    "      IN lv_summary
    "    RESULTS lt_result IGNORING CASE.   * SY-SUBRC is always 4 here too
      FIND ALL OCCURRENCES OF REGEX '#'
          IN lv_summary
        RESULTS lt_result IGNORING CASE IN CHARACTER MODE.
      IF sy-subrc = 0.    " SY-SUBRC is always 4 here - why?!  :(
      ENDIF.
      CLEAR: lv_string,
             lt_result.
    ENDFORM.                    " GET_SUBTASK
    Only when the string LV_SUMMARY is edited from within the debugger (add space to the string prefix, etc), the SY-SUBRC will be 0 and there'll be data found in LT_RESULT.
    How can I resolve this issue? Please do help. Thanks.

    I think the subtle difference is that in your first example the character is actually '#' whereas in the second example it is actually another (unprintable)value such-as line-feed and only APPEARS to be '#'.
    You must find out what the value in question is(will it always be the same value?) and then replace that instead of '#'.

  • Using assign-activity:Append to append child nodes in XML-tree within loop

    I would like to produce an XML looking something like this (just an example):
    &lt;Customer&gt;
    &lt;Name&gt;Tom&lt;/Name&gt;
    &lt;Invoices&gt;
    &lt;Invoice&gt;
    &lt;InvoiceData&gt;.....&lt;/InvoiceData&gt;
    &lt;/Invoice&gt;
    &lt;Invoice&gt;
    &lt;InvoiceData&gt;.....&lt;/InvoiceData&gt;
    &lt;/Invoice&gt;
    &lt;/Invoices&gt;
    &lt;/Customer&gt;
    For different reasons (composite PK's in DB etc) I have to first get the Customer-data, and then get each Invoice for that customer.
    Then I have to loop the Invoices and append each Invoice-node to the XML, ending up with the whole thing when the loop is finished.
    This should be pretty simple (I guess), and I have tried different variations of the Append (assign activity), but everytime I end up with only the last Invoice-node.
    I can see in the Flow-window of the BPEL Console that it is not the same Invoice-node I'm appending within the loop-iterations, so that can not be the case in any way.
    In other words it seems to copy instead of appending.
    What is wrong ?
    Is this a bug in the Append function ?
    Any suggestions to other approaches that might work ? (I have to use the loop to get 1 and 1 Invoice-node though, and in that way put the whole XML together in some way)
    Edited by: user1694182 on 09.okt.2008 05:08

    Thank you for your answer.
    After taking your "debugging"-suggestions at hand and running some tests, I can now see that it gets appended in some way, but not correctly.
    1st LOOP ROUND:
    <installation>
    <measurePoints>
    <measurePoint><measurePointId>308</measurePointId>...</measurePoint>
    </mesurePoints>
    </installation>
    Correct so far.
    2nd LOOP ROUND:
    <installation>
    <measurePoints>
    <measurePoint><measurePointId>322</measurePointId>...</measurePoint>
    <measurePoint><measurePointId>322</measurePointId>...</measurePoint>
    </mesurePoints>
    </installation>
    So now it appends the new measurepoint, but overwrites the 1st as well... Strange..
    3rd LOOP ROUND (last round):
    <installation>
    <measurePoints>
    <measurePoint><measurePointId>382</measurePointId>...</measurePoint>
    <measurePoint><measurePointId>382</measurePointId>...</measurePoint>
    </mesurePoints>
    </installation>
    So suddenly the same Append doesn't append, but overwrites the 2 I had with the new measurepoint...Strange...
    WHAT I DO IN MORE DETAIL:
    1: Assign(copy) the whole XML in the 1st loop round. (Copy - FROM: submitInstallation_InputVariable - TO: Powel_InstallationServiceInput)
    2: Within each loop round I collect the whole XML with just 1 measurePoint (TransformActivity - FROM: DBAdapter-output - TO: submitInstallation_InputVariable).
    3: Within each loop round I then append the new measurePoint (collected in step 2) to the measurePoints-node. (Append - FROM: submitInstallation_InputVariable - TO: Powel_InstallationServiceInput)
    PS! I can see in the BPEL Console that it is a new measurePoint that gets collected in step 2, and just 1 node.
    Help/tips on this is very appreciated ! :-)
    Edited by: user1694182 on 14.okt.2008 00:57

  • On change of statement not working within loop

    Hi all,
    I am using on change of statement within a loop of an internal table. I am refreshing and clearing the header of internal table every time the program enters the loop. But the program is not executing the code within the on change of statement every first time the program enters the loop.
    Please help me to solve this issue
    Thanks,
    Rajan

    Hi,
    Please check the following code. On change is working correctly.
    You have to sort the internal table on the basis of field you have use further for 'ON CHANGE OF'.
    TYPES : BEGIN OF y_itab ,
           number  type i ,
           END OF y_itab.
    DATA: itab TYPE STANDARD TABLE OF y_itab.
    data : e_itab LIKE LINE OF itab.
    e_itab-number = '112'.
    append e_itab to itab.
    e_itab-number = '112'.
    append e_itab to itab.
    e_itab-number = '110'.
    append e_itab to itab.
    e_itab-number = '110'.
    append e_itab to itab.
    e_itab-number = '111'.
    append e_itab to itab.
    e_itab-number = '111'.
    append e_itab to itab.
    e_itab-number = '3'.
    append e_itab to itab.
    LOOP AT itab INTO e_itab.
    on change of e_itab-number.
    write :/ e_itab-number .
    endon.
    ENDLOOP.
    Only on the first occurence of number,
    code inside 'ON CHANGE OF' .... 'ENDON' will be executed.

  • Avoiding performance issue due to loop within loop on internal tables

    Hi Experts,
                    I have a requirement where in i want to check whether each of the programs stored in one internal table are called from any of the programs stored in another internal table. In this case i am looping on two internal tables (Loop within a loop) which is causing a major performance issue. Program is running very very slow.
    Can any one advise how to resolve this performance issue so that program runs faster.
    Thanks in advance.
    Regards,
    Chetan.

    Forget the parallel cursur stuff, it is much to complicated for general usage and helps nearly nothing. I will publish a blog in the next days where this is shown in detail.
    Loop on loop is no problem if the inner table is a hashed or sorted table.
    If it must be a standard table, then you must make a bit more effort and faciliate a binary search (read binary search / loop from index exit)
    see here the exact coding Measurements on internal tables: Reads and Loops:
    /people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables
    And don't forget, the other table must not be sorted, the loop reaches anyway every line. The parallel cursor requires both tables to be sorted. The additional sort
    consumes nearly the whole advantage of the parallel cursor compared to the simple but good loop in loop solutions.
    Siegfried

  • Sy-index / sy-tabix wrong within loop

    Hi friends,
    i do a loop over a a table and am writing out the field contents like this:
    LOOP AT <dyn_table> INTO <dyn_wa>.
            do.
          assign component sy-index
             of structure <dyn_wa> to <dyn_field>.
            if sy-subrc <> 0.
             EXIT.
            else.
    * Here it gets the name of the field based on the sy-index of the component
            READ TABLE l_tab_fields INTO w_tab_fields INDEX sy-index.
          endif.
      ENDLOOP.
    What now doesnt work is, that whenever i have the read statement uncommented the loop doesnt increment so i only get the first row but that n-times.
    any idea where the error is  ?
    thank you! i am awarding points generously

    LOOP AT <dyn_table> INTO <dyn_wa>.
            do.
          assign component sy-index
             of structure <dyn_wa> to <dyn_field>.
            if sy-subrc <> 0.
             EXIT.
            else.
    Here it gets the name of the field based on the sy-index of the component
            READ TABLE l_tab_fields INTO w_tab_fields INDEX sy-index.
          endif.
      ENDLOOP.
    If i gt you rite..i would suggest this
    Data: l_tabix type sy-tabix.
    LOOP AT <dyn_table> INTO <dyn_wa>.
      l_tabix - sy-tabix.
          assign component l_tabix
             of structure <dyn_wa> to <dyn_field>.
            if sy-subrc <> 0.
             EXIT.
            else.
    Here it gets the name of the field based on the sy-index of the component
            READ TABLE l_tab_fields INTO w_tab_fields INDEX l_tabix.
          endif.
      ENDLOOP.
    santhosh

  • How : Invoke asynchronous BPM process with callback within loop?

    Hi All,
    I'm currently using the 11g suite to create 2 BPM processes (Validate and Review). Process Validate is asynchronous and has a callback facility. I intend to invoke Validate from Review as a subprocess. My question would be, is it possible to invoke an asynchronous process with a call back? Can this be done in a loop?
    JDev : 111.1.1.4
    Thanks,
    PP.

    Sai,
    Which IDE are you using to build the client? (In fact it doesn't matter)
    Just put the jar files path into the classpath as John told. In order to find which jar files you need in this process, you can use eclipse java - jar class finder (which works with NWDS as well). Give it the class name(in this case commons.bla.bla...) and your jar files' folder, it will show you which jar file you need to put into the classpath.
    Just a little googling may help you with the class finder

  • Dynamic creating field names within Loop

    Hi,
    I've a record which comprises of a few key fields and then 52 qty fields, one for each week of the year. ( Not my design honest!!).
    Anyway with in a Cursor there are currently 52 "IF" statements clearing out values less than the current week number. I'd tried to replace this with the following. However I'm having trouble with the " 'c1_rec.qty'&#0124; &#0124;lv_count " bit.
    Has anyone got any ideas?
    lv_week:=22; ( added for clarity )
    lv_count:=1;
    WHILE lv_count < lv_week LOOP
    'c1_rec.qty'&#0124; &#0124;lv_count :=0;
    lv_count:=lv_count+1;
    END LOOP;
    John-Paul Thompson

    John-Paul;
    If I understand the question correctly, you have a table with 52 columns, one for each week of the year. You are trying to zero the quantity for each week prior to the current week. I'm going to take a sab at this. Bear in mind that I have no way to debug the code.
    DECLARE
    c NUMBER;
    n NUMBER;
    v_sql VARCHAR2(2000)
    lv_week NUMBER:=22; ( initialize week#)
    lv_count NUMBER:=1;
    BEGIN
    v_sql := 'UPDATE c1_rec SET '
    WHILE lv_count < lv_week LOOP
    v_sql := v_sql&#0124; &#0124;
    'qty'| |TO_CHAR(lv_count) &#0124; &#0124;' :=0';
    lv_count:=lv_count+1;
    IF lv_count < lv_week THEN
    v_sql := v_sql &#0124; &#0124; ', ';
    END IF;
    END LOOP;
    --sql := v_sql &#0124; &#0124; YOUR WHERE CLAUSE
    c:= dbms_sql.open_cursor;
    dbms_sql.parse(c, v_sql, dbms_sql.native)
    n:= dbms_sql.execute(c);
    dbms_sql.close_cursor(c);
    END;
    HTH
    Randall
    null

Maybe you are looking for