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.

Similar Messages

  • 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

  • How to read the data in excel sheet

    Dear sir,
    How to read the data in excel sheet when i recieve a data serial communication... ie i have store a data in excel such that
    Cell A       Cell B
       A           Apple 
       B           Ball
       C           Cat
       D           Doll
    when i recieve A from serial communication i have to display Apple, and when i recieve B i have to display Ball and so on.. 

    Hi, 
    I would recommend you to have a look at the VI attached. It makes use of a VI named 'Read from Spreadsheet' to read the row and column data from the tab delimited excel file. The read data is then searched for the Alphabet specified and finally returns you the corresponding string. The test file used to validate the operation of the VI is also attached. 
    Trust this would help you solve the issue. 
    Regards, 
    Sagar G Yadav | Application Engineer | National Instruments
    Attachments:
    read_from_excel.vi ‏10 KB
    Book1.txt ‏1 KB

  • How to read a data from USB port using JAVA

    hi all,
    i need to know how to read a data from USB port using java. any API are available for java ?.........please give your valuable ideas !!!!!!!!!
    Advance Thanks!!

    You can do this. Please use this link
    [http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=uHu&q=java+read+data+from+usb+port&btnG=Search&meta=&aq=f&oq=]
    What research did you do of your own? Have you done some testing application and tried yourself??

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to read the data in spectrum analyzer (Anritsu MS2661C) and put it in Excel using Labview

    Hi all, I'm new to using the labview, and I have some trouble doing my project using the labview software.
    I have been trying to use the spectrum analyzer (Anritsu MS2661C) which connect to computer using the GPIB connection.
    I have got the instrument driver which can write and control the instrument using Labview 2010.
    and my Question is how do read the data or result from the spectrum analyzer and send it to the microsoft excel?
    Do I need to use other software or programming to do this step?
    If anyone know how is this done, please let me know.
    Regards,
    Ery

    Hi ery,
    In order to send data that you have read in from an instrument to Excel, the most convenient way to do this would be to use our Report Generation Toolkit.  The Report Generation Toolkit is a very useful tool that allows you to interface to Microsoft Office software from LabVIEW, including Word and Excel.  I am not sure if you are familiar with this, but I have attached a link that explains more about the Report Generation Toolkit below.  
    Another way would be to use the Write To Spreadsheet File VI.  While this will store your data to a spreadsheet data file, it will not allow you to programmatically perform any Excel formatting like the Report Generation Toolkit offers.  I have also attached a link to some information on the Write To Spreadsheet VI below.  
    Also, be sure to check out the Example Finder in LabVIEW for a number of examples on how to write data to a spreadsheet file.  From LabVIEW, you can go to Help»Find Examples to launch the Example Finder.  From there, you can search for "spreadsheet," which should populate examples for use in different applications.  I hope this helps, ery.  Please let me know if you have any further questions about these!
    NI LabVIEW Report Generation Toolkit for Microsoft Office
    Write To Spreadsheet File VI 
    Taylor G.
    Product Support Engineer
    National Instruments
    www.ni.com/support

  • How to find Archive data In SAP

    Hi experts ,
    How to find Archive data in SAP throught the following tcodes FTWL & AS_afb.
    Thnx
    Venky

    Hello,
    Transaction FTWL is for the DART files (not actually archived data) that are stored in your archive server.  In order to run a query, or browse the DART file, you would need to "Import from archive" from within FTWL and then browse the file.
    I am not sure what you mean by AS_afb.  Please provide more information.
    Regards,
    Karin Tillotson

  • How to read the date and time information of a file by labview

    how to read the date and time information of a file by labview? for example, created time and modified time.
    Solved!
    Go to Solution.

    if you need to know the last modification date of file:-
    "Functions->File I/O->Advanced File Functions->File/Directory Info.vi"
    This vi returns the value of file's last modification date. This is returned as U32 number. To see it in MM/DD/YY format you must create the indicator, right-click on it and select "Format & Precision" item from drop-down menu. Then select "Time and Date" format there.
    Thanks as kudos only

  • How to read XI Data type in Java code and populate as array list, using UDF

    Hi,
    How to read XI Data type in Java code and populate as array list, using UDF?
    Is there any API using which  the XI data types can be read?
    Kindly reply.
    Richa

    Input Structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:CustomerCreateResp xmlns:ns0="urn:bp:xi:up:re:cust_mdm:cmdm:pr5:100">
       <CUSTOMER>
          <item>
             <CUSTOMERNO/>
             <MDMCUSTOMER/>
             <CREATE_DATE/>
             <RETURN>
                <TYPE/>
                <MESSAGE/>
             </RETURN>
             <PT_CONTPART_RETURN>
                <item>
                   <MDM_CONTACT/>
                   <CONTACT/>
                </item>
             </PT_CONTPART_RETURN>
             <PARTNERS>
                <item>
                   <CUSTOMERNO/>
                   <PARTNER_FUNCTION/>
                   <PARTNER_NUMBER/>
                   <DEFAULT_PARTNER/>
                </item>
             </PARTNERS>
          </item>
       </CUSTOMER>
    </ns0:CustomerCreateResp>
    Output structure
    (Sample output structure.This actually needs to be mapped and generated using UDF)
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:updateCustomer xmlns:ns1="urn:xiSericeVi"><ns1:customer><ns2:ArrayList xmlns:ns2="java:sap/standard">[]</ns2:ArrayList></ns1:customer><ns1:name>2344566</ns1:name></ns1:updateCustomer>

  • How to read master data?

    Can anyone tell me the procedure how to read master data?

    Hi,
    I am sorry but your question is a bit vague. What do you mean by your statement? Can you please elaborate your requirement.

  • How to read saved data in BPC 7 Nw Script Logic

    Hi all,
       I am trying to write the logic for Price*Quantity Calculation. This logic should be executed whenever user saves the data for either Quantity or Price.
    For this i created a Implementation on BADI "UJ_CUSTOM_LOGIC". But i am struck on how to read the data from InfoCube ,Like if user saves "Quantity",logic should read "Price" from the cube and calculate the result, Which is equivalent to GET(------) statement in SQL script Logic. Which method should i call to read the saved data in cube.
    Appreciate if someone can help me on this.
    Thanks&Regards,
    Ashok Kumar.

    Hi,
       You can use the LOOKUP instruction like:
    *LOOKUP RATE
    *DIM ENTITY2="DEFAULT"
    *DIM SOURCECURR:INPUTCURRENCY=ENTITY.CURR
    *DIM DESTCURR1:INPUTCURRENCY="USD"
    *DIM DESTCURR2:INPUTCURRENCY="EURO"
    *DIM RATE=ACCOUNT.RATETYPE
    *ENDLOOKUP
    Best regards,
    Mihaela

  • How to recover archived data in BW system ?

    Dear Friends,
    We are working on BW 3.1 system.
    Please let us know how to recover archived data in BW system ?

    Hi Sanjay Singh,
    You have 2 options,
    1) Either you can reload it through info package,
      once you create the archiving object on any cube  by defaulty the info package maintain the one option
    Load from archive data( There select with which archived file you required).
    2) Create infostructure,
    create the datasource and reload it to infocube
    i will give clear  description by tomorrow
    Regards
    Prakash. Vadala

  • How to get Archived Data back ?

    Hi Experts,
    Please explain How to get Archived Data back ?
    Thank you.

    Hi,
    Try Re: Reloading of archived business transactions using CRM_ACT_ON
    Hope you find it helpfull,
    Kind regards, Sigurd

  • 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 retrive archived data from ECC table

    Hi,
    I need extract the data from archived ECC tables to BW.
    How can I know that which tables the archived data has been stored in ECC ?
    Thanks for your help in advance.
    Raj.

    Hi Sreenivas,
    I know the t-code SARA using we can pull the data. Please let me know by the steps how to pull the archived data in to the data source.
    Do I need to create any generic data source or we can pull the data into existing data source.
    Please let me know by steps or if you have any document link?
    Thanks,
    Raj.

Maybe you are looking for

  • 10.6.8 server AFP Crashing

    I know Apple have had problems with AFP Crashing for sometime now but when I first installed 10.6.6 I was only getting about 4 AFP crashes a year (its sad that I think this is a good thing) and even when I upgraded to 10.6.7 it wasn't much different.

  • Using a SQL user-defined function in Crystal Reports XI

    Post Author: JoannKarp CA Forum: Formula Is it possible to use a user defined function in SQL and use this in multiple Crystal reports? JoannKarp

  • Dot matrix printing on 15 x12 inch paper

    Hi I have created report for purchase register Report is so large to print so i have desiged this report in PDL for dot matrix printer and  paper size 15 inch x 12 inch. When i going to print this report, i not get proper print out Please tell me the

  • How to initialize my Directory Server

    my data are stored in a RDBMS, and now I want to transform the data into Sun Derectory Server. The problem is when the data are mass, how to do the transformation. I don't know if there is any tool to do this, or I have to develop my own program to d

  • HT2213 Holding the power button does not work

    I've got a Mac Pro that stops recognizing my BD-ROM drive after it goes to sleep. I've been trying to reset the PRAM and NVRAM, per applecare's suggestion, but everytime I plug my Mac Pro in, it automatically starts up. I've turned off the "automatic