Posts

Showing posts from June, 2017

How to Open Outlook Mail from ABAP

We know that there is option to send mail directly from ABAP, but it uses SAP account to send email. In many cases we may not have access or configuration to send email from SAP directly. In certain scenario it might be necessary to send email with outlook, but we want SAP to populate some text/information in advance. We will be using OLE objects for the same.     DATA : lr_outlook  TYPE  ole2_object ,         lr_mi  TYPE  ole2_object ,         lv_body  TYPE  string ,         lv_sig  TYPE  string .    CREATE  OBJECT lr_outlook  'Outlook.Application' .    CALL  METHOD  OF       lr_outlook        'CreateItem'  =  lr_mi      EXPORTING       #1            =  0 .    SET  PROPERTY  OF  lr_mi  'To'  =   'firstname.lastname@domain.com' .    IF   p_emailcc <> space .      SET  PROPERTY  OF  lr_mi  'CC'  =  'mr.cc@domain.com' .    ENDIF .    SET  PROPERTY  OF  lr_mi  'Subject'  =  'Test Subject Line' .