Email Sending Functionality for Different Business Process in SAP - NEW CONCEPT

Email Sending Functionality for Different Business Process in SAP:

Introduction
Every Business Process in SAP Follow different communication types to communicate with its Business partners like Print and send via post, Fax, and Email (Internet).Several E-mail communications need to be sent to Vendors & Customers who are the business partners for the organization which contains several Business Processes like Payment Advice, Dunning forms and PO’s etc., with PDF and Excel as attachment, which is a very eco-friendly way. Presently many are using the process of taking a print out and sending it through the post. This Process has lot of paper wastage. So instead of this we can send a mail which saves lot of paper wastage .This process enables the Go green Initiative and reduces lot of manual effort. With the recent releases in SAP all the Business process are enhanced with Email sending functionality.

Introduction to Email Processes
Every Standard FI process like Dunning and Payment and collection advice has a default way of sending there notices to the customer or vendor by post. Sending a mail is not a standard SAP functionality; in order to achieve this nonstandard Functionality we haveBTE.  This is an enhancement technique (Open FI) that was developed for Financial Accounting component. This functionality is primarily used in FI in the areas of dunning, Payment advice Customer and Vendor Statement etc. Each of them has their own Function modules which will not interfere with each other.
Each of these has a BTE’s enabled to fill the FINNA-NACHA structure to determine whether the output should be sent as fax, print via post or email, i.e., if FINAA-NACHA = 1 - print via post and FINAA-NACHA = ‘I’ its email and if its ‘2’ FAX.
This Document contains how this mail functionality can be achieved by using the BTE’s for Different applications in FI.

1. Application Area: FI - Accounts payable and Accounts receivable – Dunning
Application of the process BTE event '00001040' -
· This process BTE is useful during a dunning run when a dunning notice needs to be sent to the customer by the medium of an electronic form (EMAIL).
As a default property, the dunning notice gets printed and is sent to the customer either by scanning the copy or via 'POST'.
· This same dunning notice could be a very beneficial if it is sent by means of electronic form directly after the dunning has been carried out.
· So, to achieve this non-standard functionality we need to enhance the standard process.

Transaction - FIBF -> Environment -> Info systems (Processes)
· Click on execute,

· Select the BTE 00001040 as it deals with the Output device/medium


· Change the Already Present function module to Z function Module.


Now, technically the BTE is ready to work as we have registered the BTE.
As a functional aspect, the following things are needed to be taken care of.
· Standard communication option - to 'EMAIL' in the 'General' Tab in customer master 'XD02/01'.



· After configuring these basic steps, the BTE is complete to trigger for dunning run for this particular customer.

Dunning Run
· SAPF150D2-This Program can be used to execute the Dunning form by giving the Run date and identification and the logic in the FM's can be checked by placing the debugger.
· Best way is to check in the debugger,



Ø FINAA-NACHA - For Communication Medium (I- Internet, 1-Print Out, 2-Fax)
Ø FINAA_INTAD – Email Address to send the PDF




Ø Process the next step by confirming the 'Send to mail' dialog,
Ø If 'C_FINAA-INTAD' is left blank the system will pick from the customer master 'Clerks internet', else it will take from the value 'C_FINAA-INTAD'. This enables the PDF sending functionality which enables is standard process and the logic to send excel can be written in the above FM only. Also if you need to fill the Subject of Email use itcpo-tdtitle structure which of 50 characters. If we need to send the Body also Maintain the standard text as mentioned in the below screen shot.



NOTE: If we need to send many attachments other than PDF we have to write the code in the above FM call the common mail sending functionality. In this case first a mail will be sent with Excel or some other as attachment then the standard PDF functionality is called.

This is a very eco-friendly means of informing the customers for their over-due items.

2. Application Area: FI – Payment Advice and Collection Advice:
Application of the process BTE event '00002040' –
This BTE is called in the standard include RFFORI06 as shown below.



· In the transaction FIBF Select the BTE 00002040 as it deals with the Output device/medium sample_process_00002040 will be assigned.

· Since this is not a standard functionality we need to enhance the FM so copy the
sample_process_00002040 into Zsample_process_00002040.

Logic in the FM
Check if customer or Vendor has Email Maintained in the Master Data. If it’s maintained then
· The structure c_finna included the internet address.
We set the transmission medium to ‘I’ as below.
c_finaa-nacha = 'I'.
c_finaa-intad = l_smtp_addr(130). [The email Obtained from the master data]
·    Later the mail sending functionality can be called after the close_form as shown in the below screen shot or By OTF data and excel can be created using the tab_regup structure in the   form avis_schreiben.

3. Application Area: FI – Customer/Vendor Balance Confirmation:
Application of the process BTE event '00002410' –
· This process BTE is useful during a Customer/Vendor Balance Confirmation form which needs to be sent to the Customer/Vendor by an electronic form (EMAIL). By default, the form is sent to the Customer/Vendor either by Fax or via 'POST'.
· But as an environmental aspect to avoid wastage of paper, the same Statement could be sent by means of electronic form directly after the Customer/Vendor Statement run has been carried out.
· So, to achieve this functionality we need to enhance the standard process.

Transaction - FIBF -> Environment -> Info Systems (Processes)

· Click on Execute.
· Select BTE 00002410 as it deals with Determining the Output Device.



· Click on Sample Function Module. The FM 'SAMPLE_PROCESS_00002410' is assigned. In order to include the mail sending functionality, Copy the Function Module into a Z Function Module and make the required changes to enable the mail sending functionality.

Logic in the FM:
Check if the Customer or Vendor has Email Maintained in the Master Data. If it is maintained then
· The structure c_finna includes the internet address.
We set the transmission medium to ‘I’ as below.
C_finaa-nacha = 'I'.
C_finaa-intad = l_smtp_addr(130). [Email Obtained from the master data]
· Later the mail sending functionality can be called after the Close_form as shown in the below screen shot or By OTF data, and excel can be created using the Structure HBSIDH for Customer and HBSIKH for Vendor.



4. How to achieve Mail Functionality Technically:
Create a Common Functionality for sending mail using classes

i) For sending the subject greater than 255 characters
· At present using the FM SO_DOCUMENT_SEND_API1 has the capability of sending only 50 characters but using the below method of the class the subject more than 255 characters.
· So cl_bcs class is used for the below purpose.
· There is also any option of changing the sender ID in case the requirement is not    to use the
· SAP master User ID using the cl_bcs  class.
· Create the below object of type cl_bcs  and call the method  set_message_subject
w_send_request     TYPE REF TO cl_bcs           VALUE IS INITIAL,       
     
 CALL METHOD w_send_request->set_message_subject
       
 EXPORTING
          ip_subject = subject.

ii) For Sending Multiple Attachments like PDF and Excel
· In case multiple attachments the below method add_attachment attachment can be used by looping on the attachments obtained to this function module.
f_ATTACHMENTS    TYPE      RMPS_T_POST_CONTENT
w_document       TYPE REF TO cl_document_bcs  VALUE IS INITIAL,

     
 LOOP AT attachments INTO f_attachment.

        w_attachment_subject = f_attachment-subject.
        w_filesize = f_attachment-docsize.
· This Method will have the option to take input as method subject, filesize and
        w_document->add_attachment(
       
 EXPORTING
        i_attachment_type    = f_attachment-doc_type
        i_attachment_subject = w_attachment_subject
        i_attachment_size    = w_filesize
        i_att_content_text   = f_attachment-cont_text[] ).
ENDLOOP.

iii) For Sending Email to multiple recipients like To, BCC and CC,
· The below Logic can applied to provide cc bcc and to as like multiple receivers. The method
add_recipient   has the option to give blind_copy, Copy and recipient.
w_recipient      TYPE REF TO if_recipient_bcs VALUE IS INITIAL,
· Loop at the multiple receivers
LOOP AT receivers INTO f_receivers.
w_recipient_mail = f_receivers-receiver .
· The below method sets them mail ID of the Receiver.
          w_recipient = cl_cam_address_bcs=>create_internet_address(
                         w_recipient_mail).
w_send_request->add_recipient(
           
 EXPORTING
            i_recipient = w_recipient
            i_express =
 'X'
            i_copy = f_receivers-copy
            i_blind_copy = f_receivers-blind_copy).
ENDLOOP.




Comments

Popular posts from this blog

EVENTS IN INTERACTIVE REPORTS OF SAP ABAP

Differences Between Classic & New BAdIs :

SAP ABAP Fresher Resume/ CV Writing Format..