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'.

  CALL METHOD OF
      lr_mi
      'Display'.

  SET PROPERTY OF lr_mi 'Body' 'This is body of the mail'.

  FREE OBJECT lr_outlook.

Comments

  1. I am thank full to you for sharing the information, its really very helping
    From TEAM Subway Street Run
    Thanks

    ReplyDelete
  2. This is helpful customer support review of Outlook, it gives us reliable information about Outlook, thank you so much for sharing this blog. For any kind of technical support for Outlook visit the website Outlook Help Number UK or call at 0800-090-3220.

    ReplyDelete
  3. How to set property with multiple lines of body?

    ReplyDelete
  4. Thanks for this, I have one question, Is it possible to change from mail id means static for all time..??. Can you please let me know

    ReplyDelete

Post a Comment

Popular posts from this blog

ABAP Tips - 1 : How to Display a Popup and Get Values from User ?

Help on BAPI_ACC_DOCUMENT_POST and BAPI_ACC_DOCUMENT_POST

Few Tips for Transport Request Manipulation