Skip to Content
0
Sep 11, 2007 at 01:01 PM

How do I add text message to this email with PDF attachment?

99 Views

Good day, everyone!

Okay, we have a "z"-version of program RFFOUS_T and some of its include codes. One include code, RFFORIO6, has a form called MAIL_PDF_ADVICE. It is in this form that we are emailing a remittance advice form. The actual form is attached as a PDF file.

Unfortunately, there's no text in the body of the email -- it's just the attachment -- so the users would like us to add a couple basic lines in the body of the email that explain the attachment. I'm pretty new to using this particular FM and emailing the PDF attachment, and I've gotten stuck in my research trying to find out exactly how to do this. I'm guessing this shouldn't be all that difficult, but I'm not finding the right solution. Here's the form:

&----


*& Form mail_pdf_advice

&----


  • E-mail PDF advice

&----


  • -->IT_ADVICE PDF form (output from Adobe server)

  • -->I_PDF_LEN length of PDF advice in bytes

----


FORM mail_pdf_advice USING it_advice TYPE solix_tab

i_pdf_len TYPE i.

DATA:

lt_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,

l_user LIKE soextreci1-receiver,

ls_send_doc LIKE sodocchgi1,

lt_pdf_attach TYPE TABLE OF sopcklsti1 WITH HEADER LINE.

CHECK NOT finaa-intad IS INITIAL.

CHECK finaa-nacha EQ 'I'.

*--- determine E-Mail sender and recipient

IF fsabe-usrnam EQ space.

l_user = sy-uname.

ELSE.

l_user = fsabe-usrnam. "Office-User des Sachbearb.

ENDIF.

lt_receivers-receiver = finaa-intad.

lt_receivers-rec_type = 'U'. "E-mail address

APPEND lt_receivers.

ls_send_doc-obj_descr = itcpo-tdtitle.

lt_pdf_attach-transf_bin = 'X'.

lt_pdf_attach-doc_type = 'PDF'.

lt_pdf_attach-obj_langu = reguh-zspra.

lt_pdf_attach-body_start = 1.

lt_pdf_attach-doc_size = i_pdf_len.

DESCRIBE TABLE it_advice LINES lt_pdf_attach-body_num.

APPEND lt_pdf_attach.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = ls_send_doc

sender_address = l_user

TABLES

packing_list = lt_pdf_attach

contents_hex = it_advice

receivers = lt_receivers

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

<error checking code snipped>

Does someone know how to do this? <b><REMOVED BY MODERATOR></b> Thanks so much in advance!

Dave

Message was edited by:

Alvaro Tejada Galindo