Skip to Content

Add a Calendar in Outlook!!!!


Hi,

I need to add a Calendar Invitation in Outlook mail.

My requirement is when the participant book the training request and send for approval and the manager approves the request

then the mail needs to be send to employee that request has approved and in that the Calendar inviation has to be added in Outlook mail.

Kindly suggest.

Regards,

Sadiq K

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 07, 2015 at 09:58 AM

    There should be lots of examples if you seach with the class name that Mike mentioned. See for example this:

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b035a861-5f61-2c10-d086-c4dd779dd253?QuickLink=index&…

    Basically you just need to add a new step in your workflow. And from the step call a method that includes the needed logic with CL_APPOINTMENT.

    Regards,

    Karri

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      Thanks a lot for Mike and Karri.

      Atlast i have done the mail content with calendar option. Its woking fine now.

      Here the below code for reference. And this code will work.

      First need to Build the Calendar.

      * Calendar logic begin

      ls_soli-line = 'BEGIN:VCALENDAR'.

      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN'.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'VERSION:1.0'.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'METHOD:REQUEST'.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'BEGIN:VEVENT'.



      APPEND ls_soli TO lt_soli.

      CONCATENATE 'ATTENDEE;CN=' ls_uname ';ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:' 'skhaderbasha@qatargas.com.qa' INTO ls_soli-line.



      APPEND ls_soli TO lt_soli.

      CONCATENATE 'DTSTART:' lv_training-begda 'T' INTO ls_soli-line. "'T140000Z'

      IF lv_beguz IS NOT INITIAL.

      CONCATENATE ls_soli-line lv_beguz INTO ls_soli-line.

      ENDIF.

      APPEND ls_soli TO lt_soli.





      CONCATENATE 'DTEND:' lv_training-endda 'T' INTO ls_soli-line. "'T220000Z'

      IF lv_enduz IS NOT INITIAL.

      CONCATENATE ls_soli-line lv_enduz INTO ls_soli-line.

      ENDIF.





      APPEND ls_soli TO lt_soli.

      CONCATENATE 'LOCATION:' lv_loca INTO ls_soli-line.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'TRANSP:OPAQUE'.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'SEQUENCE:1'.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'DESCRIPTION: This is to notify following course has been approved'.

      APPEND ls_soli to lt_soli.

      * CONCATENATE 'Course Name : ' lv_training-stext INTO ls_soli-line SEPARATED BY space.

      * APPEND ls_soli to lt_soli.



      * ls_soli-line = 'Begin Date : '.

      * CONCATENATE 'Begin Date : ' lv_training-begda INTO ls_soli-line SEPARATED BY space.

      * ls_soli-line = 'End Date : '.

      * CONCATENATE 'End Date : ' lv_training-endda INTO ls_soli-line SEPARATED BY space.





      APPEND ls_soli TO lt_soli.

      CONCATENATE 'SUMMARY: Booking Confirmation: ' lv_training-stext INTO ls_soli-line SEPARATED BY space.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'PRIORITY:5'.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'X-MICROSOFT-CDO-IMPORTANCE:1'.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'CLASS:PUBLIC'.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'END:VEVENT'.



      APPEND ls_soli TO lt_soli.

      ls_soli-line = 'END:VCALENDAR'.



      APPEND ls_soli TO lt_soli.



      * End of Calendar

      * Call this function module to convert data created for calendar entry

      CALL FUNCTION 'SO_RAW_TO_RTF'

      TABLES

      objcont_old = lt_soli[]

      objcont_new = lt_soli_new[].

      """ Here the Logic to send the Mail Content and also Calendar Option in Mail.


      DATA : document TYPE REF TO cl_document_bcs.

      ************************************************************************

      *** To Send a Sender Mail Using CL_BCS

      ************************************************************************

      TRY.

      l_send_request = cl_bcs=>create_persistent( ).

      document = cl_document_bcs=>create_document(

      i_type = 'HTM' or "RAW" I have used HTML in SO10.
      i_text = body_sup " This i have read from the standard text.
      i_subject = 'Course Participation' ).

      * DESCRIBE TABLE lt_soli.

      CALL METHOD document->add_attachment

      EXPORTING

      i_attachment_type = 'VCS'

      i_attachment_subject = 'Course'

      i_att_content_text = lt_soli_new[].



      * Add document to send request

      CALL METHOD l_send_request->set_document( document ).



      ******************************************************************************

      ** Sender And Recipient Mail Address

      ******************************************************************************

      TRY.

      **** Sender Address for

      l_sender = cl_sapuser_bcs=>create( sy-uname ).

      CATCH cx_bcs INTO l_bcs.

      ENDTRY.



      ** Set Sender

      TRY.

      CALL METHOD l_send_request->set_sender

      EXPORTING

      i_sender = l_sender.

      CATCH cx_send_req_bcs INTO l_bcs.

      ENDTRY.



      *** Create Document

      *

      * TRY.

      * l_document = cl_document_bcs=>create_document(

      * i_type = 'HTM'

      * i_subject = 'QG Internal Training: Booking Confirmation'

      ** i_length =

      ** i_language = SPACE

      ** i_importance =

      ** i_sensitivity =

      * i_text = body_sup

      ** i_hex =

      ** i_header =

      ** i_sender =

      * ) .

      ** CATCH cx_send_req_bcs.

      * CATCH cx_bcs INTO l_bcs.

      * ENDTRY.

      **

      *** Set the Document

      *

      * TRY.

      * CALL METHOD l_send_request->set_document

      * EXPORTING

      * i_document = l_document.

      *

      * CATCH cx_send_req_bcs INTO l_bcs.

      * ENDTRY.





      ** Add Attachment

      * DATA : lv_cont TYPE solix_tab.

      * CALL METHOD cl_document_bcs=>xstring_to_solix

      * EXPORTING

      * ip_xstring = lt_soli_new

      * RECEIVING

      * rt_solix = lv_cont.





      ** Send to Recipient

      TRY.

      l_recipient = cl_cam_address_bcs=>create_internet_address( lv_sup_mail ).

      CATCH cx_bcs INTO l_bcs.

      ENDTRY.





      *********************************************************************

      *

      * lo_appointment->add_participant( participant = ls_participant ).

      *

      * DATA : lv_beg1 TYPE sy-datum,

      * lv_end1 TYPE sy-datum.

      *

      * lv_beg1 = lv_beg.

      * lv_end1 = lv_end.

      *

      * lo_appointment->set_date( date_from = lv_beg1 date_to = lv_end1 ).

      *

      * lo_appointment->set_title( 'Booking Confirmation :' ).

      *

      *

      * lo_appointment->save( send_invitation = space ).

      *

      * l_send_request = lo_appointment->create_send_request( ).

      *

      *

      * l_send_request->set_status_attributes( i_requested_status = 'N' i_status_mail = 'N' ).



      *****************************************************************************************

      * Add recipient address to send request

      TRY.

      CALL METHOD l_send_request->add_recipient

      EXPORTING

      i_recipient = l_recipient

      i_express = 'U'.

      CATCH cx_send_req_bcs INTO l_bcs.

      ENDTRY.







      "" Send Mail

      CALL METHOD l_send_request->send(

      EXPORTING

      i_with_error_screen = 'X' ).



      ENDTRY.

      COMMIT WORK AND WAIT.

      Regards,

      Sadiq K

  • Posted on May 07, 2015 at 09:23 AM

    Use CL_APPOINTMENT to create an appointment from which you can generate an ICF attachment (method AS_ICAL_OBJECT).

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.