Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
chris_scott
Active Participant
It's never been easier to generate powerful dynamic emails from SAP using Floe.  In many cases, the email can replace old PDF outputs generated by SAPScript, Smartforms or Adobe forms.  But in some scenarios there is still a valid business need to include an attachment with the outbound email.

There are multiple ways to generate the PDF and attach it to the email.  Here are three methods, rising in complexity...

1) Floe


By far the easiest method is to build the output template in Floe Designer.


The process is exactly the same as designing a dynamic email template in Floe, but you can add PDF options:


Then simply reference the template type as an attachment in the outbound email settings:


Then, in your output program, simply call the Floe API and the PDF will be automatically generated and added to the email:
  CALL FUNCTION '/FLOE/EMAIL_OUT'
EXPORTING
im_etype = gv_etype
im_elang = gv_language
im_document = l_im_doc
im_rec_emails = gt_rec_emails
im_variables = gt_vars
im_send_immediately = 'X'
im_attachments = lt_attach
im_preview = gv_screen_display
im_no_commit = lv_no_commit
IMPORTING
ex_subrc = <gv_returncode>
ex_ebody = ev_ebody
ex_mess = lt_mess
ex_rec_emails = et_rec_emails
ex_attachments = et_attachments
ex_esubject_long = ev_esubject_long.

Check out the full code example here

This method requires a subscription to Renda.io, which integrates seamlessly with Floe for PDF generation.

2) Floe and Varo


If you already have Varo and skills in Adobe Designer, then you may prefer this option to generate your PDF.  This method requires no subscription to Renda.io, but you do need some Floe Designer expertise.

The form field design is handled by Varo, and the fields arranged in Adobe Designer.

Then when you call the output program, you need to pass in two template types - one for the Floe email template and the other for the Varo form template:


Then in the output program you need to call the Varo function to return the PDF:
      CALL FUNCTION '/FLM/OUTPUT_PDF_PDL_OUT'
EXPORTING
im_ftype = lv_ftype
im_fid = lv_fid
im_fver = lv_fver
im_toption = lv_template
im_document = lv_doc
im_variables = lt_variables
im_no_print = 'X'
* IM_PDLTYPE =
* IM_XDCNAME =
IMPORTING
ex_pdf = lv_pdf
* EX_PDL =
* EX_PAGECOUNT =
* EX_JOB_ID =
ex_subrc = <gv_returncode>
ex_mess = ls_mess.

And then add this to the Floe attachments import parameter before calling the Floe API:
*-------------------------------------------------------------------
* Fill attachment
*
CONCATENATE 'Order_' lv_order '.pdf' INTO ls_attach-att_filename.
ls_attach-att_description = 'Order_output'.
ls_attach-att_data = lv_pdf.
APPEND ls_attach TO lt_attach.
ENDIF.
ENDIF.
*
*-------------------------------------------------------------------

  CALL FUNCTION '/FLOE/EMAIL_OUT'
EXPORTING
im_etype = gv_etype
im_elang = gv_language
im_document = l_im_doc
im_rec_emails = gt_rec_emails
im_variables = gt_vars
im_send_immediately = 'X'
im_attachments = lt_attach
im_preview = gv_screen_display
im_no_commit = lv_no_commit
IMPORTING
ex_subrc = <gv_returncode>
ex_ebody = ev_ebody
ex_mess = lt_mess
ex_rec_emails = et_rec_emails
ex_attachments = et_attachments
ex_esubject_long = ev_esubject_long.

See the full code example here.

3) Floe and IfBA


In scenarios where you already have a PDF template defined using Interactive Forms by Adobe, then you can generate the PDF, then add it to the Floe attachments table as above.

In order to generate the PDF you first need to set output settings:
 ls_outputparams-nodialog   = abap_true.
ls_outputparams-connection = 'ADS'.
ls_outputparams-getpdf = abap_true.
ls_outputparams-preview = abap_false.

Then follow the process to call ADS to print the PDF, but the output settings will return the PDF file rather than send to the SAP Spool.

PERFORM get_output_params


CALL FUNCTION 'FP_JOB_OPEN'


CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'


CALL FUNCTION lv_fm_name


CALL FUNCTION 'FP_JOB_CLOSE'

Note that the function call returns parameter ls_pdf_file:


This has the following structure:


So it's very simple to add to the Floe attachments table as follows:
CONCATENATE 'Order_' lv_order '.pdf' INTO ls_attach-att_filename.
ls_attach-att_description = 'Order_output'.
ls_attach-att_data = ls_pdf_file-pdf.
APPEND ls_attach TO lt_attach.

Summary


Using Floe alone (with Renda.io) is comfortably the easiest way to manage PDF output templates, but you can use any other means to generate a PDF and then send as an email attachment with Floe.

Of course, it's even better if you can get rid of the attachment entirely.
Labels in this area