cancel
Showing results for 
Search instead for 
Did you mean: 

Download pdf file from URL

d_weinberg
Participant
2,594

Hi Community,

We need to retrieve a pdf file from URL that is stored as a link under the attachments of a material. The ultimate goal is to store this pdf as an attachment to a customer quote.

The URL is a regulare one that is publicly available w/o authentication. Meaning I can simply enter the URL (http://somehost.com/path/file.pdf) in webbrowser to get the file.

Is there any way to achieve this? We tried using the REST API but currently fail with an RABAX error whenever we call the REST service.

Any help appreciated,

Daniel

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi Daniel,

Thanks for your blog

I have one requirement,

Here,

Sender Ariba cxml payload the attachment (“cid:1735239107.1592222922946@cxml.org”)
document is coming in above format need to extract this content and send to base64 with third party… could you please suggest me with your inputs, that how we can extract the content.

It’s very helpful.

Thank you.

knutheusermann
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Daniel,

In blog post Read and Write ByDesign Attachments using Web Services I described how to create and update attachments of ByD business objects using Soap services. Adding an external link as attachment to a business object in ByD works basically the same: just submit the external link instead of the file content (here: material attachment):

...
<AttachmentFolder
DocumentListCompleteTransmissionIndicator="false"
ActionCode="06">
  <UUID>00163e0e-4644-1ed5-9aed-c438b0f1dcec</UUID>
  <Document PropertyListCompleteTransmissionIndicator="false" ActionCode="01">               
    <VisibleIndicator>true</VisibleIndicator>
    <CategoryCode>3</CategoryCode>               
    <TypeCode>10001</TypeCode>         
    <Name>www.sap.com</Name>
    <AlternativeName>My Web Page</AlternativeName>               
    <ExternalLinkWebURI>http://www.sap.com</ExternalLinkWebURI>
  </Document>
</AttachmentFolder>

Using OData you would basically need to provide the same data, but I did not use that yet.

Best regards,
Knut

d_weinberg
Participant
0 Kudos

Thanks Knut,

The process is a bit different. Our customer puts a link as an attachment to the material master. When he creates a quote this link needs to be resolved and the real attachment (PDF) must be downloaded from that link and attached to the quote.

Regards,

Daniel

knutheusermann
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Daniel,

did you already try a Add-on solution using the SAP Cloud Applications Studio? Maybe you can embed some Add-on code in the quote creation that picks the link from the material attachment folder, calls some external REST or Soap service to get the pdf (base64 encoded) and creates the corresponding attachment including the encoded pdf as file content in the quote.

Regards, Knut

d_weinberg
Participant
0 Kudos

Hi Knut,

This is exactly what I am trying to do. But I could not find a way to download a PDF from an external source out of an ABSL script. I tryed to use a external service of type REST for this, but calling the REST simply dumps.

Regards,

Daniel