Skip to Content
avatar image
Former Member

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.

Current Scenario:

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.

New requirement:

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jul 16, 2015 at 09:30 AM

    Hi Coenraad,

    what is the MIME-Type and the Document class according to note #1739026?

    You must have a consistent setup.

    I assume that when the document is retreived and posted again the correct format is not sent together.

    You also have to take care of the display. What is your current setup in OAG1? And do you have a protocol defined in the corresponsing content repository?

    Also please note that ArchiveLink is also using KPro for communication. ArchiveLink in that manner only responsible for the connection entry in the TOA01, etc.:

    Knowledge Provider (BC-SRV-KPR) - SAP Library

    Best regards,


    Add comment
    10|10000 characters needed characters exceeded

  • Jul 16, 2015 at 09:09 AM

    Hi Coenraad,

    did you specify DOC_TYPE ='MSG'? Otherwise document type of SOAARCHIVE is used (BIN).

    Additionally have a look in notes 1840170, 1739026, 1895122 and 1797073 regarding problems with mimetype of MSG.

    Another question: why do you specify SOFM/SOAARCHIVE at ARCHIV_CREATE_TABLE? You could directly use EQUI/xxx.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Did as suggested and can see the link between SAP object and archived document in table TA001 and RESERVE = MSG. Problem when opening  attachment in GOS. Get message from Microsoft Outlook e.g. "Cannot start Microsoft Outlook,. Cannot open file: C:\Users\<user>\Documents\SAP\ALTMP_QDf_15.MSG. The file may not exist, you may not have permission to open it........" The directory does not even exist on my PC.

      Why does the System try and open a file on my PC?

      When I get the  file content  using SOCX in SAPFSSO0 into OBJHEAD, OBJCONT, OBJPARA and OBJPARB only OBJCONT has data. It is then strung into a table of type SOXARC that contains a line of char1024. Contents of this table is then casted as RAW 1024 and appended to a BIN_ARCHIVE to be used in ARCHIVE_CREATE_TAB as the data input.  Does this sound correct.

      I will further investigate the notes you provide.

  • avatar image
    Former Member
    Aug 20, 2015 at 12:50 PM

    Thank You to all who assisted. I could not resolve this problem and settled on a plain text and the client requested I investigate the saving of the message type document as a PDF. This will result in its own problems.

    This thread is now closed.

    Add comment
    10|10000 characters needed characters exceeded