2015 Mar 31 9:50 AM
Hi BigGods,
I encounter a archiving problem. i need archive several custom tables. And In my write program, this is process flow:
LOOP main_itab.
SELECT *
INTO sub_itab1
FROM db1
PACKAGE SIZE p_size(from selection screen)
WHERE....
SELECT * INTO sub_itab2 FROM db2 FOR ENTRIES IN sub_itab1.
CALL FUNCTION 'ARCHIVE_NEW_OBJECT'
EXPORTING
archive_handle = lv_handle.
CALL FUNCTION 'ARCHIVE_PUT_TABLE'
EXPORTING
archive_handle = lv_handle
record_structure = 'DB1'
TABLES
table = sub_itab1.
CALL FUNCTION 'ARCHIVE_PUT_TABLE'
EXPORTING
archive_handle = lv_handle
record_structure = 'DB2'
TABLES
table = sub_itab2.
CALL FUNCTION 'ARCHIVE_SAVE_OBJECT'
EXPORTING
archive_handle = lv_handle.
ENDSELECT.
ENDLOOP.
CALL FUNCTION 'ARCHIVE_WRITE_STATISTICS'
EXPORTING
archive_handle = lv_handle.
* write protocol
CALL FUNCTION 'ARCHIVE_PROTOCOL_WRITE'.
* close archiving session
CALL FUNCTION 'ARCHIVE_CLOSE_FILE'
EXPORTING
archive_handle = lv_handle.
All above 'WRITE' program run with successfully, generated a archive file in server.
After i run my 'DELETE' program, all the related contents in db1 and db2 also be deleted, seems good.
But when i run 'READ' program, only contents in last package be read to show in ALV.
For example, in DB1 totally have 10 rows data, and my p_size set as 7, 'SELECT.... ENDSELECT' will run twice, right.
So only the second run, those last 3 rows can be read in 'READ' program.
If i set p_size as 8, then 2 rows will be read, if greater than 10, then all 10 rows will be read.
I try to download archived file( abcd.archive ) to local using CG3Y to see what structure exactly in this .archive file, but open with unreadable messy code.
I need show all 10 contents in 'READ' program, Any hits to this problem? thank you very much.
Regards,
Archer
2015 Mar 31 11:44 AM
I haven't worked on this but looking at demo program RSARCH10, it appears first ARCHIVE_PUT_RECORD is done, followed by multiple calls to ARCHIVE_PUT_TABLE to put dependents records, and then save.
You are looping at main_itab. Probably the workarea of table needs to be put in each loop pass before putting related tables.
Hi Manish,
Thanks your replay. Yeah, this is my first task about archive custom data. I`m luck guy, I already solved this issue.
After many times of debugging, i found the issues actually occurs in my 'READ' program.
As you see in 'WRITE' program, In each 'SELECT...ENDSELECT', every 'ARCHIVE_NEW_OBJECT' will create a new object, so how many package will have how many objects in the same archive file.
Then in 'READ' program, need
DO. (At very beginning, i have not 'DO ENDDO' to get next object, that`s why i only get the last, )
CALL FUNCTION 'ARCHIVE_GET_NEXT_OBJECT'
IF SY-SUBRC <> 0 .
EXIT .
ENDIF .
....
...
ENDDO.
Regards,
Archer
2015 Mar 31 11:44 AM
I haven't worked on this but looking at demo program RSARCH10, it appears first ARCHIVE_PUT_RECORD is done, followed by multiple calls to ARCHIVE_PUT_TABLE to put dependents records, and then save.
You are looping at main_itab. Probably the workarea of table needs to be put in each loop pass before putting related tables.
2015 Mar 31 4:36 PM
Hi Manish,
Thanks your replay. Yeah, this is my first task about archive custom data. I`m luck guy, I already solved this issue.
After many times of debugging, i found the issues actually occurs in my 'READ' program.
As you see in 'WRITE' program, In each 'SELECT...ENDSELECT', every 'ARCHIVE_NEW_OBJECT' will create a new object, so how many package will have how many objects in the same archive file.
Then in 'READ' program, need
DO. (At very beginning, i have not 'DO ENDDO' to get next object, that`s why i only get the last, )
CALL FUNCTION 'ARCHIVE_GET_NEXT_OBJECT'
IF SY-SUBRC <> 0 .
EXIT .
ENDIF .
....
...
ENDDO.
Regards,
Archer
2015 Mar 31 4:48 PM
Also check your first two SEELCTs. The first one reads into a structure, but the second one uses FOR ALL ENTRIES on a table.
Rob
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |