Archiving of table records

Hi,
Oracle9.2
Windows
I have created a cursor to copy the records from table T1 to another table T2 which are 30 days old and those copied records need to be deleted from table T1.
Now, before deleting the records from table T1, I want to put some verification code to check whether all the records have been copied or not, then and then the delete process should execute else the copy statement should be rolled back.
so, how to cross check this copied records ?
With Regards

Forget the cursor, just use a SQL statement. Less code means that it is more reliable and you do not have to check whether the rows got copied or not. Delete the records from the source table by just applying the same criteria to the delete as you did for the select.
If you select records based on sysdate then you could save that as a variable before the insert so you are guaranteed to use the same value for the delete.
You could check the number of rows from the insert and the delete to make sure they are equal.
Commit only after the delete.

Similar Messages

  • Archiving Purchase Info Records

    Hi,
    Can you please let me know what are the prerequsites that need to be completed before archiving a Purchase Info Record?
    do we need to check for any other dependency/flag other than the Mark for deletion (table field LOEKZ   'X')
    Please any one of you sugest me the solution for the above questions;
    Thanks,
    Jeevan.

    Hi Jeevan,
    In order to be able to delete an info record, you have to mark the Info Records for deletion. 
    To do so, use transaction ME15 and flag record for deletion. After you have deleted all info records, use archiving program RM06IW30 or follow the menu path Logistics - Materials Management u2013Purchasing - Master Data - Info Record - Follow on Functions - Archive. 
    Make sure that you only archive Records Marked for deletion as all records may be deleted! 
    Create Archive File: Info Record:
    a) Select Action: Archive and enter a new Variant, for example: Z_EINA_ARCH_ 01, press 'Maintain'
    b) On selection screen enter the data range (Vendor, Material, etc.) you want to archive.
    c) Deselect the 'Test' flag if you don't want to test first.
    d) Press green back-arrow and enter the description of this new variantt on the screen which follows.
    e) Save the variantt which brings you again to the selection screen. Press green back arrow again.
    f) To start archiving process (batch-job), press the 'Start Date' button and select the time when you want to start this process. Select 'Immediate' for instant processing and press the 'Save' button on the bottom of the Start Time' window.
    g) Select the 'Spool Parameter' button and save entries. Eventually enter a valid printer to have the result outputted.
    h) You are ready now to start the process. Press the 'Start' button and monitor the success with the 'Job Overview' button You can also go the 'fast path' by using transaction SE38, program RM06IW30 to archive info records. For large data archiving, use the background jobs and run those during off-peak times. If you run the program online, you will see a confirmation on the status bar telling 'New Archive file created:.... ' Delete Archived Records: Info Record
    a) Follow the menu path: Tools - Administration - Administration - Archiving
    b) Select the Object Name MM_EINA for info records
    c) Select the menu button 'Delete'
    d) Select the menu button: 'Archive Selection'
    e) Click the archive created in previous step
    f) Select Start Date for process and Spool Parameters for output
    g) Submit selection.
    h) Check status by pressing the Job Overview button
    Reg,
    Ashok
    Assign points if useful.

  • How to enable archive at table level

    Hello Everyone,
    We are having performance issue when timesheet transfer job runs since the no of records in CATSDB table is more(4,013,039 Entries).
    I would like to know how to enable archiving at table level.so that timesheet transfer job doesnt run for a long time.
    Appreciate your response.
    Regards,
    Vadi

    You can only archive data based on archiving objects and not based on individual tables as it has to maintain the consistancy within the database.
    Following links might help you.
    [http://help.sap.com/saphelp_nwpi71/helpdata/en/8d/3e4e0c462a11d189000000e8323d3a/content.htm]
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d76f5301-0b01-0010-2a97-9938052ddf81]

  • Archiving S033 table.

    Hi,
    We need to archive S033 -Statistics: Movements for Current Stock (Individual Records) table. After we archive this table is there any standart analyses report that we can not run anymore? For example can we run the report MC44, MC.9 etc. after the archiving?

    Hi,
    As far as I know there are no reports available which can read the archived statistical data. Hence you can not run the report MC44 etc to access the archived S033 information structure data.
    Hope this helps
    Cheers!
    Samanjay

  • Cannot display archived idoc data records in SARA

    Hello,
    In our ERP system, we regularly archive idocs older than 6 months. To view these archived idocs I use transaction SARA (with archive object IDOC and infostructure SAP_IDOC_001) to search for the relevant idoc that has been archived. Once the idoc is displayed, I drill down further by clicking the magnify glass button which then displays the idoc levels:
    EDIDC               Control record (IDoc)
    EDIDD               Data record (IDoc)
    EDIDS               Status Record (IDoc)
    SRL_ARLNK      SREL: Archive Structure for Links
    When I try to view the Data Records, I get a message saying "You are not authorized to display table EDIDD". According to our Authorizations department, this is not an Auth issue but rather config setup or program issue.
    Why can't I view the archived idoc data records? Is there another way to view archived idoc data?
    Regards,
    Fawaaz

    Hi Jurgen,
    Thanks for moving my post to the correct space.
    Our Auth team is very confident that this is not a user auth issue. This could possibly be true because the idoc data resides on the following tables when in the database (before archive) - EDIDC, EDID4 & EDIDS. The idoc could then be viewed via transaction WE02 or the Data Browser (SE16). There is no EDIDD table in our ERP system so obviously no authorization object to assign to.
    Once the idoc is archived, the data is removed from the ERP tables and moved to our archive database/server for storage. So when trying to view the archived record, the system does not access the ERP tables but rather the archive directory (that it's mapped to in settings). I assume the SARA transaction merely displays the data in the same segments/grouping with these table names (mentioned above in my first post) but instead of EDID4 it displays EDIDD.
    According to the error longtext, "The check performed when data is read from the archive is the same as that of the Data Browser (transaction SE16)". So I was not involved with setting up our archiving procedure but could it be that table EDID4 was incorrectly mapped to table EDIDD in archives?
    Regards,
    Fawaaz

  • Archiving of table

    I have been given a Change Request for Archiving a table (ZSOP_Cust). I am an FICO Consultant here. I know that arcgiving a table can effect other tables too? Can someone tell me how can i check how & which tables are effected?
    Also tell me other points i shd consider before archiving this table??
    Thanks in advance

    Standard Archiving of standard SAP tables will handle all of the connections.  It will not allow you to archive a record from a table if the ties to other tables are not closed as well.  For custom tables, there are no archiving functionality.   Your ZSOP_Cust table, seems to be a custom table and the ties to other standard objects are not documented in the system, hence you can blow away the entire table, and SAP will not care.
    Regards,
    Rich Heilman

  • How can I convert table object into table record format?

    I need to write a store procedure to convert table object into table record. The stored procedure will have a table object IN and then pass the data into another stored procedure with a table record IN. Data passed in may contain more than one record in the table object. Is there any example I can take a look? Thanks.

    I'm afraid it's a bit labourious but here's an example.
    I think it's a good idea to work with SQL objects rather than PL/SQL nested tables.
    SQL> CREATE OR REPLACE TYPE emp_t AS OBJECT
      2      (eno NUMBER(4)
      3      , ename  VARCHAR2(10)
      4      , job VARCHAR2(9)
      5      , mgr  NUMBER(4)
      6      , hiredate  DATE
      7      , sal  NUMBER(7,2)
      8      , comm  NUMBER(7,2)
      9      , deptno  NUMBER(2));
    10  /
    Type created.
    SQL> CREATE OR REPLACE TYPE staff_nt AS TABLE OF emp_t
      2  /
    Type created.
    SQL> Now we've got some Types let's use them. I've only implemented this as one public procedure but you can see the principles in action.
    SQL> CREATE OR REPLACE PACKAGE emp_utils AS
      2      TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
      3      PROCEDURE pop_emp (p_emps in staff_nt);
      4  END  emp_utils;
      5  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY emp_utils AS
      2      FUNCTION emp_obj_to_rows (p_emps IN staff_nt) RETURN EmpCurTyp IS
      3          rc EmpCurTyp;
      4      BEGIN
      5          OPEN rc FOR SELECT * FROM TABLE( CAST ( p_emps AS staff_nt ));
      6          RETURN rc;
      7      END  emp_obj_to_rows;
      8      PROCEDURE pop_emp (p_emps in staff_nt) is
      9          e_rec emp%ROWTYPE;
    10          l_emps EmpCurTyp;
    11      BEGIN
    12          l_emps := emp_obj_to_rows(p_emps);
    13          FETCH l_emps INTO e_rec;
    14          LOOP
    15              EXIT WHEN l_emps%NOTFOUND;
    16              INSERT INTO emp VALUES e_rec;
    17              FETCH l_emps INTO e_rec;
    18          END LOOP;
    19          CLOSE l_emps;
    20      END pop_emp;   
    21  END;
    22  /
    Package body created.
    SQL>Looks good. Let's see it in action...
    SQL> DECLARE
      2      newbies staff_nt :=  staff_nt();
      3  BEGIN
      4      newbies.extend(2);
      5      newbies(1) := emp_t(7777, 'APC', 'CODER', 7902, sysdate, 1700, null, 40);
      6      newbies(2) := emp_t(7778, 'J RANDOM', 'HACKER', 7902, sysdate, 1800, null, 40);
      7      emp_utils.pop_emp(newbies);
      8  END;
      9  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM emp WHERE deptno = 40
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM
        DEPTNO
          7777 APC        CODER           7902 17-NOV-05       1700
            40
          7778 J RANDOM   HACKER          7902 17-NOV-05       1800
            40
    SQL>     Cheers, APC

  • Shell Script For Export And Import Of Table Records

    Hello,
    We have production and test instances and for constant testing we need to copy data from production to test or development environment.
    At the moment what we do is manually doing export and import table records. At times this could be very tedious as we may need
    to do this exercise a couple of times in a day.
    Is it a good idea to do this exercise using shell script? If so how could I do this? If this is not a good idea what are the best alternatives?
    Any input is highly appreciated.
    Thanks

    Ah I see, your company prefers stupidity over efficiency. It would be possible to do it in a controlled environment, wouldn't it? Also the test database would be allowed to select only.
    So the non-allowance is just plain stupid.
    To the second question: do you use hard-coded passwords in shell scripts?
    Don't you think that poses a security risk?
    Don't you think that is a bigger risk than a database link, properly set up?
    In my book it is!
    Sybrand Bakker
    Senior Oracle DBA

  • Unable to read E$ table records into excel file in linux machine

    Hi
    I am using below code in ODI procedure to read E$ table record and store it in excel file
    ODI Procedure: Technology=Java Beanshall and Command on Target I written below code and placed it in CKM Oracle KM
    <@
    String OS = System.getProperty("os.name").toLowerCase();
    String v_path="";
    if((OS.indexOf("win") >= 0))
    v_path="D:\Unload_Dir\<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("mac") >= 0)
    v_path="path details";
    else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 )
    v_path="/odi_a/oracle/Middleware/logs/wcds/odi_logs/<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("sunos") >= 0)
    v_path="soliaris path";
    @>
    OdiSqlUnload "-FILE=<@=v_path@>" "-DRIVER=<%=odiRef.getInfo("DEST_JAVA_DRIVER")%>" "-URL=<%=odiRef.getInfo("DEST_JAVA_URL")%>" "-USER=<%=odiRef.getInfo("DEST_USER_NAME")%>" "-PASS=<%=odiRef.getInfo("DEST_ENCODED_PASS")%>" "-FILE_FORMAT=VARIABLE" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"
    select * from <%=odiRef.getTable("L","ERR_NAME", "W")%>
    But is not reading the data into .xlsx file ,
    Please help me it is very urgent
    Can I use below code
    String os = "";
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
    os = "windows";
    } else if (System.getProperty("os.name").toLowerCase().indexOf("linux") > -1) {
    os = "linux";
    } else if (System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) {
    os = "mac";
    T
    his is high priority, please help me urgent
    Regards,
    Phanikanth
    Edited by: Phanikanth on Feb 28, 2013 5:43 AM
    Edited by: Phanikanth on Feb 28, 2013 6:00 AM
    Edited by: Phanikanth on Feb 28, 2013 7:42 AM

    Hi,
    can you describe what is happening when you run the ODI procedure described below:
    - Does the procedure fail with an error, if yes, which error(full details)?
    - Does the procedure pass but no xslx file is been created?
    - Does the procedure pass and an xslx file is been created, but Excel can't read it? If yes, what is the structure of the xslx file when read in an editor?
    What I can see from your code below is that you have choosen -FILE_FORMAT=VARIABLE, but the XSLX format is supposed to be XML.
    Regards,
    Alex

  • Refresh internal table records in web dynpro

    Hi Guru's
    I am facing an issue in web dynpro abap.
    in my application there is a button called OPEN.
    when i click on open button internal table records should be refreshed.
    so i have written code like this
    DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
      lo_COMPONENTCONTROLLER =   wd_this->get_componentcontroller_ctr( ).
      lo_componentcontroller->clear_info_refresh_visible( ).
    but iam getting an error message Method "CLEAR_INFO_REFRESH_VISIBLE" is unknown or PROTECTED or PRIVATE
    Could you please help me to how do i activate and refresh the things.
    Thanks
    Rajue

    wd.rajue wrote:
    Hi Guru's
    >
    > I am facing an issue in web dynpro abap.
    > in my application there is a button called OPEN.
    > when i click on open button internal table records should be refreshed.
    > so i have written code like this
    >
    > DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .
    >
    >   lo_COMPONENTCONTROLLER =   wd_this->get_componentcontroller_ctr( ).
    >
    >   lo_componentcontroller->clear_info_refresh_visible( ).
    >
    >
    >
    > but iam getting an error message Method "CLEAR_INFO_REFRESH_VISIBLE" is unknown or PROTECTED or PRIVATE
    >
    >
    > Could you please help me to how do i activate and refresh the things.
    >
    > Thanks
    > Rajue
    Raju,
    Please clarify this.
    Do you have a method clear_info_refresh_visible  in your component controller. I think not.
    I am not able to relate your request and coding.
    You can simply clear the internal table like this
    clear lt_intern_tab[].
    If it is a context node then you can bind a empty table to the node to make it empty.
      lo_nd_data->bind_table(
         new_items            =   lt_intern_tab
         set_initial_elements = abap_true ).

  • Archive Purchase Info Record MM_EINA : problem with CDHDR

    Hello,
    I have notice that when i archive an Info Record, Only CDPOS is deleted and not CDHDR.
    In the customizing, Object Class CHANGEDOCU is set.
    Can someone explain why datas in CDHDR are not deleted ?
    Thank you,
    Cipriano

    Yes, I agree with Jurgen.  You should open a message with SAP.  As, the CDHDR records should be archived along with the CDPOS records.  That is how it works when I archive purchase info records with MM_EINA.
    Best Regards,
    Karin Tillotson

  • Document attachment to custom tables / records

    Good morning,
    do you know if it is possible to attach external documents to custom tables / records, in the same way as it is possible for standard transactions (Services for Object)?
    If yes, can you please advise me on some reference documetns about how to customize this functionality?
    Thanks in advance
    AS

    Hi ,
    Displaying attachments is not available in the Interaction record view.You need custom development to enable the attachemnts there.
    usually the process would be to create a followup activity from the interaction record and attch documents there.
    Thanks,
    Rajiv.

  • How to display the Internal table records in table format?

    Hi Gurus,
    I want to display my print prg internal table records in d appropriate form in a table format, give some solution
    with regards
    Thambe

    There are lot many options to do that
    one way is create template  in the maikn window  and define the line types according to your data  cretae text and put your data in the text and go to output options and give  the line type to be used . You can also select details option to have lines in your output.
    similarly YOU CAN CREATE TABLE IN THE MAIN WINDOW FOR THIS YOU DONT NEED TO DEFINE THE LINE TYPES .
    WHEN YOU ARE IN MAIN WINDOW RIGHT CLICK ON TABLE AND GO TO PATH
    CREATE  -> TABLE
                  -> TEMPLATE
    REWARD IF USEFUL
    Regards,
    Nageswar

  • Archiving of Info Records

    Hi,
    I have 22 Materials and now user wants me to archive all the INFO Records related to these 22 materials?
    Please guide me what are the prerequisite needed to be done by me before archiving all the INFO Records.
    Note: We had errors in Production system, which we want to reproduce in Quality system.
    Cheers,
    Kumar.S

    Hi
    Follow the below steps:
    1. Flag Info-Records for deletion (ME15)
    This will Set the Deletion Flag only in Purchase Info Record.
    Once Deletion Flag is set you need to Archive them Using SARA with Archiving Object MM_EINA which will delete the Info Records from the Database.
    2. Run the archiving program - RM06IW30 (Menu path -> Logistics - Materials Management u2013Purchasing - Master Data - Info Record - Follow on Functions - Archive)
    Create Archive File: Info Record:
    a) Select Action: Archive and enter a new Variant, for example: Z_EINA_ARCH_ 01, press 'Maintain'
    b) On selection screen enter the data range (Vendor, Material, etc.) you want to archive.
    c) Deselect the 'Test' flag if you don't want to test first.
    d) Press green back-arrow and enter the description of this new variantt on the screen which follows.
    e) Save the variantt which brings you again to the selection screen. Press green back arrow again.
    f) To start archiving process (batch-job), press the 'Start Date' button and select the time when you want to start this process. Select 'Immediate' for instant processing and press the 'Save' button on the bottom of the Start Time' window.
    g) Select the 'Spool Parameter' button and save entries. Eventually enter a valid printer to have the result outputted.
    h) You are ready now to start the process. Press the 'Start' button and monitor the success with the 'Job Overview' button You can also go the 'fast path' by using transaction SE38, program RM06IW30 to archive info records. For large data archiving, use the background jobs and run those during off-peak times. If you run the program online, you will see a confirmation on the status bar telling 'New Archive file created:.... ' 
    Delete Archived Records: Info Record
    a) Follow the menu path: Tools - Administration - Administration - Archiving
    b) Select the Object Name MM_EINA for info records
    c) Select the menu button 'Delete'
    d) Select the menu button: 'Archive Selection'
    e) Click the archive created in previous step
    f) Select Start Date for process and Spool Parameters for output
    g) Submit selection.
    h) Check status by pressing the Job Overview button 
    regards
    Antony

  • Function module for move internal table records into MSexcel file

    Hi all,
    Tell me the function module which is used to
    move internal table records in to MSexcel file.
    Give the sample program...

    Please search the forum for FM  "GUI_DOWNLOAD" You will get tons of threads with sample code.
    Also take a look into SAP_CONVERT_TO_XLS_FORMAT
    Thanks

Maybe you are looking for

  • B Channel out of service

    Hi, I am getting B Channel OOS in my event viewer for a gateway in CCM. Whats the reason for this. How can i rectify this. Can call get disconnected due to this. Please suggest..... Help required immediately.

  • Change Cursor in javascript = image flicker

    Hi, I am using a javascript call to change the cursor as part of a drag and drop javascript region. The call is like this: document.body.style.cursor = 'pointer'; This works fine, although creates a strange image redraw / flicker whenever I call it.

  • Entity object with Step by step explanation

    Dear friend, i want to make entity object using ADF framework anyone can give me the PDF or URL

  • Can only change dvd player region 5 times? (idvd player)

    me my dad both got computers. I put a dvd in it said it was the wrong region code. then i looked it up on help and it says you can only change the region 5 times. We (the united states) are in region 1 but my dad has some japanese (region 2) discs he

  • No Ranges for Goods receipt document

    Hi, Can we create two no ranges for goods recei[pt for two different plant under same  company code.