cancel
Showing results for 
Search instead for 
Did you mean: 

Add attachment to customer project via S4HC API

sven_dupre
Explorer
0 Kudos

Hey

Is it possible to add attachments to customer projects using an API (see below screenshot)?

screenshot-projectsattachments.png

I already found this, https://api.sap.com/api/API_CV_ATTACHMENT_SRV/resource but it looks like this can not be used for managing project attachments.

Kr

Sven

Accepted Solutions (1)

Accepted Solutions (1)

Enda
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Sven ,

The API API_CV_ATTACHMENT_SRV should work with the customer projects. for example with the entity OriginalContentSet.

I checked and I could find no restriction so say it cant.

Best Regards

Enda

sven_dupre
Explorer
0 Kudos

Hey Enda

Thanks for your response. We just want to add URL's as an attachments for projects, so CreateUrlAsAttachment will do. However I have some questions. I checked following page: SAP help portal and found this:

  • What is the BusinessObjectTypeName for projects? I searched the web but could not find it.
  • What exactly is the LinkedSAPObject key? I understand it is probably going to be a reference to a project in my case, but I have no idea where to find it. On this page SAP help portal I can see:

but I cant find any information on how to create this.

As you probably notice, I'm pretty new to this matter. Any help would be appreciated!

Sven

sven_dupre
Explorer
0 Kudos

Update: we managed to know what the parameters are, by checking the request made when adding a url as an attachment manually in S/4 hana cloud.:

CreateUrlAsAttachment?ObjectKey='ATLA0007'&ObjectType='%2FCPD%2FEP'&SemanticObjectType=''&URL='https%3A%2F%2Fgoogle.com'&DocumentType=''&UrlDescription='Test'&MIMEType='text%2Furl'



Now the only question that remains is what communication scenario should be used.

API_CV_ATTACHMENT_SRV shows a list with different communication scenarios, but there is nothing for projects.

Kr

Sven

sven_dupre
Explorer
0 Kudos

enda.fennelly we made some more progress. We set up a communication arrangement with one of the scenarios listed in the api docs. Now we are able to authorize our requests:

https://XXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_CV_ATTACHMENT_SRV/CreateUrlAsAttachment?LinkedSAPObjectKey='ATLA0007'&BusinessObjectTypeName='/CPD/EP'&Url='https%3A%2F%2Fwww.google.be'&UrlDescription='test'&MIMEType='text/url'

We get following error response: 'You are not authorized for Create Document with document type SO1':

<?xml version="1.0" encoding="utf-8"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code>CX_ODATA_CV_ATTACH_EXCEPTION</code>
    <message xml:lang="en">You are not authorized for Create Document with document type SO1</message>
    <innererror>
        <application>
            <component_id>CA-DMS</component_id>
            <service_namespace>/SAP/</service_namespace>
            <service_id>API_CV_ATTACHMENT_SRV</service_id>
            <service_version>0001</service_version>
        </application>
        <transactionid>1F03C315FDCF0220E0060A7954ED6D18</transactionid>
        <timestamp>20210521133850.9621990</timestamp>
        <Error_Resolution>
            <SAP_Transaction>For backend administrators: use ADT feed reader "SAP Gateway Error Log" or run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details</SAP_Transaction>
            <SAP_Note>See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)</SAP_Note>
        </Error_Resolution>
        <longtext_url>/sap/opu/odata/iwbep/message_text;o=LOCAL/T100_longtexts(MSGID='26',MSGNO='036',MESSAGE_V1='Create%20Document',MESSAGE_V2='SO1',MESSAGE_V3='',MESSAGE_V4='')/$value</longtext_url>
        <errordetails>
            <errordetail>
                <code>CX_ODATA_CV_ATTACH_EXCEPTION</code>
                <message>You are not authorized for Create Document with document type SO1</message>
                <longtext_url>/sap/opu/odata/iwbep/message_text;o=LOCAL/T100_longtexts(MSGID='26',MSGNO='036',MESSAGE_V1='Create%20Document',MESSAGE_V2='SO1',MESSAGE_V3='',MESSAGE_V4='')/$value</longtext_url>
                <propertyref/>
                <severity>error</severity>
                <target/>
                <transition>false</transition>
            </errordetail>
            <errordetail>
                <code>/IWBEP/CX_MGW_BUSI_EXCEPTION</code>
                <message>An exception was raised</message>
                <propertyref/>
                <severity>error</severity>
                <target/>
                <transition>false</transition>
            </errordetail>
        </errordetails>
    </innererror>
</error>


Any idea what the problem can be here?

Kr

Sven

Answers (1)

Answers (1)

Enda
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sven,

I think it would be best if you create an incident for this so we can check directly on the system why the authorization error is raised.

How to create an incident is documented in the KBA https://launchpad.support.sap.com/#/notes/1296527

The component area to use is CA-DMS

Thank you

Enda