Send Appointments or Meetings Requests to Microsoft Outlook

This sample code demonstrates how to send Appointments or Meetings Requests to Microsoft Outlook directly from Sap. There are many possible ways to use this, one very logical and helpful use is to automatically send “vacation”/Leave of absence appointments back to a respective employee and his manager after vacation/leave request approval in SAP HCM.

Sending eMails is a very basic Standard functionality. Sending appointments/meeting requests however, also directly from SAP is something more unique, but it’s supported nonetheless and can be very useful e.g. for Automatically Sending “vacation”/Leave of absence appointments back to the employee and his manager after vacation/leave request approval Automatically sending resubmission/follow-up appointments e.g. x days before contract expiration…

 

Pre-requisites

Sending out Appointments to e.g. Microsoft Outlook essentially makes use of the ABAP Class CL_APPOINTMENT.

The Class should exist and work on systems SAP NetWeaver 6.20 and higher.

Note Number

Short Text of Note

1364539

Incorrect display of ICS documents

1353329

iCalendar document that is sent is processed incorrectly

1357483

Title of sent appointment is incorrect

1369864

AllDay Appointment doesn’t appear correctly in Outlook

 

Note: Implement these notes with transaction SNOTE, which automatically checks for the applicability basedm on your current versions/patchlevels

Overview and Result

The program below is a sample to demonstrate how appointments can be sent touching on many of the available options like:

                multiple attendees

                Define Appointment Subject, Location & Body Long Text

                Specify Start/End Date/Time

                Create All-Day-Appointments

                Define “Show as”: Free, Busy etc.

 

This screenshot represents an appointment sent through the sample code below and received with Microsoft Outlook 2007:

1.JPG

Sample code for demonstration purposes:

*&———————————————————————*
*& Report z_appointment_to_outlook. *&
*&———————————————————————*
*& *&
*&———————————————————————*
* Version for R/3 4.7 developed by Pedrocchi Dario
* http://http://mysapmynavision.myblog.it/sap/
*
REPORT z_appointment_to_outlook.

INCLUDE <cntn01>.
TYPE-POOLS: sccon.
DATA: mail TYPE text40.
* Provide select option to enter multiple attendees
SELECTION-
SCREEN: BEGIN OF BLOCK org.
SELECT-OPTIONS: email FOR mail NO INTERVALS
DEFAULT ‘d.pedrocchi@onion.it’.
SELECTION-
SCREEN: END OF BLOCK org.


DATA lo_appointment TYPE REF TO cl_appointment.
DATA ls_participant TYPE scspart.
DATA lv_address TYPE swc_object.
DATA ls_address_container LIKE swcont OCCURS 0 WITH HEADER LINE.
DATA lt_text TYPE so_txttab.
DATA ls_text LIKE LINE OF lt_text.
DATA lv_location LIKE scsappt-room.

DATA lo_send_request TYPE REF TO cl_bcs.
DATA lv_sent_to_all TYPE os_boolean.
CREATE OBJECT lo_appointment.

* Add multiple attendees
LOOP AT email.
CLEAR ls_participant.
swc_create_object lv_address
‘ADDRESS’ space.
swc_set_element ls_address_container
‘AddressString’ email-low.
swc_set_element ls_address_container
‘TypeId’ ‘U’.
swc_call_method lv_address
‘Create’ ls_address_container.
CHECK sy-subrc = 0.
* * get key and type of object
swc_get_object_key lv_address ls_participant-objkey.
CHECK sy-subrc = 0.
swc_get_object_type lv_address ls_participant-objtype.
CHECK sy-subrc = 0.
MOVE sccon_part_sndmail_with_ans TO ls_participant-send_mail.
ls_participant-comm_mode =
‘INT’.
lo_appointment->add_participant( participant = ls_participant ).
ENDLOOP.

** Sample Apppointment for specific date/time *
* lo_appointment->set_date( date_from = ‘20090801’
* time_from = ‘130000’
* date_to = ‘20090801’
* time_to = ‘140000’ ).
* Sample Appointment for All-Day-Event
lo_appointment->set_date( date_from =
‘20090803’
date_to =
‘20090803’ ).

* Make appointment appear “busy”
lo_appointment->set_busy_value( sccon_busy_busy ).

* Set Location
* lo_appointment->set_location_string( ‘Location’ ).
lo_appointment->set_location(
‘Location’ ).

* Set Organizer
lo_appointment->set_organizer( sy-uname ).

* “Type of Meeting” (value picked from table SCAPPTTYPE)
lo_appointment->set_type(
‘ABSENT’ ).

* Make this an all day event
lo_appointment->set_view_attributes( show_on_top =
‘X’).

* Set Meeting body text
ls_text =
‘This is the Body Text of the Appointment’.
APPEND ls_text TO lt_text.

lo_appointment->set_text( lt_text ).
* Set Meeting Subject
lo_appointment->set_title(
‘This is the Appointment Subject’ ).

* Important to set this one to space.
* Otherwise SAP will send a NOT user-friendly e-mail
lo_appointment->save( send_invitation = space ).

* Now that we have the appointment, we can send a good one for outlook
* by switching to BCS
lo_send_request = lo_appointment->create_send_request( ).

* don’t request read/delivery receipts
lo_send_request->set_status_attributes( i_requested_status =
‘N’
i_status_mail =
‘N’ ).

* Send it to the world
lv_sent_to_all = lo_send_request->send( i_with_error_screen =
‘X’ ).

COMMIT WORK AND WAIT.


Send Appointments or Meetings Requests to Microsoft Outlookultima modifica: 2009-09-02T21:18:00+02:00da pedroccda
Reposta per primo quest’articolo

Un pensiero su “Send Appointments or Meetings Requests to Microsoft Outlook

  1. This sample code demonstrates how to send Appointments or Meetings Requests to Microsoft Outlook directly from Sap. There are many possible ways to use this, one very logical and helpful use is to automatically send “vacation”/Leave of absence appointments back to a respective employee and his manager after vacation/leave request approval in SAP HCM.

Lascia un commento