Showing results for 
Search instead for 
Did you mean: 

Sending attachment from document to mail with Service Layer

0 Kudos

Hi Everyone

We have some questions about sending attachments with Service Layer (B1 V10.0 PL02).

Our goal is to create a signed PDF document, attach it to a delivery document, and send it to BP's contact E-Mail. Signing document, attaching it to the delivery document and get the e-mail address is done, but sending it is the problem.

Our first approach was to read the document attachment2 object, get the path of the file, and create a new attachment to use it with the message object. We can get the path from SAP General Params ("parametrizaciones generales", we are using spanish language), then we realized that user can have it's own Attachments Path via "Valores propuestos", but we learned that this can be changed and documents can have a totally different attachment path, so we need the path from attachment object.

We tried to get the path of the file using with Service Layer, but the source path we get is the "srcPath" from ATC1 table, we need the "trgtPath" of that table, because the file was deleted from temp path once it has been attached.

So, Delivery document doesn't have document path, Service Layer's attachment2 return a not valid one, and Service Layer can't access to ATC1 table without making a view in database. Is there a simple way to get that path?

Second question. We've thinking to get the delivery document attachment id, and use it with the message object directly. Can we do that, and forget about getting attachment info and doing a copy of it, just for send an e-mail? Could be some issue if the document attachment is edited (like adding another file, or deleting previous)?

We could like to try the first approach, because then we can filter what documents we want to send, but making a view just for this, or using$value to get the file (as a stream) and save it again looks too elaborated. Can you give us some suggestions?

Thank you!

Product and Topic Expert
Product and Topic Expert
0 Kudos
Not sure if the Service Layer provide direct access to the ATC1 table, possibly not.

Accepted Solutions (0)

Answers (0)