Custom trigger program

Since Floe is a developer tool, you will need to call the Floe API from a custom trigger program.

The Floe API is a remote-enabled function, /FLOE/EMAIL_OUT

Import parameters:

Parameter Description
IM_ETYPE Email Type
IM_ELANG Communication Language
IM_ESUBJECT_LONG

E-mail subject

The e-mail subject is read from the Email Type configuration table. This parameter over-rides the configuration setting.

IM_DOCUMENT

External document reference.

This reference number is passed into all the Floe user-exits.  It can contain, for example, an employee or customer number, a purchase order, sales order etc.  It is used for deriving variable data and determining business logic.

IM_REC_EMAILS

Table of e-mail recipients.

Note that the function sends out a single e-mail to all the recipients.  In order to send multiple e-mails, call the function separately for each recipient.

IM_VARIABLES

Table of variables.

If variable data is known at the time of the API call then the variables can be passed into Floe.  Otherwise determine variables using the Email Data User-Exit.

IM_FORM_DATA

Table of e-form data.

This is used when triggering Floe from FLM.  All form fields become available as variables within Floe.

IM_ATTACHMENTS

Table of attachments.

Attachments can be passed into the API instead of being determined in the Attachment User-Exit.

IM_SEND_IMMEDIATELY Flag to control whether the e-mail send is triggered immediately, or whether the e-mail stays in the outbound queue (transaction SCOT / SOST )waiting for a SAP processing job.
IM_IMPORTANCE

An indicator for low, normal or high importance. 

This flag is added to the e-mail and is visible on e-mail clients.

IM_PREVIEW

Flag to return the e-mail subject, recipients, body and attachments in the export parameters.

If the Preview flag is set then no e-mail is sent by Floe.

Export parameters:

Parameter Description
EX_SUBRC Return code (0 = Success, 4 = Error)
EX_MESS Table of messages.  Used typically if an error is returned.
EX_EBODY Generated e-mail body.  Used for e-mail preview.
EX_REC_EMAILS Table of recipients. Used for e-mail preview.
EX_ATTACHMENTS Table of attachments. Used for e-mail preview.
EX_ESUBJECT_LONG E-mail subject. Used for e-mail preview.

Sample program:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
*&---------------------------------------------------------------------*
*& Report  ZFLOE_TRIGGER_DEMO
*&
*&---------------------------------------------------------------------*
*& Sample trigger program to show Floe API call with Variables
*&
*&---------------------------------------------------------------------*
REPORT  zfloe_trigger_demo.
*
DATA: lt_rec_emails TYPE /floe/rec_email_t,
      ls_rec_email  TYPE /floe/rec_email_s,
      lt_vars       TYPE /floe/vars_t,
      ls_vars       TYPE /floe/vars_s,
      lv_subrc      TYPE sysubrc,
      lt_mess       TYPE TABLE OF bapiret2.
*
PARAMETERS: p_rec_em TYPE /floe/rec_email DEFAULT 'cs@arch.co.uk',
            p_tr_num(16) DEFAULT '4003095347361100',
            p_dl_num(16) DEFAULT '102852356466987',
            p_or_num(16) DEFAULT '53205177',
            p_suppli(40) DEFAULT 'INDIGO BOOKS EXPRESS/EXPEDITED - NON-GTA'.
*
PERFORM add_variable USING 'TR_NUM' p_tr_num.
PERFORM add_variable USING 'DL_NUM' p_dl_num.
PERFORM add_variable USING 'OR_NUM' p_or_num.
PERFORM add_variable USING 'SUPPLIER' p_suppli.
*
PERFORM add_recipient USING p_rec_em.
*
CALL FUNCTION '/FLOE/EMAIL_OUT'
  EXPORTING
    im_etype                  = 'CP01'
    im_elang                  = 'E'
*   IM_ESUBJECT_LONG          =
*   IM_DOCUMENT               =
    im_rec_emails             = lt_rec_emails
    im_variables              = lt_vars
*   IM_FORM_DATA              =
*   IM_ATTACHMENTS            =
    im_send_immediately       = 'X'
*   IM_IMPORTANCE             = '1'
*   IM_PREVIEW                =
  IMPORTING
    ex_subrc                  = lv_subrc
    ex_mess                   = lt_mess.
*   EX_EBODY                  =
*   EX_REC_EMAILS             =
*   EX_ATTACHMENTS            =
*   EX_ESUBJECT_LONG          =

*
IF lv_subrc = 0.
  WRITE:/ 'E-mail sent successfully.'.
ELSE.
  WRITE:/ 'Problem sending e-mail.'.
ENDIF.
*
*&---------------------------------------------------------------------*
*&      Form  add_variable
*&---------------------------------------------------------------------*

FORM add_variable USING pi_var pi_value.
  CLEAR ls_vars.
  ls_vars-var_code = pi_var.
  ls_vars-value = pi_value.
  APPEND ls_vars TO lt_vars.
ENDFORM.                    "add_variable

*&---------------------------------------------------------------------*
*&      Form  add_recipient
*&---------------------------------------------------------------------*

FORM add_recipient USING pi_rec.
  CLEAR ls_rec_email.
  ls_rec_email-email = pi_rec.
  ls_rec_email-type = '1'.
  APPEND ls_rec_email TO lt_rec_emails.
ENDFORM.                    "add_recipient