Fast Skip on SAP Document Management Service 02
I personally don’t want to split this topic into 2 pieces. But it seems to me SCN blogs has limitation that only allow you insert 30 pictures. Then I have to using this second episode to introduce the other 2 solutions to realize document attachments in your applications.
Fast Skip on SAP Document Management Service 01
Customized Solution on DMS
A customized attachment solution means only use DMS as a storage service, and use Z-tables to store meta data and object link information. To be more intuitive, I will give a real example on how to implement an attachment service for purchase order.
Create your own APIs
1. Create 2 Z-tables. ZMMR1034 (Header table), and ZMMR1035 (Item table) are created
2. Create a Class: ZCL_MM_ATTACH_SERVICE to encapsulate DMS operations: upload, read, get detail, and delete.
The class is mainly based on SAP BAPIs in function group: CVBAPI.
Function group: ZMM_ATTACHMENT is the main entry point which invokes the class object and synchronizes data with the 2 tables.
Embed in Standard PO Application
1. Add an attachment button in ME23N
You achieve this through a user exit(introduced bellow) to add a customer screen, in which you can add your buttons.
2. Click the button will pop up a screen to allow you upload, read, and delete attachments of PO.
3. Use Tcode: CMOD to open USER EXITS . Double click the screen exit: SAPMM06E 0101.
You can then add the attachment APIs and your own logic into the screen flow. This solution has the advantage that you bypass a lot of complexity of pure DMS, and you get more flexibility in implementing your own solutions. But you should also aware of the data atomicity when you save the PO. The document operations and PO operations should be in one transaction.
SAP GOS (Generic Object Service)
SAP GOS is a collection of many personal/general functionality. Document attachment is one of them.
SAP GOS document attachment is based on KPro and ArchiveLink. ArchiveLink is another solution in SAP for store archived documents. ArchiveLink is based on CMS too, and is much simpler than DMS.
When you choose “Create Attachment” in GOS, the document is stored as SAPoffice document using Knowledge Provider Interface (KPRO). For more information, refer the following link: Frequently asked questions about Generic Object Services GOS – Application Server Infrastructure – SCN Wiki
There are also 2 very helpful notes:
530792 – Storing documents in the generic object services and
904711 – SAPoffice: Where are documents physically stored?
Store Attachments using ArchiveLink
1. Define content repository: The ID must only have 2 characters.
Path: SPRO–> SAP NetWeaver–> Application Server –> Basis Services –> ArchiveLink->Basic Customizing->Define Content Repositories
2. Edit document class
SPRO–> SAP NetWeaver–> Application Server –> Basis Services –> ArchiveLink->Basic Customizing->Edit Document Classes
3. Edit document type
SPRO–> SAP NetWeaver–> Application Server –> Basis Services –> ArchiveLinkàBasic CustomizingàEdit Document Types
4. Edit Links: This step links document type with business object.
SPRO–> SAP NetWeaver–> Application Server –> Basis Services –> ArchiveLink->Basic Customizing->Edit Document Types
5. Call ME23N to upload an attachment. Double click “PO Attachment” and upload a PDF file.
6. When successes, in the attachment list you will find the new item
Where to store attachments in GOS
By default, KPRO stores the SAPoffice data in the database table “SOFFCONT1 ”. You can select external content server by customize using Tcode: SKPR08. According to Note: 668271, you can edit table “SDOKPHCL” using se16 by adding following content.
|CREA TIME||16.07.1998 21:10:00|
After that, call SKPR08 you will find the entry: SOFFPHIO. Add a new category “ZSD_DMS” which is defined in DMS configuration steps. Now, upload document will be uploaded to SAP content server.
Now you can upload document using “Create Attachment” in GOS, and it will show you the creator and create time compared with before.
How to Invoke GOS in Applications
If you want PO applications to invoke GOS, you must enhance the application to add GOS codes. Take ME23n as an example, User exits should be found to adding code like bellow:
report ZPO_ATTACHMENT_POP2. parameters: P_EBLEN type EBELN. data: W_BTN_LOTDOC type CHAR100, W_GOS_MANAGER type ref to CL_GOS_MANAGER, W_GOS_LOTOBJ type BORIDENT, W_GOS_SVC type SGS_SRVNAM. *check W_GOS_SVC is not initial. clear:W_GOS_LOTOBJ. W_GOS_LOTOBJ-OBJTYPE = 'BUS2012'. "PO W_GOS_LOTOBJ-OBJKEY = P_EBLEN. "GOS MANAGER create object W_GOS_MANAGER exporting IP_NO_COMMIT = '' exceptions OTHERS = 1. "TO GENERATE OUTPUT W_GOS_SVC = 'VIEW_ATTA'. "All the attribute are in table SGOSATTR *W_GOS_SVC = 'ARL_LINK'. call method W_GOS_MANAGER->START_SERVICE_DIRECT exporting IP_SERVICE = W_GOS_SVC IS_OBJECT = W_GOS_LOTOBJ exceptions NO_OBJECT = 1 OBJECT_INVALID = 2 EXECUTION_FAILED = 3.
Run the program will pop up the screen directly.
Now we have 3 solutions to realize document attachment in applications, they are:
- Standard DMS solution
- Customized DMS solution
- Standard GOS solution.
If you want no version management and document editing features, option 2 and 3 are preferred. While option 3 is the simplest way but lack of customization functions like adding additional fields in the pop up screen or embed as the sub screen in applications. A well designed option 2 solution could be the most appealed choice.
It is indeed a wonderful document. This has helped me a lot in Understanding DMS. I want a little explanation on GOS, Archive Link and DMS. Since we can store documents in an External server (Content Server) using any of these 3 interfaces. GOS is one of the simplest amongst all three. Then what is the advantage of using Archive link and DMS, when we can achieve the functionality using GOS?