Skip to Content
Technical Articles
Author's profile photo Jigang Zhang 张吉刚

Send uploaded file as email attachment for standard transaction

GOS is available for many standard transactions we can upload files to the attachment list, how to send those attachment files through email easily?

 

1. Find the object type name for the standard transaction

Take the Purchase order as an example, enter ‘Purchase*’ as STEXT for table TOJTT at SE11 like below:

Then we can get the below lists for transactions related to purchases:

For my case, I find the object type name ‘FIPP’ very quickly by searching ‘Park’ for FBV3 parked document. Btw, table TOJTB(Business object repository: Basic data) contains the details for those business objects.

2. Find the attachment ID inside the standard transaction

Generally, it’s shown as ‘AttachmentForXXXX’ at the window of the attachment list. Take a billing document as an example, the attachment ID will be the document directly.

For parked documents, the attachment ID will be the combination of company code, document number, and fiscal year.

Don’t know whether exists some standard rules for this attachment ID, no idea where to check this anyway. Please let me know if exists.

3. Fetch the contents of files and send them out as attachments using BCS

  • With the business object name and attachment ID from the above steps, we can get the attachment list by method ‘get_atta_list’ of class ‘cl_gos_api’;
  • The deep structure gos_s_attcont contains all the details of the attachment file and its content in Cstring/Xstring format;
  • Convert the Xstring format into Table Type SOLIX_TAB(binary);
  • Use method ‘add_attachment ‘ of BCS class ‘cl_document_bcs’ to add as email attachment.

Please check this link from Jerry Wang as a code reference.

 

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Rob Ariaans
      Rob Ariaans

      Regarding your question:

      Don’t know whether exists some standard rules for this attachment ID, no idea where to check this anyway. Please let me know if exists.

      These are the key fields of the header table that stores your object where the attachment relates to. Table BKPF in this example - since you are dealing with parked vendor invoice.

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Rob Ariaans

      That makes sense! Thanks for sharing 🙂

      Author's profile photo Frank Neutzler
      Frank Neutzler

      No. Actually that are the key fields of the business object (FIPP) as seen in transaction SWO1, in that order. They do not have to be identical to the key fields of underlying table, e.g. object BUS1505 and table VICNCN have different keys.