Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Read Archived data in Customized report

former_member435556
Participant
0 Kudos

Hi All

I am trying to read archived data (archiving object = pa_calc) from content server to show this data in my customized report becuase of the client requirement, I am using this Fm to get this data,

CALL FUNCTION 'ARCHIVE_READ_OBJECT'

CALL FUNCTION 'ARCHIVE_GET_NEXT_RECORD'

CALL FUNCTION 'ARCHIVE_CLOSE_FILE'

But in CALL FUNCTION 'ARCHIVE_GET_NEXT_RECORD' fm its giving me error of

''Archiving object/archiving clas PA_CALC is reading beyond the end of the data"

Please guide me as i am new in archiving,and correct me if my approach is not correct,

Regards,

1 ACCEPTED SOLUTION

ArcherZhang
Advisor
Advisor
0 Kudos

Hi David,

In generally, at first we call FM 'ARCHIVE_OPEN_FOR_READ' using archiving object(yours is PA_CALC),

DO.

   call FM 'ARCHIVE_GET_NEXT_OBJECT'.

   IF sy-subrc <> 0.

     EXIT.

   ENDIF.

   call FM 'ARCHIVE_GET_TABLE' to get data, and process it.

ENDDO.

At the end, call FM 'RCHIVE_CLOSE_FILE''.

Regards,
Archer

5 REPLIES 5

ArcherZhang
Advisor
Advisor
0 Kudos

Hi David,

In generally, at first we call FM 'ARCHIVE_OPEN_FOR_READ' using archiving object(yours is PA_CALC),

DO.

   call FM 'ARCHIVE_GET_NEXT_OBJECT'.

   IF sy-subrc <> 0.

     EXIT.

   ENDIF.

   call FM 'ARCHIVE_GET_TABLE' to get data, and process it.

ENDDO.

At the end, call FM 'RCHIVE_CLOSE_FILE''.

Regards,
Archer

0 Kudos

Hi Archer

Thnaks for replying

I am using CALL FUNCTION 'ARCHIVE_READ_OBJECT' instead of ARCHIVE_OPEN_FOR_READ is it correct?.


Here is my Initial development please guide and if you have some example program do share with me if possible.



CALL FUNCTION 'ARCHIVE_READ_OBJECT'

   EXPORTING

     OBJECT                          = 'PA_CALC'

    OBJECT_ID                       = '0001 '

*   USER_EXIT_PROGRAM               = ' '

*   USER_EXIT_FORM                  = ' '

    ARCHIVKEY                       = '000012-001PA_CALC '

    OFFSET                          = '1379'

*   MOVEFLAG                        = ' '

  IMPORTING

    ARCHIVE_HANDLE                  r_handle

*   COMPR_OBJECT_LENGTH             =

  EXCEPTIONS

    NO_RECORD_FOUND                 = 1

    FILE_IO_ERROR                   = 2

    INTERNAL_ERROR                  = 3

    OPEN_ERROR                      = 4

    CANCELLED_BY_USER               = 5

    ARCHIVELINK_ERROR               = 6

    OBJECT_NOT_FOUND                = 7

    FILENAME_CREATION_FAILURE       = 8

    FILE_ALREADY_OPEN               = 9

    NOT_AUTHORIZED                  = 10

    FILE_NOT_FOUND                  = 11

    OTHERS                          = 12

           .

IF SY-SUBRC <> 0.

         MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION 'ARCHIVE_GET_NEXT_RECORD'

   EXPORTING

     ARCHIVE_HANDLE                r_handle

*   GET_REAL_STRUCTURE_NAME       = 'X'

*   AUTOMATIC_CONVERSION          = 'X'

  IMPORTING

      RECORD                        = lit_data

*   RECORD_CURSOR                 =

*   RECORD_FLAGS                  =

    RECORD_STRUCTURE              l_structure

*   RECORD_LENGTH                 =

*   RECORD_REF                    =

  EXCEPTIONS

    END_OF_OBJECT                 = 1

    INTERNAL_ERROR                = 2

    WRONG_ACCESS_TO_ARCHIVE       = 3

    OTHERS                        = 4

           .

IF SY-SUBRC <> 0.

  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

       EXIT.

ENDIF.

       CALL FUNCTION 'ARCHIVE_CLOSE_FILE'

         EXPORTING

           archive_handle          = r_handle

         EXCEPTIONS

           internal_error          = 1

           wrong_access_to_archive = 2

           OTHERS                  = 3.

       IF sy-subrc <> 0.

         MESSAGE 'NOT FOUND1' TYPE 'I'." 'Unable to close archive session'.

         EXIT.

       ENDIF.

0 Kudos

There are many example programs in AOBJ, each archiving object have one, in 'Read programs' node.

Including 'PA_CALC'.

0 Kudos

IF you want use 'ARCHIVE_READ_OBJECT', I suspect that the parameter 'OFFSET = 1397' is not correct, try a smaller number?

And you`d better set a break point for message class BA(260) in your program, once it reached there, you could exactly check why it raise this error message.

0 Kudos

Dear Archer

I have Check Aobj read node in this i found RPAR1R00 program but when i check the program it actually reload the archive data, my requirement is to just read the Archive Payroll results and show their payslips of archived employees just like in Remuneration statement.

Please help me.