03-09-2009 9:42 AM
Hello Experts,
I have few questions about Archiving object:
1. How to create an archiving object for set of Z tables? shall i create a new archiving object by clicking on new entry or shall i copy an existing archiving object.
2.is there any restrictions on number of tables being used in an archiving object? in our scenario there are around 15 Z tables...
3. in T code AOBJ, i want to maintain customizing settings, but the screen is greyed out,which authorzation role will give me the access to this screen.
4.what are the retrieval methods avaialable in system???
5.in our scenario we have created a new archivie info structure,shall we use standard field catalog or need to create a new one???
awaiting your reply
Regards
Ramana Reddy
03-09-2009 9:53 AM
hi
ans 4 :
you should call 4 function modules in sequence to retrive the archived data from archiving files to your report program.
see the below sample code:
data declaration
data: handle like sy-tabix,
buffer type arc_buffer,
sbook_wa like sbook,
number_of_records_read type i.
open existing archive files
call function 'ARCHIVE_OPEN_FOR_READ'
exporting
object = 'BC_SBOOK01'
importing
archive_handle = handle
exceptions
others = 1.
if sy-subrc <> 0.
write: / 'No file can be accessed'(001).
stop.
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 = buffer-segment
record_structure = buffer-rname
exceptions
end_of_object = 1
others = 2.
if sy-subrc <> 0.
exit.
endif.
add 1 to number_of_records_read.
enddo.
enddo.
write: / 'Total number of records read: '(002), number_of_records_read.
skip.
write / 'Last record read: '(003).
skip.
case buffer-rname.
when 'SBOOK'.
sbook_wa = buffer-segment.
write: / 'CARRID :', sbook_wa-carrid,
/ 'BOOKID :', sbook_wa-bookid,
/ 'CONNID :', sbook_wa-connid,
/ 'FLDATE :', sbook_wa-fldate,
/ 'CUSTOMID :', sbook_wa-customid,
/ 'ORDER_DATE:', sbook_wa-order_date,
/ '...'.
when ...
If the archive object contained more than one table
(different buffer-rname), more cases would be needed.
endcase.
close the archive session
call function 'ARCHIVE_CLOSE_FILE'
exporting
archive_handle = handle.
ans 5:
you can either use standard field catalog, from the available field in field catalog you can select the required fields alone to your info structure.
regards
mano
03-09-2009 9:53 AM
hi
ans 4 :
you should call 4 function modules in sequence to retrive the archived data from archiving files to your report program.
see the below sample code:
data declaration
data: handle like sy-tabix,
buffer type arc_buffer,
sbook_wa like sbook,
number_of_records_read type i.
open existing archive files
call function 'ARCHIVE_OPEN_FOR_READ'
exporting
object = 'BC_SBOOK01'
importing
archive_handle = handle
exceptions
others = 1.
if sy-subrc <> 0.
write: / 'No file can be accessed'(001).
stop.
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 = buffer-segment
record_structure = buffer-rname
exceptions
end_of_object = 1
others = 2.
if sy-subrc <> 0.
exit.
endif.
add 1 to number_of_records_read.
enddo.
enddo.
write: / 'Total number of records read: '(002), number_of_records_read.
skip.
write / 'Last record read: '(003).
skip.
case buffer-rname.
when 'SBOOK'.
sbook_wa = buffer-segment.
write: / 'CARRID :', sbook_wa-carrid,
/ 'BOOKID :', sbook_wa-bookid,
/ 'CONNID :', sbook_wa-connid,
/ 'FLDATE :', sbook_wa-fldate,
/ 'CUSTOMID :', sbook_wa-customid,
/ 'ORDER_DATE:', sbook_wa-order_date,
/ '...'.
when ...
If the archive object contained more than one table
(different buffer-rname), more cases would be needed.
endcase.
close the archive session
call function 'ARCHIVE_CLOSE_FILE'
exporting
archive_handle = handle.
ans 5:
you can either use standard field catalog, from the available field in field catalog you can select the required fields alone to your info structure.
regards
mano
03-09-2009 9:57 AM
hi
ans 1:
best way is to copy the standard archiving object, if your requirement is completely not matching with any available arc object then go for creating a new arc. object. ( but the latter is very rare).
feel free to revert back for doubts..
regards
mano
03-09-2009 10:09 AM
HI Manoj,
Thanks for your reply...
in our case we are using all Z tables, i dont see any standard archiving object matching,,,
and have one more question.. is Read program is used to retrieve the data or Archivie info structure should be used for this purpose...
Regards
RR
03-10-2009 3:20 AM
Hi,
Ans 1 :
You can go ahead in creating a new object in transaction <AOBJ> for Z tables. For creating an archiving object the following things are mandatory to be provided in AOBJ:
a)Write Program Name - To be deveopled for your tables
b)Deletion Program - To be developed for your tables
c)Read Program - this is optional , u can use an archive info structure also
d)Maintain Structure Definition - The tables for the archiving object must be defined here
e)Maintain Customizing Settings
If you are able to define these things you can create a custom archive object successfully.
Ans2 :
You can create one archiving object for all the 15 z tables.
Ans3 :
This screen also can be obtained from <SARA> transaction. Go to <SARA> -
> Customizing -
> Archiving Object-Specific Customizing---->Technical Settings
Ans4 :
The retrieval methods available are
a) Read Program
b) Archive Infostructure
c) DRB - Transaction <ALO1> (This is not applicable for custom tables)
Ans 5:
You need to create new field catalog since the standard catalogs will be available only for standard tables. If you have field catalogs already created for your custom tables you can use the same for your AIS.
Regards
Asish
03-09-2009 2:09 PM
hi
read program is nothing but a report program which have the 4 function module in sequence.
if you see my sample program ,in the call function 'ARCHIVE_OPEN_FOR_READ' i have passed my arc. object name.
at the time of configuration one or more INFO STRUCTURE will be added to an arc. object. because data stored in archived file should come through some structure to your program.
in your case create an info structure with all fields in your 15 z tables. and assign in to a arc.object.
infostructure is nothing but a structure used to bring your archive data to your program.
go through this link, its really good:
http://help.sap.com/saphelp_erp2004/helpdata/en/2a/fa04af493111d182b70000e829fbfe/frameset.htm
still have doubts feel free to revert back
regards
mano
03-10-2009 3:15 AM
Hi Ramana Reddy,
1. Z Archiving object can be created by custom Write program, delete progam. Write program helps in creating archive file hence all the necessary restriction that is required to archive the business document should be considered.
Custom Delete program helps in deletion of the archived data. This program should delete the archived data from the database only after checking the archive files written completely by write program.
Build of Custom Read program depends on your requirement. Better to take option of AIS.
2. There is no restriction of no of tables for custom archiving object. However to keep the business document intact you have to archive data from all the associated tables.
3. Archiving object specific customizing is cross client configuration so you have to open the client to do the customizing
4. Retrieval technique depends on the business documents, however SAP promots to use AIS instead of archive enable transactions and read program due to its drawbacks.
5. What is the reason of creating new archive infostructure? When you want to use standard field catalog then there is no need to create new archive structure. This can avoid duplication of work.
If you want some field that is not provided by standard infostructure then you can go with creation of new archive infostructure and field catalog.
Hope this information has help you.
-Thanks,
Ajay