KPro stored document extract and placed on ArchiveLink
Can anybody provide me with a snippet code to enable me to extract an e-mail type RAW from within SAP (KPro) and move it to Archivelink.
DOC_OID is obtained from table BCST_SR and the doc data is extracted from table SOOD and a binary relation is created between the document in KPro and a BO EQUI using function BINARY_RELATION_CREATED of type ATTA. This result in the email being available in the GOS Services for the particular Business Object as an attachment and when viewed it looks like an email from Outlook.
The attachment relationship does not allow an authorisation check and anybody with access to the EQUI object through IE03 can view all attachments. Client wants this attachment to be extracted from the KPro and stored in an ArchiveLink repository and then linked again to the Business Object EQUI as a business document. Configuration is done in OAC2/3. This way they can apply authorisations per business document type.
I managed the following:
I extracted the document data from Kpro using the same procedure as in above except I use CHECK_HEX_MODE in program SAPFSSO3 and SOCX_SELECT in SAPFSSO0 to extract the OBJHEAD_TAB OBJCONT_TAB OBJPARA_TAB and OBJPARB_TAB. I can also use method GETU_CONTENT from class CL_DOCUMENT_BCS. I then convert the contents to binary format via some code I found in a standard SAP program . Then I use function ARCHIVE_CREATE_TABLE with AR_OBJECT = SOAARCHIVE and SAP_OBJECT = SOFM. I then get the ARCHIV_ID from the relevant table (TOA01 in this case according to configuration) and then I create an archive connection between the SAP object EQUI and this archived document using ARCHIV_CONNECTION_INSERT.
When the business document is viewed in the GOS services for this object it is no longer in the original MSG format but rather in a flat text format. The client is not happy as they would like to see it as the original MSG type as it was when it still was an attachment. The previous attachments must also be converted into business documents.
Any advice will be appreciated and awarded.