+ -

Pages

Saturday, July 26, 2014

Calling F4 help for date

DATA:
     l_select_date LIKE workflds-gkday,
     l_select_week LIKE scal-week.

Note: setting the optional select_week parameters enables the user to click on the week number of the pop-up calendar.

* Call pop up calendar - Note that the l_select_week is not used. The reason for
* using this variable, is only to allow the user also to select a whole week in the
* pop up calendar.
  CALL FUNCTION 'F4_DATE'
    EXPORTING
      date_for_first_month         = sy-datum
    IMPORTING
      select_date                  = l_select_date
      select_week                  = l_select_week
    EXCEPTIONS
      calendar_buffer_not_loadable = 1
      date_after_range             = 2
      date_before_range            = 3
      date_invalid                 = 4
      factory_calendar_not_found   = 5
      holiday_calendar_not_found   = 6
      parameter_conflict           = 7
      OTHERS                       = 8.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.


* Validate date - An invalid date is caused by using the cancel
* button on the calendar
  CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
    EXPORTING
      date                      = l_select_date
    EXCEPTIONS
      plausibility_check_failed = 1
      OTHERS                    = 2.
  IF sy-subrc <> 0.
*   User has cancelled the calendar
    EXIT.
  ENDIF.



5 ABAP Tips: Calling F4 help for date DATA: l_select_date LIKE workflds-gkday, l_select_week LIKE scal-week. Note: setting the optional select_week parameters enables...

No comments:

Post a Comment

< >