Download billing document in PDF format. This call will trigger the PDF generation in SAP and deliver the output as a response. The PDF download functionality requires OSS note 508569 to be applied in your SAP backend system.

/cnbs/v1/invoices/id/format/pdf
GET | POST

Required

  • Billing Document Number (billing_document_number)
    • Billing document number.
  • API Document type (document_type)
    • Standard Document Types:
      • 01 … Invoice document type
    • Custom document Types:
      • 90-99 … Custom document types can be implemented on a project basis and require a implementation in the backend as well.

Example POST

JSON Payload:

{
  "document_detail": {
    "billing_document_number": "90038990",
    "document_type": "01"
  }
}

cURL:

curl -X POST "https://<<your.server.here>>/cnbs/v1/invoices/id/format/pdf?sap-client=800&sap-language=EN&apiid=CNBSMV01P" -H  "accept: application/pdf" -H  "content-type: application/json" -H  "cnbssysid: gPuM1VyY1dxlTE2MEs2yajJUkX3/4+2Pw1alRw4BOtI=" -d "{  \"document_detail\": {    \"billing_document_number\": \"90038990\",    \"document_type\": \"01\"  }}"

cURL:

curl -X GET "https://<<your.server.here>>/cnbs/v1/invoices/id/format/pdf?sap-client=800&sap-language=EN&apiid=CNBSMV01R&billing_document_number=90038990&document_type=01" -H  "accept: application/pdf" -H  "content-type: application/json" -H  "cnbssysid: gPuM1VyY1dxlTE2MEs2yajJUkX3/4+2Pw1alRw4BOtI="

A successful Response with code 200, will be of content type “application/pdf”. Standard filename is billing document number with a .pdf extension. These response header fields will be present:

"content-length": "nnn",
"content-disposition": "attachment; filename=nnnnnnnnnn.pdf",
"content-type": "application/pdf"

A bad response with code 400 will return the following status fields:

  • Status (status)
    • Message Type (message_type)
      • SAP Message Type.
        • Errors:
          • E = Error
          • A = Abort
          • X = Exception
        • Others:
          • S = Success
          • W = Warning
          • I = Information
    • Message Identification (message_identification)
      • SAP Message ID.
    • Message Number (message_number)
      • SAP Message Number.
    • Message Line (message_line_string)
      • SAP Message Text.
access-control-allow-credentials: true  access-control-allow-headers: Authorization,cnbssysid,DNT,X-CustomHeader,api_key,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type  access-control-allow-methods: GET, POST, OPTIONS  access-control-allow-origin: *  access-control-expose-headers: Authorization,cnbssysid,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range  cnbssessid:   connection: keep-alive  content-disposition: attachment; filename=0090038990.pdf  content-length: 12359  content-type: application/pdf  date: Wed, 31 May 2017 12:29:01 GMT  server: nginx/1.4.6 (Ubuntu) 
  • public/docs/webarapi/v110/getinvpdf.txt
  • Last modified: 2019/03/28 11:44
  • by Christian Koessl