Skip to Content
Technical Articles
Author's profile photo Vikram Kulkarni

Using Document Management as a Content Repository with SAP S/4 HANA

Introduction

The purpose of this blog is to describe the essential configuration steps required to manually set up the SAP S/4HANA attachment service working with Document Management as a content server within the system landscape that has been already installed.

 

The following scenario is applicable for SAP S/4 HANA on-premise 1809, 1909, and 2020 releases.

 

Prerequisite

  1. You must read and execute the following SAP Notes:-
    1. SAP Note – 2361898
    2. SAP Note – 3003350
    3. SAP Note – 3003412
    4. SAP Note – 3008650
  2. Ensure CA certificate of the SAP Cloud Foundry server is uploaded to “SSL client <client> SAP Default”. This certificate has to be uploaded to the ABAP backend system using STRUST transaction.

Section 1. Repository Onboarding

In this section, you need to onboard the Document Management Repository.

The following steps must be executed to onboard a repository. You can ignore the steps if some of them have been already performed.

  1. You’ve created a subaccount and space. See Creating a Subaccount and Space.
  2. You’ve created a service instance and service key. See Creating a Service Instance.
  3. You’ve connected your own repository to Document Management, integration option instance.
    • To add your repository using a REST API, you must generate a JSON Web Token (JWT). Use the JWT as your authorization to make the onboarding REST API calls. See Generate a JSON Web Token.
    • Execute an onboarding repository API to onboard your repository into Document Management. See Add Your Repository Using the Onboarding API.
      • The displayName and externalId should start with ‘Z’ and it should be in upper case. This name would be used as a content repository name in the SAP S/4 HANA backend system. The externalId and isContentBridgeEnabled are mandatory during repository onboarding.

 

 

Section 2. SAP S/4HANA Backend Configuration

In this section, you learn the backend system configurations by following the steps.

  1. Create an OAuth Client Profile

    1. Start the object navigator (transaction SE80).
    2. Choose Development Object in the dropdown list.
    3. To create a development object in the SAP namespace, choose to Create OAuth 2.0 Client Profile in the context menu of the object name.
    4. Enter the object name in the Client Profile field.
    5. Choose the type of service provider as HANA_CLOUD_PLATFORM.
    6. Save your changes.
  2. Create an OAuth Client Configuration

    SAP Document Management uses OAuth Authentication. Hence, OAuth client configuration must be done in the SAP S/4HANA backend system.

    1. Go to transaction OA2C_CONFIG.
    2. Click ‘Create’.
    3. Choose OAuth Profile created in section 3.1.
    4. Enter the configuration name of your choice.
    5. Enter ‘Client Id’ from the service key created in section 1.
    6. Click ‘OK’.
    7. Enter ‘Client Secret’ from the service key created in section 1.2.
    8. Choose Selected Grant Type as Client Credentials.
    9. Enter Authentication Endpoint. It is the “uaa”: “url” parameter in the service key created in section 1.2 without ‘https’.
    10. Enter Token Endpoint. It is the “uaa”: “url” parameter in the service key with ‘/oauth/token’ prefix without ‘https’.
    11. Click ‘Save’.
  3. Create an RFC destination to Document Management

    1. Go to the transaction, SM59, and create a Type G destination.
    2. Enter host:  “ecmservice”:”url” copied from service key created in section 1.2 without ‘https’.
    3. Enter path prefix as ‘/browser’.
    4. In the Port b field, enter the “HTTPS” port of the ABAP system.ABAP%20System
    5. Go to Logon & Security Tab.
    6. Select ‘Do not use a user’ in Logon Procedure.Logon%20Procedure
    7. In Security Options, choose SSL Active radio button and select the certificate from the dropdown.Security%20Options
    8. Save the RFC destination.
  4. Create Content Repository in OAC0

    1. Go to transaction OAC0.
    2. Click on ‘Create’.
    3. Give the content repository name the same as the value of ‘externalId’ parameter given during onboarding repository in Section 1.3 (#2).
    4. Enter Document Area.
    5. Select Storage Type as ‘CMIS Content Server’.
    6. Enter the RFC destination created in the previous Part.
    7. Select the ‘Is OAuth’ checkbox.
    8. Save the configuration
    9. Enter the OAuth Profile name.
    10. Save the configuration.
    11. Do the connection test and check if the connection test is successful in the repository.
  5. Create Secondary Types and Folders

    1. Execute Transaction SE38
    2. Enter Report Name ‘CMIS_REPOSITORY_SETUP’
    3. Execute report

      Inputs:-
      RFC_DEST = RFC destination of the repository created in SM59CMIS_REP = Content Repository Name created in OAC0
  6. Create Storage Category in OACT

    1. Go to transaction OACT.
    2. Click ‘New Entry‘.
    3. Enter a Category Name.
    4. Enter Document Area.
    5. Enter Content Repository Name created in the previous Part.
    6. Save Storage Category.
  7. Activate Storage Category

    1. Go to transaction SPRO.
    2. Click on SAP Reference IMG to display the IMG Activities.
    3. Go to Cross Application Components → Document Management → Additional Settings- Simplification → Attachment Service- Storage Repository Activation
    4. Choose to ‘Create New Entries’.
    5. Enter the Storage Category created in OACT in the previous part and mark it as active by selecting the checkbox.
    6. Save the configuration.

Congratulations. You have successfully completed the Attachment Service integration with Document Management.

 

I hope, you can benefit from the steps presented in this blog post. In case of questions or feedback, please feel free to comment on this blog.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Assigned tags

      18 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Raviteja Paluri
      Raviteja Paluri

      Great Information Vikram, keep up the good work.

      Author's profile photo Marion DUPIN
      Marion DUPIN

      Hello Vikram,

      Thanks a lot for your blog, it's really clear. I follow the exact steps and everything seems OK. Now it's not clear for me, how can I test if documents are sent from my S/4HANA system to my Cloud repository ?

      Thanks for your help.

      Best regards,
      Marion

      Author's profile photo Vikram Kulkarni
      Vikram Kulkarni
      Blog Post Author

      Hi Marion DUPIN,

      Thanks for your feedback.

      With reference to your concern, I understand that you would like to test documents sent from SAP S/4 HANA to cloud repository, you can try my suggestion below.

      1. Try using our Integration option API to check whether the document is created from postman.
      2. You can also test it by using CMIS workbench.

      I hope this suffice your concern.

      Regards,
      Vikram Kulkarni

      Author's profile photo Marion DUPIN
      Marion DUPIN

      Yes thanks !

      Author's profile photo Yogendra Ahuja
      Yogendra Ahuja

      Hi Vikram,

      while onboarding, I am getting below error. Could you please suggest.

      message": "Error in OnBoarding Repository: Error reading Admin Credentials from destination: Doc_service

      I am using Document Management repositiry available on my Neo Account.

      Thanks

      Author's profile photo Asma Siddiqa
      Asma Siddiqa

      Hello Yogendra,

      The above mentioned scenario would work only with a Cloud Foundry based "Document Management" solution, where you could use this storage instead of SAP Content Server.

      Please do not connect to the repository from your Neo account.

      Best Regards,

      Asma

       

      Author's profile photo Yogendra Ahuja
      Yogendra Ahuja

      Hi Asma,

      Since repository from Neo Environment is also CMIS, I was wondering why this is not supported.

      Also, can we use any other open source storage which is CMIS, instead of SAP Content server?

       

      Thanks,

      Yogendra

       

      Author's profile photo Rupali Sharma
      Rupali Sharma

      Hi Yogendra,

      What is your destination's authentication type? You need to provide your credentials in the destination. If the credentials are correct, you should be able to onboard your repository.

      But if you are trying to connect to Neo Document Service repository from CF, in order to connect to document service repository we also require the repository key, repo unique name and account information which cannot be passed via destination. In this case, you can either create a proxy bridge api or try migrating your Neo DS repository data to CF Document management as mentioned in this help document

      Hope this helps.

      Thanks,

      Rupali

      Author's profile photo Gokhan Yilmazturk
      Gokhan Yilmazturk

      Hi Vikram,

      First of all, great blog, very informative.

      Is there an option for other way around ? Would that be possible to use SCP DM Integration option and use S4HANA for repository ?

      I came up with this document, but honestly couldn't find any technical document explaining how.

      Best regards,

      Gokhan

      Author's profile photo Asma Siddiqa
      Asma Siddiqa

      Hello Gokhan,

      Yes, this option is possible. You could use Document Management integration option and connect to S/4 HANA DMS repository.

      You could take a look at this help documentation.

      Best Regards,

      Asma

      Author's profile photo Gokhan Yilmazturk
      Gokhan Yilmazturk

      Hello Asma,

      Thank you for sharing the details. The help documentation lacks some of the information like; how the destination should be created  (any specific property to add etc.) or what are the activities we need to carry out on ERP side. Is there any technical document that gives more details that you aware of ?

      Best Regards,

      Gokhan

      Author's profile photo Rupali Sharma
      Rupali Sharma

      Hi Gokhan,

      You can check this blog https://blogs.sap.com/2020/08/14/connect-sap-document-management-application-option-to-dms/

      Though this blog is about application option, not integration option, the steps on ERP side and the steps to create destination on BTP end are common for both. you can follow till step PART III : Setting up Destination as it is.

      Thanks,

      Rupali

       

      Author's profile photo Matthias Hayk
      Matthias Hayk

      Hello Vikram,
      very good and nice assistence for using document management option service on cloud foundry.

      But i have one problem when following the guide.
      In SM59 (when testing the connection) and OAC0 (when testing communication in repository definition), i always get a short-dump in CL_CMIS_Client. Any idea whats wrong?

      I can use and access the repository when using DMO-Application Option on BTP.

      kind regards
      Matthias

      Screenshot%20of%20Shortdump

      Screenshot of Shortdump

      Author's profile photo Evgeni Vekua
      Evgeni Vekua

      Hi Matthias, just by chance have you managed to get reply or fix on this error?

      I am getting the same.

      Best regards,

      Evgeni,

      Author's profile photo Rupali Sharma
      Rupali Sharma

      Hi Evgeni,

      There are some things you can check:

      1. As already mentioned by Matthias, cross-check your client id and secret from BTP service instance.
      2. check if the token endpoint and Auth endpoint are correct. The format should be
        (i) for Token endpoint : <uaa-url>/oauth/token
        and (ii) for Auth endpoint, <uaa-url>
        NOTE: do not put "https" in the url as it is appended by default
      3. Lastly, make sure there is only one configuration with the given Profile name in oa2c_config.

      Do a connection test from OAC0( not sm59 ).

      Regarding the dump, you can implement SAP Note 3084606 to get rid of the dump.

      Thanks,

      Rupali

      Author's profile photo Matthias Hayk
      Matthias Hayk

      Hi Evgeni,

      at least my problem was in oauth-configuration on s/4-hana with transaction oac2_config. i dont know exactly why, but after checking everything once again i found, that the keys on btp for the service where different/others than the one i entered in oac2_config after initial configuration. After correcting the clientsecret and clientid it worked.

      kind regards
      Matthias

      Author's profile photo Boudhayan Dev
      Boudhayan Dev

      Hi,

       

      Good blog.

      Are you aware of Java examples ?

      Scenario I am interest in - A Java microservice deployed on Cloud foundry that would use Document Management Service to persist documents.

      Any leads would be really helpful.

      Author's profile photo Matthias Hayk
      Matthias Hayk

      Hi Vikram and communtiy-members,

      after cleared the above connection problems with OAuth2, we have another serious issue with the DMI-Option.

      We are trying archive documents from our S/4-Hana (2020, onpremise) by using the DMI-Service on SAP-BTP and an attached CMIS-Connector with an Archive-System behind.

      Connection test from OAC0 to repository works fine now. But trying to archive a document with Transaction CV03N with KPRO results in Error. "Could not connect to repository with id e7f4b408-451b-xxxx-yyyy-709db76d5b7b. Error checking proxy type for destination: cmisrep", where "cmisrep" seems to be the destination name of the cmis-connector and the id is the generated id of the repository in DMI-Service on BTP during onBoarding.

      I debuged a little and found out, that when saving documents a query to DMI-Service and the CMIS-Connector is made. I catched the type of request and its parameter.

      After this i constructed a call in postman. This makes the scenario more easy.

      So now after getting the JWT-Token and sending the request with the JWT-Token in the BearerToken as Authorization.

      The request looks like POST:"https://<dmi-service-endpoint-url/browser/<repname>" where <repname> is the name of the repository-definition in BTP DMI-Service onboarding.

      Addtionaly the body of the post-request contains form-data and the key-values: cmisaction=query,statement=select cmis:objectId from cmis:folder where cmis:name = 'DMS_PCD1'

      And interestingly when sending the same error as recorded in SLG1 is returned from BTP-DMI-Service:

      {    "exception": "connection",    "message": "Could not connect to repository with id e7f4b408-xxx-yyyy-b5b7-709db76d5b7b. Error checking proxy type for destination: cmisrep"}

      We also subscribed to BTP-DM Application Option. With DMA we can connect our external CMIS-Connector with our Archive-System behind it successfully. So that works fine.

      We dont really know now, why the proxytype for the destination (which is the destination configured in BTP-Cockpit) and which is the same destination we use for DM-Application Option does not work with DM-Integration. The proxyType of the destination is "onPremise" because it is available onPremise behind our cloud connector.

      Any help would be welcome. We now invested already two days for this investigations but running out of options.

      best regards

      Matthias