01-18-2006 6:20 AM
Hi,
I need to know where the Archivibng Object is created in SAP. For example in the function module:
open a new archiv for write
CALL FUNCTION 'ARCHIVE_OPEN_FOR_WRITE'
EXPORTING
CALL_DELETE_JOB_IN_TEST_MODE = TESTRUN
COMMENTS = TEXT-001
CREATE_ARCHIVE_FILE = CREATE
OBJECT = 'EXAMPLE'
IMPORTING
ARCHIVE_HANDLE = HANDLE.
This takes EXAMPLE as an input and returns the handle. Where exactly is the EXAMPLE object created. I checked swo1 and it is not there although I could find it in the table ARCH_OBJ. I have a case where I have to archive a particular file in the application server ( Directory /tmp ). All the necessary config for the logical and physical file is done in the FILE transaction. Any inputs will be appreciated.
I can also execute the function module: Filename_archive_object but I need to pass the handle as input. It looks like the order in which the directory is listed in AL11 defines the handle. When I try to execute this function module with the handle as the sy-tabix for /tmp directory the program errors out.
Looking forward to your replies.
regards
Aveek Ghose
01-18-2006 6:30 AM
Hi Aveek,
This is what you need to do:
From transaction AOBJ, get the Logical File name of the Archiving object you are using ('EXAMPLE'). Path: AOBJ > Select the object EXAMPLE > Customizing settings.
Using the logical file name from above, go to transaction FILE, where you will be able to see the exact physical location of this logical path.
FILE > Select logical name > Assignment of physical paths to logical path.
Hope this helps.
Sudha
01-18-2006 7:02 AM
Hi,
Thanks for the reply. Is there any way the handle can be determined in the function module:
CALL FUNCTION 'FILENAME_ARCHIVE_OBJECT'
EXPORTING
ARCHIVE_HANDLE = HANDLE
CLIENT = FILENAME_TAB-MANDT
LOGICAL_FILENAME = FILENAME_TAB-FILEINTERN
OBJECT_DELETE_FLAG = 'X'.
Does the handle signify the sequence of the directories in AL11.
I tried to use the program: RSARCH04 as an example fo the archiving object related issue. Although I have done the necessary config in FILE transaction the function module errors out in test execution.
Error: Clas Filename is not registered for handle 33.
The handle is defined as sy-tabix and I have put 33 as the handle as /tmp is in sequence 33 in the internal table that retrieves all the directories.
The FILEPATH_TAB retrieves all the directories:
LOOP AT FILEPATH_TAB.
initializing a new data object
CALL FUNCTION 'ARCHIVE_NEW_OBJECT'
EXPORTING
ARCHIVE_HANDLE = HANDLE
OBJECT_ID = FILEPATH_TAB-PATHINTERN.
ENDLOOP.
Any inputs will be appreciated.
cheers
Aveek Ghose
01-18-2006 7:36 AM
Hi Aveek,
I think that the handle is only a generated number and not the sequence of the directory. I will tell you why I came to this conclusion: If the handle did indeed depend on the directory, then all files for a particular object would have the same handle. This would hold good across even archive objects (as multiple objects could point to the same directory). I do not think this is the case. I tried reading 2 different files from the same directory, and got different handles for each.
As for the error you received - have you maintained the logical file name in AOBJ? Are all other configurations (tables, table relations, etc) defined?
I guess it would be helpful if you could post further details of the object EXAMPLE here.
Sudha
Message was edited by: Sudha Mohan
01-18-2006 8:14 AM
Hi,
I have all the definitions in FILE transaction and have checked the AOBJ transaction.
I will update later with my findings and your comments.
cheers
Aveek
01-18-2006 8:22 AM
Hi Aveek,
Check the Logical File Path defined from FILE transaction.I think the function module is not recognizing the physical file path.
Thanks
Lakshman
01-18-2006 9:07 AM
Aveek,
I read your post again and realized that the code pasted earlier (using FILEPATH_TAB) is incorrect, in my opinion.
Since you are creating a write program for a custom object, here are the steps you need to follow:
Use FM ARCHIVE_OPEN_FOR_WRITE to get the handle for your particular object.
Then, using the same handle, call FM ARCHIVE_NEW_OBJECT, which creates the data container for the object.
Then, call ARCHIVE_PUT_RECORD inside a loop for each record, finally call ARCHIVE_SAVE_OBJECT and ARCHIVE_CLOSE_FILE to save data and close the file.
The Archive handle you get from the first FM call will be required in all the subsequent calls.
Hope this helps.
Sudha
Message was edited by: Sudha Mohan
01-18-2006 10:02 AM
Hi,
Function Module ARCHIVE_CREATE_OBJECT can be used to
create archive object.
When Archive object is created Write and delete
program are associated with it. Check out
Sara and SARI transaction.
See the below link for more info on Archiving.
http://help.sap.com/saphelp_nw04/helpdata/en/6d/56a06a463411d189000000e8323d3a/plain.htm
Regards,
Amole