Working With the SAP Calendar Control

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 flow

The source code sections are examples that do not always use the full range of functions available. For more information, always see the reference part of this documentation.

You can find sample programs SAPCALENDAR_DEMO1 and SAPCALENDAR_NAVIGATOR in the system.


  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

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

    Event name



    Requesting a context menu with the right mouse button


    Choosing an option of the context menu


    Selecting a date / date range


    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:

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

  6. Delete the reference variable of the calender control:

FREE calendar.