Skip to Content
Nov 04, 2022 at 11:46 AM

BAPI for assigning already stored file in SAP Content Server to a new or existing DMS DIR



we are using SAP DMS with SAP Content Server in a SAP PM scenario.

We have several thousands of attachments coming in every night via IDocs and each one should be assigned to it's own DIR (Document Info Record), which in turn is assigned to a PM Notification.

Today we are doing these mass check-ins to the Content Server via DMS in two steps:

1) First the DIR with the file meta data is created and assigned to the notification. This is done via BAPI_DOCUMENT_CREATE2

2) In a next step the file content is checked-in to the content server, and the file stored in the CS is assigned to the DIR created in step 1. This is done by taking the file data from the IDoc, converting it to DMS table format and checking in the file with its content to the Content server via function module CVAPI_DOC_CHECKIN.

This works fine.

However, instead of first sending the file raw data via IDoc to ECC / S/4 Hana only because there is a function module in ECC / S/4 Hana which can check in the file content into the content server, we want to change the process a bit and we have managed to check in the file content directly via a https request (PUT) to the content server from the middle ware (BizTalk) and we also received the original file_id (example 4FCD97829A284DBE8565FA1979F0A217 ) back from the content server. BizTalk is after this sending this generated file_id (4FCD97829A284DBE8565FA1979F0A217) via IDoc to ECC / S/4 Hana. In this way we do no longer need to send the whole file content itself (the raw data) in the IDoc to ECC / S/4 Hana just because of the check in to the CS.

In ECC / S/4 Hana we are now looking for a BAPI, function, method or program in DMS or KPRO in order to assign the already generated file_id by the content server to an already created the Document Info Record. It is not necessary to create the DIR in advance: If there is another solution in ECC / S/4 Hana which creates the DIR at the same time as the already checked-in file is assigned to it, this is fine as well.

We have looked at BAPI_DOCUMENT_CREATE2 but it seems like this function is doing a check-in to the content server based on a filename and file path. (Since we already have checked in the file content to the CS, we don’t want to do this again..) Unfortunately, I have not found out how to specify the fields in table DOCUMENTFILES in the BAPI Call in order to refer to an already checked in (stored) file.

If somebody knows how to specify the fields of DOCUMENTFILES in the call to BAPI_DOCUMENT_CREATE2 or another function, in order to refer to an already checked-in file, please publish an example.

We are aware of the 3 linkage tables, but haven´t found a standard function for creating the entries in these tables in order to establish the linkage to the DIR, when the file_id (example 4FCD97829A284DBE8565FA1979F0A217 ) was already generated by the Content Server and is therefore already known to us:

SAP Database Content Table: DMS_CONT1_CD1
PHIO and LOIO Relationship table: DMS_PH_CD1
SAP Object and LOIO Relationship Table: DMS_DOC2LOIO

(We have looked at several posts on the forum but haven´t found a suitable solution. Among others I have read: )

Any advice or ideas would be highly appreciated.

Best regards