Reading archived data of different archive objects in Z programs

Hi,
   I have Z programs which are getting data from various tables. Now i needt to read archived data of those tables in my Z programs also. i.e. i need to modify those programs so that data archived for those tables should also be extracted. Now for exmple if the program is fetching data from MARA, EKKO, LIKP, KONP tables based on certain selection criteria, then how do i fetch archived data for same criteria as each of these tables may belong to different archive objects ? Please help me. Thanks in advance.

Hie Naganath
Using transaction SARA you can identify the archive objects for the tables you want to use. 
For material master you can use object MM_MATNR, for Purchasing documents use object MM_EKKO, for conditions use SD_COND and for deliveries use object RV_LIKP.
Retrieve the archive key and offset from table ZARIXMM5 (for Purchasing documents) for your select options and pass the offset and key to function ARCHIVE_READ_OBJECT to get the handle and then pass the handle to function ARCHIVE_GET_TABLE to read the record.  Have a look at the below code
select archivekey archiveofs into corresponding fields of table lt_arch_keys
               from zarixsd1 "SD Index table for billing documents
              where vbeln in s_docrng
                and kunrg in s_arc_kn
                and fkdat in s_arc_dt
                and fkart in s_arc_rt
                and vkorg in s_arc_og.
  loop at lt_arch_keys assigning <fs_lt_arch_keys>.
*Read information from archive
    call function 'ARCHIVE_READ_OBJECT'
      exporting
        object         = 'SD_VBRK'
        archivkey      = <fs_lt_arch_keys>-archivekey
        offset         = <fs_lt_arch_keys>-archiveofs
      importing
        archive_handle = ls_handle
      exceptions
        others         = 1.
*Get the requested header detail data for billing document
    call function 'ARCHIVE_GET_TABLE'
      exporting
        archive_handle          = ls_handle
        record_structure        = 'VBRK'
        all_records_of_object   = 'X'
        automatic_conversion    = 'X'
      tables
        table                   = lt_vbrk "Header data
      exceptions
        end_of_object           = 1
        internal_error          = 2
        wrong_access_to_archive = 3
        others                  = 4.
*Get the requested line item detail data for billing document
    call function 'ARCHIVE_GET_TABLE'
      exporting
        archive_handle          = ls_handle
        record_structure        = 'VBRP'
        all_records_of_object   = 'X'
        automatic_conversion    = 'X'
      tables
        table                   = lt_vbrp "Line item data
      exceptions
        end_of_object           = 1
        internal_error          = 2
        wrong_access_to_archive = 3
        others                  = 4.
    clear: ls_vbrk.
    loop at lt_vbrp assigning <fs_lt_vbrp>.
      read table lt_vbrk into ls_vbrk with key vbeln = <fs_lt_vbrp>-vbeln.
      move-corresponding <fs_lt_vbrp> to lt_archive_records.
      move-corresponding ls_vbrk to lt_archive_records.
      append lt_archive_records to gt_archive_records.
    endloop.
  endloop.
Do the same for your material master and condition records as well.
regards
Isaac Prince

Similar Messages

  • Unable to view the AUSP archive data

    Hi,
    I have archived the data for FI_ACCRECV archive object. I do not see AUSP table in the write statistics.
    I am not sure how to view the archived data of AUSP table.
    Kindly guide me. If this is not the correct forum to ask..please let me know where can i post this question.
    Thanks
    Mallika

    Hi
    In tcode DB15 you can see the archiving object for the table AUSP. In tcode AOBJ for object FI_ACCRECV, I can see that there isn't any report to read this data (if the archiving file is in its path). I'm sorry.
    Regards
    Eduardo

  • Change customized reports to access archived data

    Hello,
    I need to change few customized reports (z-reports) to make it fetch data from an archive database.
    This is done for SAP IS-H reports. So some of the tables for eg NBEW(movement table) will be archived and a correspoding
    infostructre will be created acting as an indice to archive database.So my query is what is the correct approach to read the data from the archive database which is a non-SAP system.
    1. Query the infostructure . Change each select statement to make it read from the infostruture .
    2. Directly read from non sap system files using some unix commands.
    When we use option 1 or 2 what are the benefits ? which is better?
    Some times may need to query both sap  databse and archive database if the date range overlaps So what are the performance impacts.
    Regards,
    Abhilash

    Hello All,
    Any ideas on my query.
    Thanks
    Abhilash

  • How to reload the archived data for Fi_documnt

    Hi..could any one plz let me know how can i reload the archived data which is on third party storage into sap database back. The archived data is related to FI_DOCUMNT. We don't have the Reload program for this object. The requirement is : Some of the FI documents are archived before being cleared. So, we want to reload the archived data back to SAP database and then do some modifications.
    Please tell me how this is possible..thanks a lot in advance.
    It's urgent.
    Thanks,
    Shamim

    Hi Siddhesh,
    Thanks for your reply.
    The information u provided looks good. However, as you know SAP has removed the Reload option for the archiving object FI_DOCUMNT in the last year. When i'm following ur steps, it's again taking me to the SARA transaction where i don't find the button for Reloading the archived data. The issue is like we have archived some of the posting documents or FI documents but during archiving, the complete flow was not followed and now we are required to archive the missing documents. In short, we have archived the FI documents whose clearing date was not even set or we have missed some of the documents. So we need to reload all the FI documents and then archive all the reloaded data with proper FI flow.
    Or do we have any custom program which will reload the archived data from the archive files??
    Would this really helpful for us if you show some inputs on this.
    Thanks alot,
    Shamim

  • How to read data with different XML schemas within the single connection?

    I have Oracle 11g database
    I access it through jdbc:oracle:thin, version 11.2.0.3, same as xdb.
    I have several tables, each has one XMLType column, all schema-based.
    There are three different XML schemata registered in the DB
    I may need to read the XML data from several tables.
    If all the XMLTypes have the same XML schema ,there is no problem,
    If the schemata are different, the second read throws BindXMLException.
    If I reset the connection between the reads of the XMLType column with different schemata, it works.
    The question is: how can I configure the driver, or the connection to be able to read the data with different XML schemata without resetting the connection (which is expensive).
    The code to get the XMLType data is textbook implementation:
    1   ResultSet resultSet = statement.executeQuery( sql ) ;
    2   String result = null ;
    3    while(resultSet.next()) {
    4   SQLXML sqlxml = resultSet.getSQLXML(1) ;
    5   result = sqlxml.getString() ;
    6   sqlxml.free();
    7   }
    8   resultSet.close();
    9    return result ;

    It turns out, that I needed to serialize the XML on the server and read it as Blob. Like this:
    1    final Statement statement = connection.createStatement() ;
    2    final String sql = String.format("select xmlserialize(content xml_content_column as blob encoding 'UTF-8') from %s where key='%s'", table, key ) ;
    3   ResultSet resultSet = statement.executeQuery( sql ) ;
    4   String result = null ;
    5    while(resultSet.next()) {
    6   Blob blob = resultSet.getBlob( 1 );
    7   InputStream inputStream = blob.getBinaryStream();
    8   result = new Scanner( inputStream ).useDelimiter( "\\A" ).next();
    9   inputStream.close();
    10   blob.free();
    11   }
    12   resultSet.close();
    13   statement.close();
    14
    15   System.out.println( result );
    16    return result ;
    17
    Then it works. Still, can't get it work with XMLType in resultset.On the client unwrapping XML blows up when trying to switch to different XML schema. JDBC/XDB problem?

  • How to read Archive data??

    Hi,
    I am developing a program which requires me to retrive the <b>archive</b> data of table BSAK and then fill it into an itam then output the list.
    I use T-code 'SARA' to find the object name is 'FI_DOCUMNT'. There u can find that BSAK is contained in it.
    And i reference the DEMO programm 'SBOOKR' and coding as belows, but the error message always shows and F1 couldnt help.
    [IMG]http://www.designoo.com/files/6678/incorrectInfo.jpg[/IMG]
    My code:
    * for Read Archive
    DATA: handle                 LIKE sy-tabix,
          buffer                 TYPE arc_buffer,
          wa_arc_bsak               LIKE bsak,
          number_of_records_read TYPE i.
    data: LE_DATA(8192) TYPE C,
          LE_STRUCTURE  LIKE ARC_BUFFER-RNAME.
    perform read_archive_bsak.
    FORM read_archive_bsak.
    * open existing archive files for BSAK
      CALL FUNCTION 'ARCHIVE_OPEN_FOR_READ'
           EXPORTING
                object         = 'FI_DOCUMNT'
           IMPORTING
                archive_handle = handle
           EXCEPTIONS
                OTHERS         = 1.
    *  IF sy-subrc <> 0.
    *    WRITE: / 'No file can be accessed'(001).
    *    EXIT.
    *  ENDIF.
      CLEAR number_of_records_read.
    * loop to get the next data object from the archive file(s)
      DO.
        CALL FUNCTION 'ARCHIVE_GET_NEXT_OBJECT'
             EXPORTING
                  archive_handle = handle
             EXCEPTIONS
                  end_of_file    = 1
                  OTHERS         = 2.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
    * get data records from the data container
        DO.
          CALL FUNCTION 'ARCHIVE_GET_NEXT_RECORD'
               EXPORTING
                    archive_handle   = handle
               IMPORTING
                    record           = LE_DATA
                    record_structure = LE_STRUCTURE
               EXCEPTIONS
                    end_of_object    = 1
                    OTHERS           = 2.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          CASE buffer-rname.
            WHEN 'BSAK'.
              wa_arc_bsak = LE_DATA.
              move-corresponding wa_arc_bsak to Tab_ARC_bsak.
                APPEND Tab_ARC_bsak.
                CLEAR: wa_arc_bsak, LE_DATA, Tab_ARC_bsak.
          ENDCASE.
          ADD 1 TO number_of_records_read.
        ENDDO.
      ENDDO.
    * close the archive session
      CALL FUNCTION 'ARCHIVE_CLOSE_FILE'
           EXPORTING
                archive_handle = handle.
    Move-corresponding tab_arc_bsak to tab_bsak.
    append tab_bsak.
    clear tab_bsak.
    ENDFORM.                    " read_archive_bsak
    Anyone helps??
    Thanks in advance!!!
    Hoo
    Message was edited by:
            Hoo lala

    Hi Aditya,
    The error msg is 'Incorrect access to an archive.'
    Thanks.
    Hoo.

  • PP_BKFLUSH reading archived data

    Hi all,
    We are using the archiving object PP_BKFLUSH to archiving backflushing document data from Repetitive Manufacturing,  and due the audit requirements, the transaction SARA can no longer be accessed by users. Our way of reading the archived data for this object uses the reading program of SARA transaction.
    Unlike from  PP_ORDER or PR_ORDER, that  have access to archived data directly from business transactions, the object PP_BKFLUSH not possess this characteristic.
    It is possible create indexes or some infostructure for reading the data? I have found no SAPNote to create the field catalog and info structure to use  the transaction SARI for reading of archived data.
    Thank you,
    Luiz Albanese

    Hello Luiz,
    You should be able to create your own custom archive information structure for this archive object.  Go to SARI -> Customizing -> Environment -> Field Catalogs.
    Create your custom Field Catalog and then create a custom Infostructure based on the newly created field catalog.
    Hope this helps.
    Best Regards,
    Karin Tillotson

  • URGENT!!!!  - Reading Archived Data from a Report.

    Hi,
    The data, prior to 15 months, of some tables (BSEG, BSAK),
    used in the report YGF11347 has been archived.
    Previously this report YGF11347 was run for vendor payment information for any time frame
    through FBL1N.  So any vendor line items from 2004, 2005, 2006 and current year,
    all data elements were available to be extracted and displayed on the report.
    Recently the Check Amount is missing when executing the report for payments made prior to
    04/01/2006. This is because of archiving the data prior to 15 months.
    My requirement is tht i need to display this archived data also in the report "YGF11347".
    Can anyone please help me on this issue.
    Regards,
    Akrati

    hi
    good
    check this link, hope this would help you to solve your problem.
    http://www.ams.utoronto.ca/Assets/output/assets/ixos_637070.pdf.pdf
    thanks
    mrutyun^

  • How to reload archived data into SAP database for object FI_DOCUMNT

    Hi..could any one plz let me know how can i reload the archived data  which is on third party storage into sap database back. The archived data is related to FI_DOCUMNT. We don't have the Reload program for this object. The requirement is : Some of the FI documents are archived before being cleared. So, we want to reload the archived data back to SAP database and then do some modifications.
    Please tell me how this is possible..thanks a lot in advance.
    It's urgent.
    Thanks,
    Shamim

    Thanks Mylene. I've already gone through the same note..i was just looking out for the new standard program or any one have created any new program for the same. I think it's better we must wait for SAP to launch its reload program or else it's not possible to reload the archived data for this object.
    Thanks
    Shamim

  • Regenerate Archive Data Object! Error

    Hi All,
    I have installed SAP NW Mobile EHP 7.1 Version.
    i am trying to upload NWMCLIENT02_0.sca using sdoe_upload_archive tcode, but it is giving an error Regenerate Archive Data Object!.  anybody pls help me to solve how to upload .
    Thanks in advance.

    Hi Rohit,
    I have installed another server and i followed the same steps, i did it almost 20 times but it is not uploading the NWMCLIENT02_0.SCA. After that i extracted the .sca file and uploaded individual .sda files, everything is uploaded successfully except sap.comtcmobilesetupwin32.sda.
    My Server details:
    EHP Mobile 7.1 server installed on windows 7 64 bit OS.
    Oracle 11g.
    earlier i did the same thing in same configuration.
    i have followed everything as per help.sap.com.
    i dont know what is the exact problem, can u pls explain me why i am unable to do this.
    Thanks&Regards
    Murthy

  • Reading Archived Data Through SAP Query Report

    Dear SAP Gurus,
    My client archived their SAP data in a particular year range and all the Z reports have to modified to read these archive data. Normal ABAP reports can be modified to read the archive data without no problem.
    But there are two Z SAP query reports which should be modified the same way so it will be able to read archive data.
    What is the best method for this? Does SAP Query tool provide facility to read archive data? or do I have to append the code?
    Thank you in advance for your help
    Regards,
    Isuru Fernando

    >
    Isuru U Fernando wrote:
    > hi Manthan,
    >
    > Yes I used these FMs and read the data without any problem for normal ABAP reports.
    >
    > But SAP query report is the problem. Is it advisobale to modify the SAP query generated report source code? since it is a system generated report.
    >
    > Regards,
    > Isuru
    No, do not adapt the SAP generated report source. The reason is: every time someone re-generates the query from tx. SQ01 your changes will be lost.
    You could add the functionality Manathan gave you to add to the infoset of said query - but to be honest: in my opinion that is shooting nuclear rockets at flies. Also you run the risk that every change of the infoset (add a join/delete a join) requires adjustment of said coding you applied ... and where will you be then? Fancy repairing the same query over and over again? Try talk sense to your client - go for a Z-report here ...

  • How to restore Archived Data on diffrent server.

    Hi,
    Requirement is quite confusing..
    I'm running on ECC 6.0 on HP IA64, Oracle 10g.
    My org. want to archive data for specific co. code.  Their requirement is to restore the archived data in the new server (A totally new landscap, on ECC 6.0, Solaris Sparc & Oracle 10g),
    I'm familiar with archiving process, but unaware about the restoration of archived data on the different server.
    Could you please guide me how to restore the archived data on the different landscape?
    Regards,
    Neehir Bhatt

    Hi Neehir Bhat,
    If you are building a new system, then it's highly advised to use data backup & restore mechanism rather Archived data restore.
    The purpose of Archived data is totally different from building a new system and the Archived data can never be solution to recover database to point-in time. Archived data meant for emergency restore of data in terms of document base rather database as a whole. Please refer below for detailed information.
    If you receive a request for reloading data some time after archiving, you must first
    determine the reason for such a request. Often such a request has to do with a
    requirement for data display that cannot be met by reloading the data. .
    If you reload data that was archived some time in the past, you can have data
    inconsistencies in your database because of, for example, a new number range for your
    documents. The new number range will be overwritten during reloading. For some
    archiving objects, not all data records are reloaded into the database. For example, the
    reload program for orders does not reload the corresponding cost center debits in CO
    back into the database. However, cost centers can be read from the archive file.
    The reloading function can be used unproblematically only for situations under
    scenario 1, reloading data into the database immediately after archiving. Otherwise,
    you should find out what triggered the request for reloading data and contact SAP if
    necessary.
    You can use the reload function only if the archive files are available in the file system.
    It is not possible to directly access the archive files in an external storage system
    For more information about the reload function from the viewpoint of
    ADK development, see SAP Note 53064.
    Regards
    Sekhar

  • Archiving/zipping to different folder

    Hello
    Normally the Finder Archive function (accessible e.g. from contextual menu in Finder) archives to a .zip archive in the same folder as the original object being archived.
    The Finder Archive function use BOMArchiveHelper, which is in:
    /System/Library/CoreServices/BOMArchiveHelper.app/Contents/MacOS/BOMArchiveHelpe r
    So the same archiving can be achieved in an AppleScript by the following statement:
    do shell script "/System/Library/CoreServices/BOMArchiveHelper.app/Contents/MacOS/BOMArchiveHel per" "theUnixname"
    where theUnixname is the Unix name of the file or folder being zipped. This works.
    My question is the following: Is there any option to BOMArchiveHelper that permits the resulting file to be in a different folder than the original file or folder? This would permit archiving directly to another disk, e.g. an external hard disk, without first copying the uncompressed files or without using disk utility to make a compressed disk image.
    (The reason I would like to use the zip files is that they are more universal than the compressed disk images. And I want to use BOMArchiveHelper rather than another ZIP program such as ZipIT because the Macintosh structure with resource forks is preserved by BOMArchiveHelper in a way that still permits the ZIP archive to be opened on e.g. a Windows or Linux machine, which is not the case for the MacBinary implementation in ZipIt).
    Thanks in advance

    I think you can use a shell-like command in an AppleScript.
    In this command you could use gzip "sourcefile" > "targetfile"

  • How to see archive data for Sales order

    Hi all,
            I am working on PS , network is created with sales order 10911. the components are added while sales order created, but after that someone deletes the sales order, because now it is showing oder does not found, where i get the entreis for sales order.
    Regards,
    Khushi.

    Hi Khushi,
    To see the archived data for sales order , go to transaction code SARA.
    Choose object name as SD_VBAK.Click READ.
    It will show a screen giving a name of program and option to execute in background or foreground.
    It will help you to get information about archived sales order data.
    Hope it helps you.
    Thanks,
    Sarita singh Rathour
    Edited by: Sarita Rathour on Aug 28, 2009 7:46 AM

  • Extracting Data from Archived data files in R/3

    Hi Experts,
    I have a situation here!!!
    I want to extract data from R/3 for BW. In R/3 system, data is present in archived files (which are not in readable format). In R/3 system, the report definitions are ABAP codes which give output. These ABAP codes uses same infostructure, archived files are also same, but the logic is different for every report. I am trying to modify these ABAP codes to get data in a format which can be loaded in BW, but then i have to make different cubes for different report outputs in BW.
    Is there any way in which i can read the structure of these archived files so that i can design a single cube to store data of these files?

    Hi Arindam,
    It is possible to extract archieved data from R/3. Following link contains the 'How to' guide for the same.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0ded994-c520-2a10-9da7-bc92c9e9882d
    Hope this will be helpful. Thanks.
    Sumit

Maybe you are looking for

  • Help with calculating fractions in a program...

    I'm supposed to declare to fractions and then add, subtract, mulitply, and divide them. (3, 4) (2, 3) The outcome is supposed to look like this... Number 1 is 3/4 Number 2 is 2/3 Reciprocal of 3/4 is 4/3 Reciprocal of 2/3 is 3/2 3/4 + 2/3 is 17/12 3/

  • Error compiling GCC 4.3.1 on Solaris 10 x86 (Update 5)

    I am getting error when building GCC 4.3.1 on Solaris 10 x86. Have any of you built GCC 4.3.1 on Sol 10 x86? Here's the background: $ cat /etc/release Solaris 10 5/08 s10x_u5wos_10 X86 Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. Use is

  • Problem in filling up the setup tables for 2LIS_11_VAHDR (All SD Data sources)

    Hello All, I have been  trying to fillup the setup tables for SD datasources( Application-11 Ex:2LIS_11_VAHDR), but it was not allowing me to do that. Below are the steps i have followed, 1.Deleted the setup tables using tcode-LBWG- Application-11 2.

  • Rebuilding Iphoto Library is it safe?

    Hi I'm currently rebuilding my Iphoto Library which has 70,000 photos. I checked all the boxes, does rebuilding the library effect my ratings, keywords, or my manual arrangement of my Photos? How long does it normally take to complete? Will my librar

  • Where are the Photoshop 'default' textures?

    Hi, I'm trying to complete a PS tutorial about making historical styled typography.  The tutorial is online at  www.tutorialhero.com.  The tutorial uses two textures which are 'DIRT' and  'ROCKWALL'  which it refers to as being found in,  "Default Ph