Deleteing the contents from the database table

The aim of this code is to delete the whole contents from these 12 tables.  Is there any way to write the code more efficiently.
TABLES: ZFFMCTL_AP, ZFFMHDR_AP, ZFFM_CHANGE_LOG, ZFFMDTL_AR, ZFFMHDR_AR,        ZFFMDTL_JV, ZFFMHDR_JV, ZFFMDTL_SKF,ZFFMHDR_SKF,ZFINVOICE_DETAIL,       ZFFMMASTER, ZFFMLOGREAD_CLUS, ZFFMCTL.
DELETE ZFFMCTL_AP.
IF SY-SUBRC = 0.
   DELETE ZFFMMHDR_AP.
   IF SY-SUBRC = 0.
      DELETE ZFFM_CHANGE_LOG.
      IF SY-SUBRC = 0.
         DELETE ZFFMDTL_AR.
         IF SY-SUBRC = 0.
            DELETE ZFFMHDR_AR.
            IF SY-SUBRC = 0.
               DELETE ZFFMDTL_JV.
               IF SY-SUBRC = 0.
                  DELETE ZFFMHDR_JV.
                  IF SY-SUBRC = 0.
                     DELETE ZFFMDTL_SKF.
                     IF SY-SUBRC = 0.
                        DELETE ZFFMHDR_SKF.
                        IF SY-SUBRC = 0.
                           DELETE ZFINVOICE_DETAIL.
                           IF SY-SUBRC = 0.
                              DELETE ZFFMMASTER.
                              IF SY-SUBRC = 0.
                                 DELETE ZFFMLOGREAD_CLUS.
                                 IF SY-SUBRC = 0.
                                    DELETE ZFFMCTL.
                                 ENDIF.
                               ENDIF.
                             ENDIF.
                          ENDIF.
                       ENDIF.
                    ENDIF.
                ENDIF.
             ENDIF.
           ENDIF.
        ENDIF.
     ENDIF.
ENDIF.
This is very urgent,
Thanks in advance
John

Hi ,
One more thing , Deleting conents of all table in single Loop may cause program .
This depends on How much data you have in you Table . IF the data is Huge you can split the tables to be deleted . Check for Entry Exists in Table , if not go for Deletion  in the same pre-requisite order.
Regards,
sudhi

Similar Messages

  • How to delete the database table

    hi all
    i want to delete the data  from the custrmize table so if u can heilp me to do that....not the internal table ..i write the code but that using that code i can delete only one raw.. but i want to delete all raw in my table..
    ZLAB_SUBMIT-SHADE = '1'.
    ZLAB_SUBMIT-SUBMIT = '1'.
    ZLAB_SUBMIT-RM = 'RINGS'.
    ZLAB_SUBMIT-REMARKS = 'Approved'.
    ZLAB_SUBMIT-AP = ''.
    ZLAB_SUBMIT-USNAM = 'INDIKAF'.
    ZLAB_SUBMIT-CPUDT = '05.10.2006'.
    ZLAB_SUBMIT-CDATE = '05.10.2006'.
    ZLAB_SUBMIT-CPUTM = '21:29:19'.
    DELETE  ZLAB_SUBMIT.
    regard
    nawa
    this is my code....

    Hi,
    data itab type standard table of zlab_submit.
    select * from zlab_summit into table itab.
    delete zlab_summit from table itab.
    Kindly reward points by clicking the star on the left of reply,if it helps.

  • Delete all content in a database table

    i want to initialize a database table just before my specific program terminate.
    can i use the
    delete databasetable
    Edited by: Matt on Nov 7, 2008 8:04 AM

    Hi,
    If you want to delete all the contents of database table, use the following code:
    data itab type standard table of dbtab.
    select * from dbtab into table itab.
    delete dbtab from table itab.
    Hope this will help.
    Regards,
    Nitin.

  • Delete all the database table content

    Hello Friends,
    I have a z table with 5 fields (all the key fields) and I want to delete all the table content and load fresh content from internal table.
    I tried using syntax 'delete ztable' but sy-subrc value is coming as 4, means no table content is getting deleted.
    Please suggest me any alternative way to delete all the database table content.
    Thanks in advance,
    Shreekant

    Hi,
    try using
    delete from ztable.
    This will delete all records from your ztable. After this command u can fill your ztable from itab by the following command
    select *
    from std table
    into corresponding fields of itab.
    insert ztable from table itab.
    Hopefully this will solve your problem.
    Regards,
    Ibrar

  • Can I restore the deleted statistical data from the database tables?

    Hi all,
       I have deleted the statistical data from the database tables like(Ex: RSDDSTAT, RSDDSTATWHM,..) by mistake through RSA1> Tools> BW Statistics for Infoproviders--> Delete.
    Is there any way to restore the deleted data back? Thanks in advance.

    Now I'm really confused-
    Your first post said
    "<b>I have deleted the statistical data from the database tables like(Ex: RSDDSTAT, RSDDSTATWHM</b>,..) by mistake through RSA1> Tools> BW Statistics for Infoproviders--> Delete."
    but your last respsonse said
    "I have deleted the BW Statistics data, <b>not the actual data in RSDDSTAT tables</b> through
    RSA1 -> Tools -> BW Statistics for InfoProviders -> clicked 'Delete' bin to delete data."
    If you used the RSA1 -> Tools -> BW Statistics for InfoProviders -> clicked 'Delete' - <b>then you deleted the data from the RSDDSTAT tables</b>. This assumes you accepted the default date range that would have popped up after the clicking on the Delete button which specified to delete thru the current date.  If this is what you did, the data is gone.  Your only hope is be to recover from a DB backup.  
    The data in the RSDDSTAT tables is what is used to feed the BW Statistics cubes, generally on a daily basis.

  • Update the database table with the content of the internal table

    Hello!
      I have the next form:
      FORM erase_data.
    SELECT * FROM zadrress INTO CORRESPONDING FIELDS OF TABLE itab_adrress.
      DELETE TABLE itab_adrress: FROM zadrress,
                                 WITH TABLE KEY adrid = '456'.
      WRITE 'The information after the DELETE operation'
      COLOR 2.
      LOOP AT itab_adrress INTO wa_adrress .
        WRITE:/
               wa_adrress-adrid COLOR 5,
               wa_adrress-name COLOR 7,
               wa_adrress-email COLOR 5,
               wa_adrress-depart COLOR 7,
               wa_adrress-display COLOR 5.
      ENDLOOP.
      SKIP.
    LOOP AT itab_adrress INTO wa_adrress.
       MODIFY zadrress FROM wa_adrress.
       COMMIT WORK.
       IF sy-subrc = 0.
         WRITE 'OK !'.
         SKIP.
       ELSE.
         WRITE 'FAIL !'.
         SKIP.
       ENDIF.
    ENDLOOP.
      MODIFY zadrress FROM TABLE itab_adrress.
      UPDATE zadrress FROM TABLE itab_adrress.
    TRANSPORTING adrid, name, email, depart, display.
    INSERT zadrress FROM TABLE itab_adrress ACCEPTING DUPLICATE KEYS.
    PERFORM display_data .
    ENDFORM.                    "erase_data
    I see that my record is deleted  when I display the records from my internal table, but
    now I want to delete the record from database table.
       For that I want to move the content of the modified internal table in the database table. You can see the methods I tried (some of them commented), but nothing seems to work.
    Any advice ?
    Thank you.

    FORM erase_data.
    SELECT * FROM zadrress INTO CORRESPONDING FIELDS OF TABLE itab_adrress.
    DELETE TABLE itab_adrress: FROM zadrress,
    WITH TABLE KEY adrid = '456'.
    WRITE 'The information after the DELETE operation'
    COLOR 2.
    LOOP AT itab_adrress INTO wa_adrress .
    WRITE:/
    wa_adrress-adrid COLOR 5,
    wa_adrress-name COLOR 7,
    wa_adrress-email COLOR 5,
    wa_adrress-depart COLOR 7,
    wa_adrress-display COLOR 5.
    ENDLOOP.
    SKIP.
    LOOP AT itab_adrress INTO wa_adrress.
    MODIFY zadrress FROM wa_adrress.
    COMMIT WORK.
    IF sy-subrc = 0.
    WRITE 'OK !'.
    SKIP.
    ELSE.
    WRITE 'FAIL !'.
    SKIP.
    ENDIF.
    ENDLOOP.
    <b>DELETE FROM zadrress.</b>  "Make this change and try
    MODIFY zadrress FROM TABLE itab_adrress.
    UPDATE zadrress FROM TABLE itab_adrress.
    TRANSPORTING adrid, name, email, depart, display.
    INSERT zadrress FROM TABLE itab_adrress ACCEPTING DUPLICATE KEYS.
    PERFORM display_data .
    ENDFORM. "erase_data'.

  • Deletion of data within the database tables

    The user is trying to clean up the 2014 data within the database tables. He is running a delete function which keeps causing the log files
    to exceed their limit. The tables are large and he is unable to delete the data in one command due to available size and logging. What is the best way to approach this?
    Thanks,

    Hi venkatesh1985,
    According to your description, the user fails to delete data in tables due to the limited space of log file. Based on my research, this issue could occur when you use the delete statement(DELETE FROM ExampleTable) in a single transaction and consume all
    available space on your transaction log disk.
    To avoid this issue, you could use the two methods below to delete the data.
    1. Use a loop combined with TOP and delete rows in smaller transactions as the following example. This method requires you to delete all the tables one by one.
    SELECT 1
    WHILE @@ROWCOUNT > 0
    BEGIN
    DELETE TOP (1000)
    FROM LargeTable
    END
    For more information about the process, please refer to the article:
    http://dbadiaries.com/how-to-delete-millions-of-rows-using-t-sql-with-reduced-impact
    2. If you want to delete all the data from all tables in the specific database, you could script the entire database and all database objects. Then drop the database and recreate it using the script as the steps below.
    a. In Object Explorer, expand the node for the instance containing the database to be scripted.
    b. Point to Tasks, and then click Generate Scripts and click Next.
    c. Select the option of 'Script the entire database and all database objects'.
    d. Specify how scripts should be saved. You could save the script to a file or new query window. Click Next, then click ok.
    e. Drop the database, and run the script in the query window to recreate it. For more information, please refer to the article:
    http://msdn.microsoft.com/en-us/library/bb895179.aspx#Introduction
    In addition, if possible, please increase the size of the log file or move the log file to a different disk with more disk space.
    Regards,
    Michelle Li

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • What's the best way to create XML file with a schema from a database table?

    Hi,
    I want to create an XML file from a database table (which has over 600 columns) using XML schema (.xsd file). I want to know the best way to do this.
    The output XML file is NOT a direct data dump from the DB table, there�re some logic around it, such as the XML file has some hierarchy with repeating tags.
    I have done this using JAXB by creating Java classes form XML schema, but I don�t want to map 600 DB columns to these Java classes manually, and loop through the record set to create repeating tags.
    I know there are few tools around now like MapForce (Altova), how do people do these now?
    Thanks,
    Chandi

    Can you use a schema when we compose XML doc from Database tables?
    Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me.

  • How to select alternate entries from the database table

    Hi Experts,
    can u help me, how to select alternate entries from the database table.
    Thanks

    As there is no concept of sequence (unless there is a field specifically included for the purpose), there is no meaning to "alternate" records.
    What table do you have in mind, what data does it hold, and why do you want alternate records?
    matt

  • Selecting the last record from a database table

    In my ABAP Program, I have to use a select statement to retrieve the last record from the database table with the same key.  In other words, the Program will get more than one hit on the database table for the selected keys and I need to retrieve values from only the last record and not the first.  I know I can use an internal table to sort the records first and then retrieve the right value.   But to make things easier, is there a SELECT statement keyword than I can use to do this in one single step?  Thanks!

    hi,
    tables:mara.
        data: begin of it_mara occurs 0,
                matnr like mara-matnr,
                meins like mara-meins,
                mtart like mara-mtart,
                end of it_mara.
    select-options:s_matnr for mara-matnr.
    select matnr
              meins
              mtart
    from mara
    into table it_mara
    where matnr in s_matnr.
    if not it_mara[] is initial.
    sort it_mara by matnr descending.
    read table it_mara index 1.
    endif.
    then you get the last record of the select statement.
    reward points if useful,
    venkat.

  • Randomly selecting some rows from the database table

    Hi can some one help me in selecting some rows from a database table which has around 90,000 rows.
    Thanks.

    One thing you might try is the "sample" clause if you have 8i which is supposed to return a random percentage of the table. Say for example, you have a sequence number on your table as the pkey. Then you might try:
    select * from <table_name> where pkey in(select pkey from <table_name> sample(10));
    This should give you a random 10 percent of the rows in the table but I tried this once and the results seemed unpredictable. For example it returned a different number of rows each time even though the number of rows in the table didn't change.
    Hope this works for you.

  • Field value is getting double while updating the database table

    Hi Experts,
    A simple doubt :
    there is a standard program through which a zfunction module is getting triggered, through this zfunction module i am updating the database table.
    Now what happening is one of the field(KCQTY) value in database is getting double at a time when i am executing the Program with same variant only.
    I have also done the CLEAR & REFRESH internal tables starting of the Function module.
    Can you please help me out.
    Max points wil be awarded.
    thanks
    rico.

    Hi Nicole,
    this is the part of the coding where you can see how the field KCQTY is getting moved in the loop statement.
      DELETE IT_CE20002B_815 WHERE
          KONDA = SPACE  OR
          WERKS = SPACE  OR
          VVB01001 < 0.
        LOOP AT IT_CE20002B_815.
          INDX = SY-TABIX.
          CONCATENATE IT_CE20002B_815-PERBL0(4) IT_CE20002B_815-PERBL5(2)
                                                    INTO MONAT.
       MOVE itab_ce20001b-perbl TO monat.
          CLEAR S815.
          READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA
                                           BINARY SEARCH.
            SELECT SINGLE * FROM S815 WHERE VRSIO = '000'
                                         AND SPMON = MONAT
                                         AND KONOB = 'APO'
                                         AND MVGR2 = IT_CE20002B_815-KONDA
                                         AND PRODH = IT_CE20002B_815-PRDHA
                                         AND WERKS = IT_CE20002B_815-WERKS.
                                        AND VTWEG EQ CO_VTWEG_99.
    BREAK SAMEE.
          IF SY-SUBRC EQ 0.
    Eintrag in S810 existiert
            IF S815-AEMENGE <= IT_CE20002B_815-VVB01001.
    wenn die Auftragseingangsmenge kleiner gleich der Kontingentsmenge
    wird die Kontingentmenge in das Steploop übernommen
              MOVE IT_CE20002B_815-VVB01001 TO  W_T_DATA_815-KCQTY.
    *Liste ausgeben
             PERFORM AUSGABE4.
              PERFORM AUSGABE4_815.
            ELSE.
    Ausgabe Fehlermeldung, wenn die Auftragsmenge größer als die
                           Kontingentmenge ist.
    *Liste mit fehlermeldungen ausgeben, Kontingent trotzdem übernehmen
              MOVE IT_CE20002B_815-VVB01001 TO  W_T_DATA_815-KCQTY.
             PERFORM AUSGABE_FEHLER4.
              PERFORM AUSGABE_FEHLER4_815.
            delete it_ce20002b index indx.
            continue.
            ENDIF.
          ELSE.
    Es existiert kein Eintrag in S810, dann direkt eingeben
            MOVE IT_CE20002B_815-VVB01001 TO W_T_DATA_815-KCQTY.
            MODIFY IT_CE20002B_815 INDEX INDX.
    *Liste ausgeben (Kein Eintrag in S810)
           PERFORM EINTRAG2.
            PERFORM EINTRAG2_815.
          ENDIF.
    *Übergabestructur für die Weiterverarbeitung durch das Copymanagement
    *im Functionsbaustein wird gefüllt.
          W_T_DATA_815-SPMON = MONAT.   "itab_ce20001a-perbl.
          W_T_DATA_815-KONOB = CO_KONOB_APO.
          READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA
                                          BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_T_DATA_815-MVGR2 = CO_MVGR2_999.
          ELSE.
            W_T_DATA_815-MVGR2 = IT_CE20002B_815-KONDA.
          ENDIF.
          W_T_DATA_815-WERKS = IT_CE20002B_815-WERKS.
          W_T_DATA_815-PRODH = IT_CE20002B_815-PRDHA.
         W_T_DATA_815-VTWEG = '99'.
         W_T_DATA_815-KUNNR = '9999999999'.
          W_T_DATA_815-KCQTY = IT_CE20002B_815-VVB01001.
          W_T_DATA_815-BASME = IT_CE20002B_815-VVB01_ME.
    JR181005 - begin of ins.
         w_t_data_810-matkl = it_ce20002b-matkl.
    JR181005 - end of ins.
          APPEND W_T_DATA_815 TO TAB_DATA.
          CLEAR IT_CE20002B_815.
        ENDLOOP.
    thanks for reply
    rico

  • Deleting the staging tables

    Hi all,
    We are upgrading from 8.4 to 9.0 financials.
    we are at re-applying customizations phase now.
    In previous version(8.4), there was a custom app engine to delete the Voucher Staging tables(EC tables).
    in that app engine, all deletes were based on ECQUEUEINSTANCE field.
    (for ex delete from PS_VCHR_HDR_EC WHERE ECQUEUEINSTANCE BETWEEN 1234 AND 1235)
    Peoplesoft changed EC tables to STG tables in 9.0 version
    So my question is that in 8.4 in PS_VCHR_PYMT_EC has the ECQUEUEINSTANCE field in it. but the corresponding table PS_VCHR_PYMT_STG table does not have the ECQUEUEINSTANCE field. I am just wondering if any one got into this situation and how did you delete the PS_VCHR_PYMT_STG table?
    I don't want to delete everything in PS_VCHR_PYMT_STG table.
    Thank you.

    Please post the details of the application release, database version and OS.
    Do you have the statistics collected up to date?
    Please see these docs.
    PERFORMANCE ISSUE - REFRESH COLLECTIONS SNAPSHOT WHEN RUN FOR ALL [ID 1067892.1]
    Refresh Collection Snapshots Performance - Managing MLOG$ Tables and Snapshots for Data Collections [ID 1063953.1]
    How To Improve the Performance of the Refresh Collection Snapshots When Running Very High Volumes [ID 550005.1]
    How To Run MSRFWOR - Refresh Collections Snapshots Concurrent Request From The Application [ID 211121.1]
    Advanced Supply Chain Planning ASCP Performance TIPS Profile Options [ID 209996.1]
    Fast Refresh Is Slower After OATM and 10.2.0.3 Upgrade [ID 875532.1]
    MSRFWOR Refresh Collection Snapshots Performance Database Bug 4196039 [ID 369173.1]
    Master Note for Materialized View (MVIEW) [ID 1353040.1]
    Thanks,
    Hussein

  • After REFRESH the cached object is not consistent with the database table

    After REFRESH, the cached object is not consistent with the database table. Why?
    I created a JDBC connection with the Oracle database (HR schema) using JDeveloper(10.1.3) and then I created an offline database (HR schema)
    in JDeveloper from the existing database tables (HR schema). Then I made some updates to the JOBS database table using SQL*Plus.
    Then I returned to the JDeveloper tool and refreshed the HR connection. But I found no any changes made to the offline database table JOBS in
    JDeveloper.
    How to make the JDeveloper's offline tables to be synchronized with the underling database tables?

    qkc,
    Once you create an offline table, it's just a copy of a table definition as of the point in time you brought it in from the database. Refreshing the connection, as you describe it, just refreshes the database browser, and not any offline objects. If you want to syncrhnonize the offline table, right-click the offline table and choose "Generate or Reconcile Objects" to reconcile the object to the database. I just tried this in 10.1.3.3 (not the latest 10.1.3, I know), and it works properly.
    John

Maybe you are looking for

  • Officejet 8600N will no longer print from second tray in Apple Yosemite

    I recently installed a fresh install of Mac OSX 10.10 Yosemite .  Immediately after, my HP Officejet 8600 all-in-one would not pull from the optional second tray.  There is a 10/22/14 driver update that says it is for OSSX 10.10, but does not fix the

  • IPhoto can't remember location of original photos

    I am using a reference library in iPhoto. After transferring my library and my photos from my old G4 to my new I Mac running 10.7.5, the reference Library keeps asking me for the location of the photos that I transferred from the old computer. I poin

  • ORA-02270 Error

    I got ORA-02270 Error when tried to add foreign key on a detail table: CREATE TABLE supplier ( supplier_id numeric(10) not null, supplier_name varchar2(50) not null, contact_name varchar2(50) , insertedate date not null, CONSTRAINT supplier_pk PRIMAR

  • Please help me find TCP/IP in X

    Hello to the mac family, This posr is about my 350 slot load. I have installed Jag beside 9.2. No partition. Well I have finallydone it. I upgraded to Jag and got DSL. I connect fine using ethernet and Safari. What I want to do is make my system 9.2

  • Problem with Adobe Download Assistant

    Every time I am trying to sign into my Adobe Download Assistant it says I have an Error 100 because my account can't connect with Adobe.com.It is saying to check my connection(4 bars and direct connect) and to restart Adobe Download Assistant. How do