cancel
Showing results for 
Search instead for 
Did you mean: 

Added attachments via API to a supplier invoice are not visible

Former Member
0 Kudos

Hey,

We need to add attachments (pictures or links to pictures) to a supplier invoice. When using the API from https://api.sap.com/api/API_CV_ATTACHMENT_SRV I can succesfully post both documents and url's to an existing supplier invoice.

I will even get the number of attachments when trying the API_CV_ATTACHMENT_SRV/GetAttachmentCount. This would mean that the object in question has those attachments.

{
  "d": {
    "GetAttachmentCount": {
      "__metadata": {
        "type": "API_CV_ATTACHMENT_SRV.AttachmentsCount"
      },
      "AttachmentCount": 6
    }
  }
}

BUT when I go to the tile for supplier invoices, doesn't matter if it's the standard or advanced one, no attachments can be found. This same API has also been tried on materials and attachments are showing up without any problems.

Does anyone else have any experience with this problem?

Kind regards,

Thomas

Solution:

After digging in the api.sap.com hub and hounding our friends at SAP I have found an answer: "attachment service for supplier invoices is not supported in SAP S/4 HANA 1808. With 1811 this is possible with communication arrangement SAP_COM_0057". It is possible apparently to hack this in the API hub but don't try it via postman or any other of your favorite REST clients. Check my other comment below for more info on the specific query you'd need to execute.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Update on this since I've found a solution. When calling the GET or POST for the attachments of a supplier invoice; do not use {invoice number}/{fiscal year}. Even though when tracing the message in S4HC itself gives you a slash, when calling via the API you need to remove the slash.The business object type is correctly BUS2081 so that was not the problem. So if you want to know about the attachments of supplier invoice 1234567890 from 2018, execute the following GET on your system:

{insert your system here}/sap/opu/odata/sap/API_CV_ATTACHMENT_SRV/GetAllOriginals?LinkedSAPObjectKey='12345678902018'&BusinessObjectTypeName='BUS2081'

Hope this helps anyone in the future.

Answers (2)

Answers (2)

kedarT
Active Contributor
0 Kudos

Hi Thomas,

I am trying to also attach documents into GOS of S4HC and facing various issue, Would appreciate if you can send across your code which is used to accomplish this.

MartyMcCormick
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Thomas

I don't think the supplier invoice API uses the OData service for attachments. When you say you are posting to the supplier invoice, are you posting to the supplier invoice number for the generic service? I ask because the Supplier Invoice API is CREATE / READ / RELEASE. There is no update on supplier invoices.

Furthermore, I don't see supplier invoices listed in the available scope items on the API documentation for the attachment service. https://api.sap.com/api/API_CV_ATTACHMENT_SRV/overview

3D Printing On-Demand-Manufacturing Collaboration on HCP (1NX)

Change Record based Product Data Management (1NF)

Engineering Bill of Material Versions Management (1NR)

Engineering Bill of Material Change Master Management (1R3)

Thanks,

Marty