Working with the SAP Calendar Control

Use

This section describes the specific functions of the SAP calendar control.

The process described in this section represents only a control-specific enhancement of the general control integration process and cannot be used separately.

Process

Instantiating

  1. Define a reference variable for the SAP calendar control:

    DATA calendar TYPE REF TO cl_gui_calendar.

  2. Create an instance of the SAP toolbar control:

    CREATE OBJECT calendar

    EXPORTING parent = container

    view_style = view_style.

  3. Set the calendar to a specific date:

    CALL METHOD calendar->go_to_date

    EXPORTING focus_date = sy-datum.

Registering the events

  1. Register Events for the SAP Calendar Control. The control supports the following events:

Event Name

Meaning

CTXMENU_REQUEST

Requesting a context menu with the right mouse button

CTXMENU_SELECTED

Choosing an option of the context menu

DATE_SELECTED

Selecting a date / date range

INFO_REQUEST

Scrolling beyond the area that was defined using method set_day_info

Destroying the controls

Controls are normally destroyed by Lifetime Management. However, if you want to destroy the controls manually in your program, you must proceed as follows:

  1. Destroy the calendar control at the frontend. If you do not need the control container any more, destroy it as well.

    CALL METHOD calendar->free.

  2. Delete the reference variable of the calender control:

    FREE calendar.