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: 

How to dispaly archvied data through Archive key and offset from custom program.

former_member565266
Participant
0 Kudos

Hi Experts,

I have a requirement to pull archived data based on archiving file key and offset. Can you please provide your suggestions with sample code. I need to develop a program and display the data.

Please help me on this..

Regards,

Satish.

1 ACCEPTED SOLUTION

Jelena
Active Contributor
0 Kudos

Re: "am stuck at how to display the data in ALV for all Infostructures"

Is there some problem with using SALV for this? Check SALV_DEMO... programs.

4 REPLIES 4

nabheetscn
Active Contributor

Satish what all have you tried so far and where you are stuck? Can you please provide the details

Nabheet

Sandra_Rossi
Active Contributor

Also, I don't understand what you mean with "offset" ? Programs use published ADK function modules to read archives (cf https://help.sap.com/saphelp_nw70/helpdata/en/2a/fa04af493111d182b70000e829fbfe/frameset.htm).

former_member565266
Participant
0 Kudos

Hi Experts,

Below is my code but am stuck at how to display the data in ALV for all Infostructures.

CALL FUNCTION 'AS_API_READ'
EXPORTING
i_fieldcat = gs_aind_str1-skey
i_selections = ' '
IMPORTING
e_result = lt_result[]
EXCEPTIONS
parameters_invalid = 1
no_infostruc_found = 2
field_missing_in_fieldcat = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE 'No Active Info Structure Found!' TYPE 'E'.
ENDIF.

SORT lt_result[] BY archivekey.
DELETE ADJACENT DUPLICATES FROM lt_result COMPARING archivekey.

LOOP AT lt_result INTO ls_key.
CALL FUNCTION 'ARCHIVE_READ_OBJECT'
EXPORTING
object = p_object
archivkey = ls_key-archivekey
offset = ls_key-archiveofs
IMPORTING
archive_handle = l_handle
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.
ENDLOOP.

IF NOT sy-subrc IS INITIAL.
RAISE archive_not_read.
ENDIF.

DO.
* read first record to get type of current structure
CALL FUNCTION 'ARCHIVE_GET_NEXT_RECORD'
EXPORTING
archive_handle = l_handle
IMPORTING
record_flags = lv_record_flags
record_structure = lv_structure
record_ref = lr_record
EXCEPTIONS
end_of_object = 1.

IF sy-subrc <> 0.
EXIT.
ENDIF.

Regards,

Satish

Jelena
Active Contributor
0 Kudos

Re: "am stuck at how to display the data in ALV for all Infostructures"

Is there some problem with using SALV for this? Check SALV_DEMO... programs.