Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

DATE_SELECTED event of CL_GUI_CALENDAR not working

Former Member
0 Kudos

Hey folks,

I have created a several "view" classes to encapsulate all object oriented stuff related to my Dynpros.

In one of them I create a CL_GUI_CUSTOM_CONTAINER and a CL_GUI_CALENDAR inside of it.

Although I have followed all the guides and docs I have found on the web, I can't seem to get the event triggering working.

The view class looks as follows:


CLASS zcl_test_view_main DEFINITION

  PUBLIC

  FINAL

  CREATE PUBLIC.

  PUBLIC SECTION.

    METHODS constructor.

    METHODS on_date_selected FOR EVENT date_selected OF cl_gui_calendar

      IMPORTING date_begin

                date_end.

  PROTECTED SECTION.

  PRIVATE SECTION.

    DATA o_calendar           TYPE REF TO cl_gui_calendar.

    DATA o_calendar_container TYPE REF TO cl_gui_custom_container.

ENDCLASS.

CLASS zcl_test_view_main IMPLEMENTATION.

  METHOD constructor.

    IF me->o_calendar_container IS INITIAL.

      CREATE OBJECT me->o_calendar_container

        EXPORTING

          container_name = 'C_CALENDAR'.

    ENDIF.

    IF me->o_calendar_from IS INITIAL.

      DATA style    TYPE i.

      DATA events   TYPE cntl_simple_events.

      DATA event    LIKE LINE OF ievents.

      event-appl_event = 'X'.

      event-eventid = cl_gui_calendar=>m_id_date_selected.

      APPEND event TO events.

      style = cnca_sel_month.

      CREATE OBJECT me->o_calendar

        EXPORTING

          parent          = me->o_calendar_container

          selection_style = style

          view_style      = cnca_style_dtpicker

          dtpicker_format = 'yyy / MMMM'.

      me->o_calendar->set_registered_events( events = events ).

      SET HANDLER me->on_date_selected FOR me->o_calendar.

    ENDIF.

  ENDMETHOD.

  METHOD on_date_selected.

    MESSAGE 'TEST' TYPE 'I'.

    MESSAGE date_begin TYPE 'I'.

    MESSAGE date_end TYPE 'I'.

  ENDMETHOD.

ENDCLASS.

The month picker is being displayed correctly but the event just does not fire once i change the date. I have already changed the appl_event property but nothing changed.

I hope someone can find the mistake.

Thanks in advance!

1 REPLY 1

Former Member
0 Kudos

It's me again,

just to let you know: I found out the problem is caused by the


view_style      = cnca_style_dtpicker


I just don't know, whether this is a known issue, if I am doing something wrong or if there is a workaround. The date is not even being set (no value when I try to access it using get_selection in my PAI).

Please help me, I'm going crazy!

Thanks, David