DMS Linking from BW Report
SAP R/3, SAP BW (any version). For more information, visit the Business Intelligence homepage.
The document stored in the SAP DMS server needs to be linked with the BW Reports. The document gives an overall solution on the activities to be performed on the R/3 side and the BW side to achieve the same without migrating the actual documents to the BW Server.
Author : Vineet Kumar S
Company : Capgemini
Created on : 14 Oct 2016
Author is working with Capgemini, Bangalore as an SAP BW/ABAP Consultant. BW development related activities and Abap developments are the responsibilities carried by the author.
The business related documents such as Invoice copy, Asset document, Trip receipt, Vendor change mails etc. are stored in the DMS sever. These are the legal documents/proofs that support the business transactions. In BW system, we develop the BW reports for these business transactions. So user might have requirements, where he/she needs to verify the Report Data by looking at those business documents associated with the transactions.
Hence, the solution of DMS linking with BW reports was proposed and developed. The solution involves the uploading of the document to the BW server and then linking the document with the BW reports. The end user will be able to access the document associated with the reports, by Report to Report Navigation of the BW report, without actually migrating the document from the DMS server. The user can either view/download the document in the browser.
The documents relevant to the business transactions, either soft copy or the scanned images of the hard copy are maintained in the document server. For several business requirements, these documents are needed to be linked with the respective BW reports. So the user can refer the documents which are the legal proof of the business transactions.
Let’s take a simple scenario to explain the same: Say we need to display documents associated with certain ECC transactions e.g. (FB03, VA05, AS03, etc.) without actually migrating the relevant documents from the document server. Now we need to link these documents in the BW reports. Develop BW reports and when the user select a particular record displayed in the BW report he gets the document associated to that particular business transaction from the DMS server. This document will explain the configurations need to be done in R/3 before uploading the document to the SAP DMS content server, uploading the document to the serve and BW implementation to link the documents with the respective report.
The transaction relevant document needs to be uploaded to the SAP DMS content server, using an upload program. But before uploading the document to the server, there are certain configurations which need to be maintained. Configurations include, document class, document type, content repository id etc.
First we need to configure the Document class in the system. This can be done by the T-code, OAD2, where the document class, description and the MIME type for the Web Object are configured.
After the configuration document class, we have the following configurations OAC0 for creating the content repository, OAC2 which is used to assign the document class to the document type and OAC3 which is used to link the content repository, document type along with the link table and all these need to be configured in the sequence OAC0, OAC2 and finally OAC3
Please find below the screen shots for the different configurations:
Configuration using OAC0
Configuration using OAC3
Configuration using OAC2
A custom program has been developed to upload the documents in to the DMS repository with all the required details. On uploading the documents, the program will create a SAP archive Link, which can be later used in the BW system for linking the documents with the Report. The program also updated a custom table with the details of the SAP Archive Link, Document and the content repository details. This table data can be extracted into the BW system, for linking the document.
- Upload the Data file, which has the following details: SAP Object ID (Object Type), Document Number, Content Repository ID, Document Type and the file path of the document to be uploaded.
- From the upload data file, get the document name and upload the document content using function module, ‘GUI_UPLOAD’.
- Convert the document content to ‘Xstring’ format using the function module, ‘SCMS_BINARY_TO_XSTRING’
- Generate the SAP Archive Link for each document using the functional module, ‘ARCHIV_CREATE_TABLE’
- Commit the upload using ‘BAPI_TRANSACTION_COMMIT’.
- Update the Custom table with the SAP Archive link generated and the other document relevant data. (Custom Table will be explained in the next session.)
As mentioned in the above section, the upload program will upload the documents and generate a SAP Archive Link for each document. The same details will be updated in the custom table, so that it can be used later for linking the document successfully. Please find below the important field details for the custom table.
- Object Type: This gives the link between the Archived document and the SAP. E.g. (BKPF, BSEG, BUS1022 etc.)
- OBJECT ID : It’s a combination of the Company code, Document Number and the fiscal year
- Content Repository ID: Used to identify the content server.
- SAP Archive Link ID: The Link generated while uploading the document to the server, which can be later used to link the document from the BW reports.
- Document Number : The Document number of the document associated with the business transaction
- Document Type: Gives the details of the type of the document which is loaded.(Configured using OAC2)
These are the basic settings or developments involved in the R/3 side. Next the document will explain on the BW side developments.
The link table (Custom table) which has the link between the image and the data needs to be extracted into the BW system. To extract the data, a generic data source is created over the custom table as mentioned in the image below:
The above mentioned fields will be loaded into the SAP BW system from the R/3 system. The data from the PSA will be loaded to the DSO. The data in the DSO will be used for linking the document with the BW Reports. The DSO will have full load, as the data will be for the historical data and there will not be any new records generating. The DSO will hold the data for the entire document archived in the DMS Server for the historical transactional data in the R/3 system. While loading the data to DSO the Company code, Year and Trip number is derived from the Object Id based on the Document type. For the document type, related to HR Trip, there won’t be any company code and year. For all the other document types, there will be company code and year.
An ABAP program is developed to link the documents in the DMS server with the BW Historical reports. The program will basically accept the Document Number as a mandatory input from the BW Report. Apart from the mandatory input, we have Company Code, Year and Trip number as the optional input parameters. The documents are fetched based on the combination of these input parameters. HR Trip Data related documents will be linked based on the document number (Which will be the personnel number in case of HR Reports) and the Trip Number. But for all the other reports, the document linking will based on Document number, Company code & Year.
- The Selection screen to accept the input for the Document Number, Company Code, Fiscal Year, Trip Number
- Based on the input, identify the records from the DSO which has the R/3 extract of the link between the data and the image.
- From the DSO, get the Content Repository ID and the Document ID (GUID).
- Pass the Document ID and the Content Repository ID into the Standard Function Module, ALINK_RFC_DOCUMENT_URLS_GET, which will generate the URL for the document which is selected based on the import parameters.
- Once the link is generated, the same will be called using another standard function module, CALL_BROWSER, which will enable the document to view or download in the browser, based on the type of document.
The Historical BW Report’s will be having the transactional data, now the document corresponding to the transactional data has to be linked using the ABAP Program. This can be achieved through the RRI (Report to Report Interface) settings in the BW system. T-code, RSBBS, is used to create the linkage between the BW report and the ABAP Program
In this transaction, we have to create a Sender – Receiver Assignment, where the BW report will be the sender and the ABAP Linking Program will be the receiver.
After maintaining the Receiver and the Sender, we need to maintain the assignment which enables the effective communication between the Report and the program. For which we need to identify the correct mapping between the fields in the BW Report and the input parameters of the ABAP Program. The same has been shown in the below image.
Once the BW report is executed through Bex or RSRT, the transactional data will be displayed in the output screen. Now select the transaction for which we need to view / download the document from the DMS Server. Right click on the record corresponding to the Document Number and navigate to the option which says ‘Display Document’. If there is a valid document available for the report, then it will be opened in the browser else nothing will be displayed or the error message can be displayed as configured in the ABAP Program.
While trying to access the document, make sure that all the required fields needed to identify the documents are available in the rows. If not drill the fields from the Free Characteristic section to the ROW section. In this case, it will be Document Number, Company Code and Fiscal year, as it’s a Non HR Report.
The below images will illustrate on how to navigate to the option to access the document and how the document will be viewed in the Browser.
One major issue faced while accessing the document was regarding the MIME settings which needs to be maintained in the browser level for the document types. Please refer the link below, for the details on the solution for the same.
The document for the corresponding to the transactional data can be viewed/saved by accessing the same from the DMS server, without physically migrating the document from the original Server where it is stored. The document can be of any type PDF, Excel, Word document, Images, MSG file etc. Document Number is the main field which needs to map correctly with BW report based on the functionality of the Report. For HR data, Document Number will be a Personnel Number, For Invoice document, it will be an invoice document number, for Asset related document it will be an Asset Number. Etc. This solution will provide user an easy and simple option to access the associated the document for the transactional data displayed in the BW report.
For more information, visit the Business Intelligence homepage.