cancel
Showing results for 
Search instead for 
Did you mean: 

SmartForms - Is there a way to put PDF attachment in the body of Email?

Former Member
0 Kudos

Hello All,

Currently I have a Smart Form that generates an MAIL with a PDF attachment. It works very nicely with from, to, and subject information correct. A new request from the users is to show in the PDF output in the email vs. an attachment. They mention that not all consumers open the PDF attachment.

Is there a way I can write the form in the email that would look exactly like the attached PDF format?

Or is there a way I can leave the PDF attachement with text in the email like 'Open the attachment to view the items that have been shipped in your recent order'.

Currently I'm using CALL FUNCTION lf_fm_name with control parameters, mail_appl_obj, mail_recipient, mail_sender, and output options.

I would greatly appreciate help in solving this ASAP. Thanks!

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I found OSS note 311037 that mentions changing text of an email. Has anyone successfully got that to work? Also mentions OSS note 513352.

Former Member
0 Kudos
Former Member
0 Kudos

Thanks for the quick response. Yes i agree there are many links regarding emails but i still don't quite have my anwser yet.

Currently i have the email generated as a PDF attachment. When i call the FM - CALL FUNCTION lf_fm_name it is generating the PDF attachment using the device type = MAIL.

i'm happy with the PDF attachment.

i want to add text in the body of the email (example: 'Please open the attachement'). OR have the entire form in the body of the email.

from what i have gathered from the responses to my question, is that i have to output the form as a table using job_output_info.

The problem i'm facing is comverting the OTF table into the text file. i have bit maps, tables, text, etc. in the form. is my problem that i can only pass text, no bitmap, table information, etc.?

thanks!

Former Member
0 Kudos

Hi,

This links would help u out..

[https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/smartformtoMailasPDF+attachment]

[https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=sendpdfsmartforminemail&adv=false&sortby=cm_rnd_rankvalue]

Regards,

Vijaya Lakshmi.T

Edited by: Vijaya Lakshmi on May 5, 2009 5:41 AM

Edited by: Vijaya Lakshmi on May 5, 2009 5:43 AM

Former Member
0 Kudos

Vijaya,

thank you for you quick response.

i have followed your example logic and i now see a brief message in the body of the email. Which i part of my requirement but i'm unable to open the PDF doument.

i'm getting the error message "Abobe reader could not open 'test.PDF' because it is either not a supported file type or because the file has been damaged"

Any idea why? Before adding your logic after calling the smarform to use 'CONVERT_OTF' and 'SO_NEW_DOCUMENT_ATT_SEND_API1' the attached PDF file was perfect.

below is the the call function for my SF. after this call i have added the logic your suggested.

  • call smartform

CALL FUNCTION lf_fm_name

EXPORTING

control_parameters = control_parameters

mail_appl_obj = appl_object_id

mail_recipient = recipient_id

mail_sender = sender_id

output_options = ls_composer_param

user_settings = 'X' "ADDED THIS SETTING

**----


> SmartForm specific fields

gi_salesord_num = gi_salesord_num

gi_goods_mvmnt_date = gi_goods_mvmnt_date

gi_tracking_number = gi_tracking_number

gi_carrier_name = gi_carrier_name

gi_email_to = gi_email_to

gi_coupon = gi_coupon

gi_url_name = gi_url_name

IMPORTING

job_output_info = job_output_info "w_return "ADDED IMPORTING AS TABLE

TABLES git_item_tab = git_item_tab

**----


<

EXCEPTIONS formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

in bebug mode if i look at the retuned table in debug i see values like below:

1 // |XPDF1 0640 00000000001 <

2 IN |04EYZSF_SD_WKI_EMAIL_CONF <

3 IN |05FIRST <

4 OP |LETTER P 144 240 1581712189000010000100001 <

5 IN |06WK_BRANDS_COLOR_LOGO <

6 MT |0210001134 <

<< Unformatable text removed >>>

it looks like there is an issue with the convert or i've got some logic wrong. Any ideas?

Edited by: Rob Burbank on May 7, 2009 2:55 PM

Former Member
0 Kudos

Hi ,

Try this function Module.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

Hope this will solve your problem.

Cheers

Suvendu

former_member205763
Active Contributor
0 Kudos

May be u can try like this, get the smartform output in html, and then append this html to email body.

just give it a try to see if u get the output in email body