Use Floe for Payment Run output

This section describes how to build a print program for a payment run to call Floe.

The normal payment method configuration settings are omitted.

In this example we describe how to clone the generic print program RFFOAVIS_FPAYM, but the same approach applies to the other RFF* print programs.

[1] Clone Print Program RFFOAVIS_FPAYM to create Z_RFFOAVIS_FPAYM.

[2] Clone Include RFFORI06 to create Z_RFFORI06.

[3] Edit print program Z_RFFOAVIS_FPAYM

(i) Change the INCLUDE reference:

1:
2:
3:
4:
5:
6:
7:
8:
9:
*----------------------------------------------------------------------*
*  Unterprogramm Avis ohne Allongeteil                                 *
*----------------------------------------------------------------------*

*/ FLOE modification /*
*/ Use copied INCLUDE for payment advice creation
*  INCLUDE rffori06.
  INCLUDE z_rffori06.
*////////////////////*

(ii) Add Floe selection parameters:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
...
    par_sofb LIKE rfpdo1-fordsofb NO-DISPLAY,
    par_maxp LIKE rfpdo-fordmaxp  NO-DISPLAY,
    par_vari(12) TYPE c           NO-DISPLAY,
    par_sofo(1)  TYPE c           NO-DISPLAY.

*/ FLOE modification /*
  SELECTION-SCREEN BEGIN OF BLOCK floe WITH FRAME TITLE text-002.
  PARAMETERS: p_etype TYPE /floe/etype_code MATCHCODE OBJECT /floe/etype,
              p_immed AS CHECKBOX.
  SELECTION-SCREEN END OF BLOCK floe.
*/////////////////////*

(iii) Add text element:

(iv) Add selection texts:

[4] Edit the INCLUDE Z_RFFORI06

Here the program tries to issue output by EDI first and then by print.

In between these options we add a check to see if an email type has been defined and whether an email address is available.  If so then we call a function to call Floe, otherwise we continue as normal.

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:
79:
          tab_ausgabe-count   = 1.
          COLLECT tab_ausgabe.
        ENDIF.
      ENDIF.

*/ FLOE modification /*

      DATA: l_addr1_complete  TYPE szadr_addr1_complete,
            l_addr1_line      TYPE szadr_addr1_line,
            l_adsmtp_line     TYPE szadr_adsmtp_line,
            l_recipient_email TYPE ad_smtpadr,
            l_langu           TYPE /floe/elang,
            l_subrc           TYPE sysubrc.

      IF p_etype IS NOT INITIAL AND flg_kein_druck EQ 0.

* Get recipient e-mail address.

        CALL FUNCTION 'ADDR_GET_COMPLETE'
          EXPORTING
            addrnumber     = reguh-zadnr
          IMPORTING
            addr1_complete = l_addr1_complete
          EXCEPTIONS
            OTHERS         = 4.

        IF sy-subrc EQ 0.

*     Check that internet address is available
          READ TABLE l_addr1_complete-adsmtp_tab INTO l_adsmtp_line INDEX 1.

          IF sy-subrc EQ 0.
*     Address found.

            l_recipient_email = l_adsmtp_line-adsmtp-smtp_addr.

*     Read communication language
            READ TABLE l_addr1_complete-addr1_tab INTO l_addr1_line INDEX 1.
            IF sy-subrc EQ 0.
              l_langu = l_addr1_line-data-langu.
            ENDIF.

*     Fill item table parameter
        REFRESH: l_t_regup.
        l_t_regup[] = tab_regup[].

            CALL FUNCTION 'Z_FLOE_PAYMENT_ADVICE'
              EXPORTING
                im_etype     = p_etype
                im_langu     = l_langu
                im_immed     = p_immed
                im_reguh     = reguh
                im_regup     = l_t_regup
                im_recipient = l_recipient_email
              IMPORTING
                ex_subrc     = l_subrc.

            IF l_subrc EQ 0.
*       Success : stop advice from being printed.
              flg_kein_druck = 1.
              CLEAR tab_ausgabe.
              tab_ausgabe-name    = 'FLOE payment advice sent by e-mail.'.
              tab_ausgabe-count   = 1.
              COLLECT tab_ausgabe.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
*////////////////////*





*     Ausgabe auf Fax oder Drucker (nur falls notwendig)
      IF flg_kein_druck EQ 0.

        PERFORM avis_nachrichtenart.
        IF reguh-vblnr = space AND ld_vblnr <> space.

[5] Add function to call Floe Z_FLOE_PAYMENT_ADVICE

This function prepares the Floe variables from the payment advice tables and then calls Floe.

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:
FUNCTION z_floe_payment_advice.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(IM_ETYPE) TYPE  /FLOE/ETYPE_CODE
*"     VALUE(IM_LANGU) TYPE  /FLOE/ELANG
*"     VALUE(IM_IMMED) TYPE  FLAG
*"     VALUE(IM_REGUH) TYPE  REGUH
*"     VALUE(IM_REGUP) TYPE  FI_T_REGUP
*"     VALUE(IM_RECIPIENT) TYPE  AD_SMTPADR
*"  EXPORTING
*"     VALUE(EX_SUBRC) TYPE  SYSUBRC
*"----------------------------------------------------------------------

  DATA: ls_rec           TYPE /floe/rec_email_s,
        lt_rec           TYPE /floe/rec_email_t,
        ls_vars          TYPE /floe/vars_s,
        lt_vars_temp     TYPE /floe/vars_t,
        lt_vars          TYPE /floe/vars_t,
        l_langu          TYPE /floe/elang.

* Fill recipient table
*
  ls_rec-email =  im_recipient.
  ls_rec-type = 1.
  APPEND ls_rec TO lt_rec.
*
* Fill variables table
*
* Header
  CALL METHOD /floe/core=>get_data_from_structure
    EXPORTING
      im_structure = im_reguh
    IMPORTING
      ex_vars      = lt_vars_temp.
*
  APPEND LINES OF lt_vars_temp TO lt_vars.
*
* Items
  CALL METHOD /floe/core=>get_data_from_table
    EXPORTING
      im_table = im_regup
    IMPORTING
      ex_vars  = lt_vars_temp.
*
  APPEND LINES OF lt_vars_temp TO lt_vars.
*
* Trigger Floe
*
  CALL FUNCTION '/FLOE/EMAIL_OUT'
    EXPORTING
      im_etype            = im_etype
      im_elang            = im_langu
*     IM_ESUBJECT_LONG    =
      im_rec_emails       = lt_rec
      im_variables        = lt_vars
      im_send_immediately = im_immed
    IMPORTING
      ex_subrc            = ex_subrc.
*
ENDFUNCTION.

[6] Create an email type and add content in Floe Email Builder

[7] Add Email Data user-exit for field formatting.

Here we also concatenate fields to provide a single ADDRESS variable.

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:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
*---------------------------------------------------------------------------*
*                      <<< Start of Customer Code >>>                       *
*---------------------------------------------------------------------------*
  DATA: ls_vars TYPE /floe/vars_s.

* Build Address block
*
  DATA: l_address TYPE string,
        ls_t005t  TYPE t005t.
*
  CLEAR ls_vars.
  READ TABLE ch_variables WITH KEY var_code = 'ZNME3' INTO ls_vars.
  IF ls_vars-value NE space.
    CONCATENATE ls_vars-value '<br/>' INTO l_address.
  ENDIF.
  CLEAR ls_vars.
  READ TABLE ch_variables WITH KEY var_code = 'ZNME4' INTO ls_vars.
  IF ls_vars-value NE space.
    CONCATENATE l_address ls_vars-value '<br/>' INTO l_address.
  ENDIF.
  CLEAR ls_vars.
  READ TABLE ch_variables WITH KEY var_code = 'ZPFAC' INTO ls_vars.
  IF ls_vars-value NE space.
    CONCATENATE l_address ls_vars-value '<br/>' INTO l_address.
  ENDIF.
  CLEAR ls_vars.
  READ TABLE ch_variables WITH KEY var_code = 'ZSTRA' INTO ls_vars.
  IF ls_vars-value NE space.
    CONCATENATE l_address ls_vars-value '<br/>' INTO l_address.
  ENDIF.
  CLEAR ls_vars.
  READ TABLE ch_variables WITH KEY var_code = 'ZORT1' INTO ls_vars.
  IF ls_vars-value NE space.
    CONCATENATE l_address ls_vars-value '<br/>' INTO l_address.
  ENDIF.
  CLEAR ls_vars.
  READ TABLE ch_variables WITH KEY var_code = 'ZPST1' INTO ls_vars.
  IF ls_vars-value NE space.
    CONCATENATE l_address ls_vars-value '<br/>' INTO l_address.
  ENDIF.
  CLEAR ls_vars.
  READ TABLE ch_variables WITH KEY var_code = 'ZLAND' INTO ls_vars.
  IF ls_vars-value NE space.
    SELECT SINGLE * FROM  t005t INTO ls_t005t
           WHERE  spras  = im_elang
           AND    land1  = ls_vars-value+0(2).
    ls_vars-value = ls_t005t-landx.

    CONCATENATE l_address ls_vars-value '<br/>' INTO l_address.
  ENDIF.
*
  CLEAR ls_vars.
  ls_vars-var_code = 'ADDRESS'.
  ls_vars-value = l_address.
  APPEND ls_vars TO ch_variables.
*
* Convert document date
  DATA: l_olddate TYPE datum,
        l_newdate TYPE string.

  CLEAR ls_vars.
  READ TABLE ch_variables WITH KEY var_code = 'ZALDT' INTO ls_vars.
  IF sy-subrc EQ 0.
*
    l_olddate = ls_vars-value.
*
    CALL FUNCTION 'CONV_EXIT_LDATE_OUTPUT_LANGU'
      EXPORTING
        input    = ls_vars-value
        language = im_elang
      IMPORTING
        output   = l_newdate.
*
    REPLACE ALL OCCURRENCES OF '.' IN l_newdate WITH ''.
*
    ls_vars-value = l_newdate.
    MODIFY ch_variables INDEX sy-tabix FROM ls_vars.
*
  ENDIF.

* Format dates
  LOOP AT ch_variables INTO ls_vars WHERE var_code EQ 'BLDAT'.
*
    l_olddate = ls_vars-value.
*
    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
      EXPORTING
        date_internal = l_olddate
      IMPORTING
        date_external = l_newdate.
*
    ls_vars-value = l_newdate.
    MODIFY ch_variables INDEX sy-tabix FROM ls_vars.
*
  ENDLOOP.
*
* Determine currency symbol
*
  DATA: l_curry TYPE string.

  READ TABLE ch_variables WITH KEY var_code = 'WAERS' INTO ls_vars.
  CASE ls_vars-value.
    WHEN 'GBP'.
      l_curry = '£'.
    WHEN 'USD'.
      l_curry = '$'.
    WHEN 'EUR'.
      l_curry = '&euro;'.
    WHEN OTHERS.
      l_curry = ls_vars-value.
  ENDCASE.
*
  ls_vars-var_code = 'CURRY'.
  ls_vars-value = l_curry.
  APPEND ls_vars TO ch_variables.

  ls_vars-var_code = 'TCURRY'.
  ls_vars-value = l_curry.
  APPEND ls_vars TO ch_variables.
*
* Debit/credit indicator
*
  LOOP AT ch_variables INTO ls_vars WHERE var_code EQ 'SHKZG'.
    IF ls_vars-value = 'S'.
      ls_vars-value = '-'.
    ELSE.
      CLEAR ls_vars-value.
    ENDIF.
    MODIFY ch_variables FROM ls_vars INDEX sy-tabix.
  ENDLOOP.
*
* Format quantities
*
  DATA: l_qty TYPE p DECIMALS 2,
        l_qty_char type char16.
  set country 'GB'.               "Arch System only

  LOOP AT ch_variables INTO ls_vars WHERE var_code EQ 'RBETR' OR var_code EQ 'WRBTR'.
*
    l_qty = ls_vars-value.
    write l_qty to l_qty_char currency 'GBP'.  "Use currency variable instead for multi-country solution
    ls_vars-value = l_qty_char.

    MODIFY ch_variables FROM ls_vars INDEX sy-tabix.
*
  ENDLOOP.


*---------------------------------------------------------------------------*
*                      <<< End of Customer Code >>>                         *
*---------------------------------------------------------------------------*

[8] To test run Z_RFFOAVIS_FPAYM for an existing payment run.

 

Download files:

Email type: FLOE_DM4_800_PA02(Encoding=4103).floe

Print program: Z_RFFOAVIS_FPAYM.txt

Include: Z_RFFORI06.txt

Function module: Z_FLOE_PAYMENT_ADVICE.txt