Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Open outlook editor from interactive with attachment

Hi All,

I have a requirement where i have to open the MS outlook editor from interactive with a attachment.

Thanks

Shafiq

Tags:
Former Member
replied

Slightly modified version of program from Open Outlook email editor from SAP thread:

INCLUDE ole2incl .
DATA: lr_outlook TYPE ole2_object,
      lr_mi TYPE ole2_object,
      lr_atts 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' = 'your@to.address'.
SET PROPERTY OF lr_mi 'CC' = 'your@cc.address'.
SET PROPERTY OF lr_mi 'Subject' = 'Your subject'.

GET PROPERTY OF lr_mi 'Attachments' = lr_atts.
CALL METHOD OF lr_atts 'Add'
  exporting #1 = 'C:TPHKLOCK.TXT'.

GET PROPERTY OF lr_mi 'Body' = lv_sig.


CONCATENATE 'First line' cl_abap_char_utilities=>newline
  INTO lv_body.
CONCATENATE lv_body 'Second line' cl_abap_char_utilities=>newline
  INTO lv_body.
CONCATENATE lv_body 'Third line' cl_abap_char_utilities=>newline
  INTO lv_body.

CONCATENATE lv_body lv_sig  INTO lv_body.

SET PROPERTY OF lr_mi 'Body' = lv_body.

CALL METHOD OF lr_mi 'Display'.

FREE OBJECT lr_outlook.

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question