Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error while opening Smartform Attachment in Email

Former Member
0 Likes
893

Hi Experts,

My requirement is converted one smartform into PDF and sent it via Email,but the attachment in the mail is not opening giving error as Failed to load PDF document or this document cannot be opened as it is an attachment sent via email and not decoded properly.


Pleasesuggest some  solution with supporting code well appreciated.


Thanks in Advance,

Suprit Patil.

1 ACCEPTED SOLUTION
Read only

Patrick_vN
Active Contributor
0 Likes
669

Personally I would use the function module SSFCOMP_PDF_PREVIEW first to check whether the otf data (job_output_info-otfdata from the FM that called the smartform) will open a correct PDF with the contents of the smartform.

If that works correctly, the problem may be in converting the otfdata and attaching it to the email. For that I generally use the classes cl_bcs & cl_document_bcs (there plenty of examples that can be found on the net).

As far as adding the attachment goes, there is an add_attachment method in the class cl_document_bcs. And for that you'll have to convert the otfdata to either SOLI_TAB or

SOLIX_TAB. You can use FM SX_OBJECT_CONVERT_OTF_PDF for that I believe.

Hi Experts,

My requirement is converted one smartform into PDF and sent it via Email,but the attachment in the mail is not opening giving error as Failed to load PDF document or this document cannot be opened as it is an attachment sent via email and not decoded properly.


Pleasesuggest some  solution with supporting code well appreciated.


Thanks in Advance,

Suprit Patil.

2 REPLIES 2
Read only

Patrick_vN
Active Contributor
0 Likes
670

Personally I would use the function module SSFCOMP_PDF_PREVIEW first to check whether the otf data (job_output_info-otfdata from the FM that called the smartform) will open a correct PDF with the contents of the smartform.

If that works correctly, the problem may be in converting the otfdata and attaching it to the email. For that I generally use the classes cl_bcs & cl_document_bcs (there plenty of examples that can be found on the net).

As far as adding the attachment goes, there is an add_attachment method in the class cl_document_bcs. And for that you'll have to convert the otfdata to either SOLI_TAB or

SOLIX_TAB. You can use FM SX_OBJECT_CONVERT_OTF_PDF for that I believe.

Read only

Former Member
0 Likes
669

Issue solved.

Thanks Patrick.