cancel
Showing results for 
Search instead for 
Did you mean: 

KPro stored document extract and placed on ArchiveLink

0 Kudos

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.

Problem:

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.

Accepted Solutions (1)

Accepted Solutions (1)

janosdezsi
Product and Topic Expert
Product and Topic Expert
0 Kudos

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,

Janos

0 Kudos

Please see my answer to Benedikt. Mime type and Document class correspond to what is said in note #1739026. Document is posted a MSG type. Setup in OAG1 is - simple hit list - Windows Viewer - HTML Control - WEBGUI - HTML Control - Reserve 1 is ticked and none of the other boxes. My protocol for the directory is IMA_0045. If I dropdown on the F4-Help I see many IMA_0045 all with the same Version but some have one of CDDC, CDDP or CGDC as the Method and some different Document Class. Does this mean you can not mix document Classes in a single repository? The one for MSG looks as follows

Protocol               IMA_0045

Version                0045

Method                CGDC

Document Class  MSG

Comm.type          TABLE

I noticed that there are two entries for MSG and the other has ARCHIVE LINK MSG as the Communication Type. What is the relevance of this Protocol and which to assign to the Repository?

janosdezsi
Product and Topic Expert
Product and Topic Expert

If you have something maintained in the protocol for doc class * and the other left on standard communication, than the setting for * will apply for those document classes which was left on standard comm.

For a proper setup you must have:
Display Stored Document (CDDC) -> MSG -> ARCHIVELNK
Retrieval Frontend (CGDC) -> MSG -> TABLE
Display Local File (CDDP) -> MSG -> ARCHIVELNK

With this  setup the document will be downloaded to an internal table then transfered to the SAP GUI on frontend and displayed with the default browser for this document class on the frontend PC.

0 Kudos

Janos.

In TX OAA3 when I display the Protocol and execute function "'Display Stored Document" I do not see document class MSG. How can I add it to the Protocol ? I cannot maintain the above suggested data if the document class is not part of the document classes included in the protocol.

Help will be appreciated. Thank You

janosdezsi
Product and Topic Expert
Product and Topic Expert
0 Kudos

If you have MSG in OAD2, then you must have it OAA3 too. Please try to generate a new protocol.

(I assue that you tried to scroll down in the list, but in order to be sure, please attach a screenshot from the list, where you cannot find MSG. Thank you.)

0 Kudos

Janos, Thank You..my fault did not understand the working of the scroll bar Will try now.

janosdezsi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Okay, no worries, OAA3 is kind of tricky in that way. If you managed to solve the problem, please also mark the correct answer here. Thank you.

Answers (2)

Answers (2)

0 Kudos

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.

benedikt_wagner_mdt
Active Participant
0 Kudos

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.

Regards,

Benedikt

0 Kudos

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.