Skip to Content
avatar image
Former Member

issue with classes to send email

Hi guyz,

My requirement is to send smartform as an email as attachment in pdf format , I done it using function module SO_NEW_DOCUMENT_ATT_SEND_API1 , but the problem of using that is I cannot change senders email id. so now I chose the option to use classes , I have a code to send email with data in the email body, I also need to add smartform as an attachment in pdf format to email.How to get this...please advise...

Thanks in advance


Edited by: BrightSide on Jan 7, 2010 10:45 AM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 07, 2010 at 10:51 AM


    similar questions as yours have been answered multiple times here on SDN. Use search functionality to look for answer before posting your question. I remember that there is a nice blog from Thomas Jung about using classes to send an email. How to convert spool request to pdf file can also be easily found here.


    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      [here|/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface] is the mentioned blog by Thomas Jung. From taht example you can see that class CL_DOCUMENT_BCS has method add_attachment. You can attach any binary data using parameter I_ATT_CONTENT_HEX which is table with 255 bytes long lines. So you need to convert your form to PDF and then convert it to this format. [Here|] is an example of converting smartform to PDF.


  • Jan 07, 2010 at 11:01 PM


    CALL METHOD l_email->set_subject
            subject = v_subject.
    *   Set the message
        CALL METHOD l_email->set_message
            text = i_content
            type = zcl_email_message=>doc_type_text.
        CALL METHOD l_email->add_attachment
            contents_bin = i_attach_raw
            name         = lv_name
            type         = 'BIN'.
          CALL METHOD l_email->add_to
              address = i_rec.  " fill i_rec with email id's u want to send the email.
    *   Send the e-mail.
        CALL METHOD l_email->send
            commit_work = space
            send_error  = 1
            OTHERS      = 2.

    Add comment
    10|10000 characters needed characters exceeded