cancel
Showing results for 
Search instead for 
Did you mean: 

Add a Calendar in Outlook!!!!

former_member227911
Participant
0 Kudos


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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

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

former_member227911
Participant
0 Kudos

Hi Karri,

Thanks for your reply. I have tried your link and its very useful. But i got an issue that its going as two mail in SOST when i trigger the Workflow one is for Calendar and one more is for sending mail to Supervisor.

But i need to send in one mail as Calendar and Approval mail.

Kindly suggest whether its possible?????

Regards,

Sadiq K

SandySingh
Active Contributor
0 Kudos

Hello Sadiq

May be the mail to supervisor is a seperate Email sending step in the Workflow and not the one that triggered from background step using CL_APPOINTMENT.  If so, then remove the Workflow Mail sending step from workflow..

Regards

Sandy

Former Member
0 Kudos

Just modify your WF template. Remove the unnecessary approval email step. If you were able to add the appointment email sending functionality to your workflow, then this should be easy step for you. Actually I am a bit surprised you asking this question? Is there some specific problem? Basically you really just need to add the approval email text to your appointment email, and get rid of the current approval email step.

Regards,

Karri

former_member227911
Participant
0 Kudos

Hi Karri,

Actually i got the Activity step and in that i have added the logic to send the Mail to supervisor and in that i have added my logic to send the Calendar by using CL_APPOINTMENT.

But when i execute the WF am getting TWO mail Executed in the WF.

Is there is any Specific Problem. Or i need to create another step in WF to write the Logic of Calendar.

Regards,
Sadiq K

former_member185167
Active Contributor
0 Kudos

Hello,

"Actually i got the Activity step and in that i have added the logic to send the Mail to supervisor and in that i have added my logic to send the Calendar by using CL_APPOINTMENT."

How did you do that? Does your Activity step actually send two separate emails?

regards

Rick

former_member227911
Participant
0 Kudos

Hi Rick,

Thanks for your reply..

My activity send to only one mail to supervisor in that logic i have added the Calendar logic to send ...

Kindly suggest..

Regards,

Sadiq

pokrakam
Active Contributor
0 Kudos

Sadiq Basha wrote:

My activity send to only one mail to supervisor in that logic i have added the Calendar logic to send ...

I count two times "send" in that statement. => Two mails.

You should attach, not send the appointment.

former_member227911
Participant
0 Kudos

Hi Mike,

Sorry for the late reply. I was trying to attach the calendar with mail content but i can't able to add the calendar . Here the following code i have used.

Kindly suggest.

* 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:' lv_sup_mail INTO ls_soli-line.

APPEND ls_soli TO lt_soli.
CONCATENATE 'DTSTART:' lv_beg 'T140000Z' INTO ls_soli-line.

APPEND ls_soli TO lt_soli.
CONCATENATE 'DTEND:' lv_end 'T220000Z' INTO ls_soli-line.

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: Course Participation'.

APPEND ls_soli TO lt_soli.
CONCATENATE 'SUMMARY: Course Participation for ' ls_uname 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[].


l_sub_cal
= 'Course Participation'.
ls_soli
-line = 'This is to notify following course has been approved'.
APPEND ls_soli TO lt_content.
CLEAR ls_soli.

APPEND ls_soli TO lt_content.
CONCATENATE 'Course Name: ' lv_stext INTO ls_soli-line.
APPEND ls_soli TO lt_content.
CLEAR ls_soli.

APPEND ls_soli TO lt_content.
CONCATENATE 'Begin Date: ' lv_beg INTO ls_soli-line.
APPEND ls_soli TO lt_content.
CLEAR ls_soli.

APPEND ls_soli TO lt_content.
CONCATENATE 'End Date: ' lv_end INTO ls_soli-line.
APPEND ls_soli TO lt_content.
CLEAR ls_soli.

APPEND ls_soli TO lt_content.
CONCATENATE 'Location Name: ' lv_loca INTO ls_soli-line.
APPEND ls_soli TO lt_content.
CLEAR ls_soli.
APPEND ls_soli TO lt_content.

************************************************************************
*** To Send a Sender Mail Using CL_BCS
************************************************************************
CLASS cl_bcs DEFINITION LOAD.

**  Create Persistance Send Request
l_send_request
= cl_bcs=>create_persistent( ).
*""""""
*CREATE OBJECT l_appointment.

TRY.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type       
= 'RAW'
i_subject    
= l_sub_cal
*       i_length      =
*       i_language    = SPACE
*       i_importance  =
*       i_sensitivity =
i_text       
= lt_content[]
*       i_hex         =
*       i_header      =
*       i_sender      =
.
*    CATCH cx_document_bcs .
ENDTRY.
DESCRIBE TABLE lt_soli.

CALL METHOD l_document->add_attachment
EXPORTING
i_attachment_type   
= 'VCS'
i_attachment_subject
= 'Course'
i_att_content_text  
= lt_soli_new[].



TRY.
CALL METHOD l_send_request->set_document
EXPORTING
i_document
= l_document.
CATCH cx_send_req_bcs INTO l_bcs.
ENDTRY.




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

** Send to Recipient
TRY.
l_recipient
= cl_cam_address_bcs=>create_internet_address( lv_sup_mail ).
CATCH cx_bcs INTO l_bcs.
ENDTRY.


* Add recipient address to send request
TRY.
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient
= l_recipient.
CATCH cx_send_req_bcs INTO l_bcs.
ENDTRY.

** Send Mail
TRY.
CALL METHOD l_send_request->send( ).
CATCH cx_send_req_bcs .
ENDTRY.

COMMIT WORK AND WAIT.
ENDMETHOD.

former_member227911
Participant
0 Kudos

Hi,

Can any body suggest regarding this Issue. The Above code which i have implemented to send the Calendar as attachment.

Kindly suggest.

Thanks,

Sadiq.

Former Member
0 Kudos

What is currently your issue? What is the solution doing wrong?

One thing that doesn't look right to me is that you are calling two times the following method: cl_document_bcs=>create_document (You are creating two document objects.)

As far as I remember correctly, you call that method to create the actual email document. Then after this you should add the attachment by calling the add_attachment of the above document instance.

Try to find a simple example how to add an attachment to a mail created by CL_BCS. Then apply the same principle to your solution. The fact that you are now attaching an appointment file is irrelevant, the process is the same if you would attach an Excel file or whatever.

Regards,

Karri

former_member227911
Participant
0 Kudos

Hi Karri,

Thanks for your respond. Really i stucked with this issue.

1) First thing am creating the Document which is needs to be display as calendar File in the Mail content. The following code used.

TRY.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type       
= 'RAW'
i_subject    
= l_sub_cal
*       i_length      =
*       i_language    = SPACE
*       i_importance  =
*       i_sensitivity =
i_text       
= lt_content[]
*       i_hex         =
*       i_header      =
*       i_sender      =
.
*    CATCH cx_document_bcs .
ENDTRY.
DESCRIBE TABLE lt_soli.

CALL METHOD l_document->add_attachment
EXPORTING
i_attachment_type   
= 'VCS'
i_attachment_subject
= 'Course'
i_att_content_text  
= lt_soli_new[].

TRY.
CALL METHOD l_send_request->set_document
EXPORTING
i_document
= l_document.
CATCH cx_send_req_bcs INTO l_bcs.
ENDTRY.

2) Then i Need to dislay the CONTENT in the Mail so i used the following code.

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

Kindly suggest .

Regards,

sadiq

former_member227911
Participant
0 Kudos

Hi,

Anybody can help to my solution. Will be thankful.

pokrakam
Active Contributor
0 Kudos

Maybe try the suggestion Karri gave you. Your response still contained code for creating two documents.

former_member227911
Participant
0 Kudos

Hi Mike,

Ok let me try what Karri suggest and let u know.

Regards,

Sadiq K

former_member227911
Participant
0 Kudos

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

Answers (1)

Answers (1)

pokrakam
Active Contributor
0 Kudos

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