Upload Document Into DMS Server Using Net Weaver Gateway - SAP Blogs
Upload Document Into DMS Server Using Net Weaver Gateway - SAP Blogs
Community
Former Member
August 22, 2016 6 minute read
Scenario:
DMS is used to read the content of storage documents (external data server but not SAP content server).Here I am
going to explain one of mine client requirement to upload the document after/while creating the Purchase requisition
in item level. So in order to achieve the functionality we need to upload the le from non-SAP server into DMS
(CV01N) using Gateway.
By Using this Blog, you can upload a wide range of documents like Word Documents,Excel Sheets, PDF, Text Files and
Images and many more through Gateway service.
Procedure:
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 1/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 2/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
Double click on Entity Type created and put tick mark on Media type check box (mandatory).
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 3/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
Click on Save
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 4/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 5/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
Then Redefine the DEFINE method in the *MPC_EXT Class and add the below logic.
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 6/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
Method DEFINE.
super->DEFINE( ).
IF lo_en ty is BOUND.
lo_property->SET_AS_CONTENT_TYPE( ).
ENDIF.
Endmethod.
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 7/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
Rede ne CREATE_STREAM Method and implement the below logic to upload document into the DMS Server from ODATA Service.
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 8/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
Code:
method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_STREAM.
DATA : ls_documentdata TYPE bapi_doc_draw2,
ls_DOCUMENTNUMBER TYPE BAPI_DOC_AUX–DOCNUMBER,
ls_DOCUMENTTYPE TYPE BAPI_DOC_AUX–DOCTYPE,
ls_DOCUMENTPART TYPE BAPI_DOC_AUX–DOCPART,
ls_DOCUMENTVERSION TYPE BAPI_DOC_AUX–DOCVERSION,
ls_RETURN TYPE BAPIRET2,
lv_filename TYPE DBMSGORA–FILENAME,
lv_PURE_FILENAME TYPE SDBAH–ACTID,
lv_PURE_EXTENSION TYPE SDBAD–FUNCT.
lv_filename = IV_SLUG.
ls_documentdata–wsapplication1 = lv_PURE_EXTENSION.
ls_documentdata–wsapplication2 = lv_PURE_EXTENSION.
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 9/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
* Check original 1 into the SAP data base at the same time
REFRESH lt_files.
CLEAR lt_files.
ELSE.
LS_DOC–DOCNAME = ls_DOCUMENTNUMBER.
copy_data_to_ref(
EXPORTING
is_data = LS_DOC
CHANGING
cr_data = er_entity ).
ENDIF.
endmethod.
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 10/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
All input Values we have to get into the SLUG parameter from the UI Side. If you have multiple input parameter values then
concatenate multiple parameter values with delimiter we have to get the values in SLUG parameter.
Select the entityset and Upload a le through add le button which is on left side corner as shown in the below screen shot.
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 11/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
Service Response:
Result:
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 12/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
Go to CV03N Transaction and provide document number and document type and click enter as shown below.
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 13/16
11/6/2019 Upload document into DMS Server using Net Weaver Gateway | SAP Blogs
In the same way we can upload any type of document into DMS.
Thanks&Regards,
Prasanna Addula
Alert Moderator
Assigned tags
How to add les to the existing document info data in DMS server using the SAP Net Weaver Gateway
By Madhulatha Gummadi , Aug 25, 2016
https://blogs.sap.com/2016/08/22/upload-document-into-dms-server-using-net-weaver-gateway/ 14/16