Skip to Content
author's profile photo Former Member
Former Member

Is it possible to generate a PDF and send it as a mail attachment ?

Hello All,

While there are many contributions and suggestions on how to send a pdf form via email, I will like to find out if its possible to send a pdf as part of an email attachment WITHOUT even viewing it first ? Below is a brief descrption of what I'll like to do :

1) A user logs into his inbox and checks if there are any requests for his approval. In the event that he finds one, he may either select the row item in the table to display the requests details prior to approving or clicks on approve immediately.

2) This approval action should send an email to an appointed external supplier with the request details as a pdf attachment.

All this should be done without the need to generate a interactive form. Is this possible ?

Thank you very much.

from

Kwok Wei

Add a comment
10|10000 characters needed characters exceeded

Related questions

6 Answers

  • Posted on Apr 10, 2006 at 09:28 AM

    Hi Kwok Wei,

    if you want to send a PDF by mail, at some point you will have to generate a form (whether interactive of not).

    Obviously, you can do that in the background, but you will have to follow either the way described in the Web Dynpro for Java tutorial mentioned in the other reply, or or through BCS in ABAP.

    Kind regards,

    Markus Meisl

    SAP NetWeaver Product Management

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Markus

      I am looking for a way to generate a pdf with ADS in the background without displaying the pdf as an interactive form. You were referring to some tutorial (webdynpro/java) in your reply to Kwok's question. Where can I get this tutorial?

      Thanks a lot in advance.

      Best regards

      Bettina Hepp

  • author's profile photo Former Member
    Former Member
    Posted on Apr 10, 2006 at 06:30 AM

    Hi Kwok Wei

    We tried something similar on the Java stack using PDF Object services and the mail APIs , you will have to improvise over this example

    examplewww.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial%20on%20working%20with%20the%20pdf%20document%20object%20-%2032.htm">example>

    Regards

    Pran

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2006 at 06:53 PM

    Here is another way to do without using BCS:

    1. Write a print program to call the generated FM and send this to spool.

    2. In the spool list you will see the pdf file.

    3. You can pick the file and do the rest of the things.

    4. In the project what we did we moved the file to adobe livecycle to apply policy and then email to the end user.

    Hope this helps!!

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 12, 2006 at 06:57 AM

    perhaps look at topic for ABAP solution

    sending-invoice-as-attachment-in-pdf-for-external-

    I have used it successfully to print a form to a spool which is converted to pdf without the user having any other action then 'to push the button'

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 17, 2006 at 07:58 AM

    Why don't you check the sample code provided by SDN in the following example :-

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial on offline interactive pdf form using e-mail - 31.htm

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2007 at 05:08 PM

    Hi Kwok,

    Any luck i am trying the same like, i have an java web dynpro application with interactive form, on send button click i need to send the filled form as an pDf attchment to internet mail id. I am using SO_NEW_DOCUMENT_ATT_SEND_API1 inside workflow to send attachment. My custom RFC which is interacting with WD app is getting the pdf source context attribute(simply i set the import parameter with that attribute and no juggling is done) as import parameter which is of type XTSRING. Once i execute the application i am getting mail with attachment as pdf but i am not able to open the pdf. It is of just 1 KB size. It seems my pdf source context attribute is not sending data. Can you pls suggest how can i solve this.DO i need to convert the data to pdf format before sending or any otgher thing i need to do.

    Regards

    Ravindra

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Hubert,

      I am tryign the same logic as ur to send PDF as an attachement but while opening its giving me file cannot be opened.

      My code goes like this

      CALL FUNCTION 'FP_JOB_CLOSE'

      IMPORTING

      E_RESULT = RESULT

      EXCEPTIONS

      USAGE_ERROR = 1

      SYSTEM_ERROR = 2

      INTERNAL_ERROR = 3

      OTHERS = 4.

      IF SY-SUBRC <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ELSE.

      *********************************************************

      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

      EXPORTING

      buffer = FORM_OUT-PDF "PDF file from function module

      TABLES

      binary_tab = lv_output.

      DATA: GD_DOC_DATA TYPE SODOCCHGI1,

      lt_mailpack TYPE STANDARD TABLE OF SOPCKLSTI1 ,

      la_mailpack type SOPCKLSTI1 .

      data:lf_lines type i.

      describe table lv_output lines lf_lines.

      clear la_mailpack.

      la_mailpack-transf_bin = 'X'.

      la_mailpack-head_start = 1.

      la_mailpack-head_num = 1.

      la_mailpack-body_start = 1.

      la_mailpack-doc_type = 'PDF'.

      la_mailpack-body_num = lf_lines.

      la_mailpack-doc_size = lf_lines * 255.

      la_mailpack-obj_descr = 'object'.

      la_mailpack-obj_name = 'MAIL'.

      append la_mailpack to lt_mailpack.

      data: IT_RECEIVERS type STANDARD TABLE OF SOMLRECI1 WITH HEADER LINE.

      *DATA: GD_DOC_DATA TYPE SODOCCHGI1.

      BREAK FTABAP.

      GD_DOC_DATA-OBJ_DESCR = 'PDF'.

      IT_RECEIVERS-RECEIVER = 'email address'.

      IT_RECEIVERS-REC_TYPE = 'U'.

      APPEND IT_RECEIVERS.

      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

      EXPORTING

      DOCUMENT_DATA = GD_DOC_DATA

      • * PUT_IN_OUTBOX = ' '

      COMMIT_WORK = 'X'

      • * IMPORTING

      • * SENT_TO_ALL =

      • * NEW_OBJECT_ID =

      TABLES

      PACKING_LIST = lt_mailpack

      *OBJECT_HEADER = lt_mailhead

      • * CONTENTS_BIN =

      *CONTENTS_TXT = lt_mailtxt

      CONTENTS_HEX = lv_output

      *

      • * OBJECT_PARA =

      • * OBJECT_PARB =

      RECEIVERS = IT_RECEIVERS.

      Kindly please help me in solving this issue.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.