SAP F4_DATE_CONTROL Function Module for Display factory calendar or Gregor. calendar and choose a day









F4_DATE_CONTROL is a standard f4 date control SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Display factory calendar or Gregor. calendar and choose a day processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for f4 date control FM, simply by entering the name F4_DATE_CONTROL into the relevant SAP transaction such as SE37 or SE38.

Function Group: SCAC
Program Name: SAPLSCAC
Main Program: SAPLSCAC
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function F4_DATE_CONTROL pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'F4_DATE_CONTROL'"Display factory calendar or Gregor. calendar and choose a day
EXPORTING
* DATE_FOR_FIRST_MONTH = SY-DATUM "For determining the first month to be displayed
* SELECT_OPTION_MONTH = ' ' "
* DISPLAY = ' ' "X = no selection option
* FACTORY_CALENDAR_ID = ' ' "Factory Calendar
* GREGORIAN_CALENDAR_FLAG = ' ' "Display Gregorian calendar
* HOLIDAY_CALENDAR_ID = ' ' "Public Holiday Calendar
* HOLIDAY_STYLE = '6' "
* PROGNAME_FOR_FIRST_MONTH = ' ' "to determine the date at the cursor position
* WEEK_BEGIN_DAY = 1 "
* SELECT_OPTION_WEEK = ' ' "

IMPORTING
SELECT_DATE = "selected date
SELECT_WEEK = "
SELECT_BEGIN = "
SELECT_END = "
SELECT_MONTH = "Selected month

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
.



IMPORTING Parameters details for F4_DATE_CONTROL

DATE_FOR_FIRST_MONTH - For determining the first month to be displayed

Data type: WORKFLDS-GKDAY
Default: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)

SELECT_OPTION_MONTH -

Data type: WORKFLDS-DISPL
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

DISPLAY - X = no selection option

Data type: WORKFLDS-DISPL
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

FACTORY_CALENDAR_ID - Factory Calendar

Data type: WORKFLDS-CALID
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

GREGORIAN_CALENDAR_FLAG - Display Gregorian calendar

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

HOLIDAY_CALENDAR_ID - Public Holiday Calendar

Data type: WORKFLDS-HIDENT
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

HOLIDAY_STYLE -

Data type: I
Default: '6'
Optional: Yes
Call by Reference: No ( called with pass by value option)

PROGNAME_FOR_FIRST_MONTH - to determine the date at the cursor position

Data type: SY-REPID
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

WEEK_BEGIN_DAY -

Data type: T246-WOTNR
Default: 1
Optional: Yes
Call by Reference: No ( called with pass by value option)

SELECT_OPTION_WEEK -

Data type: WORKFLDS-DISPL
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for F4_DATE_CONTROL

SELECT_DATE - selected date

Data type: WORKFLDS-GKDAY
Optional: No
Call by Reference: No ( called with pass by value option)

SELECT_WEEK -

Data type: SCAL-WEEK
Optional: No
Call by Reference: No ( called with pass by value option)

SELECT_BEGIN -

Data type: SY-DATUM
Optional: No
Call by Reference: No ( called with pass by value option)

SELECT_END -

Data type: SY-DATUM
Optional: No
Call by Reference: No ( called with pass by value option)

SELECT_MONTH - Selected month

Data type: SCAL-WEEK
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

CALENDAR_BUFFER_NOT_LOADABLE - Factory calendar read error

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

DATE_AFTER_RANGE - Date is later than factory calendar

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

DATE_BEFORE_RANGE - Date is earlier than factory calendar's

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

DATE_INVALID - Date in invalid format

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

FACTORY_CALENDAR_NOT_FOUND - Factory calendar is not available

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

HOLIDAY_CALENDAR_NOT_FOUND - Holiday calendar is not available

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

PARAMETER_CONFLICT - Pass Factory calendar and Holiday calendar

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for F4_DATE_CONTROL Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lv_select_date  TYPE WORKFLDS-GKDAY, "   
lv_date_for_first_month  TYPE WORKFLDS-GKDAY, "   SY-DATUM
lv_calendar_buffer_not_loadable  TYPE WORKFLDS, "   
lv_select_option_month  TYPE WORKFLDS-DISPL, "   SPACE
lv_display  TYPE WORKFLDS-DISPL, "   SPACE
lv_select_week  TYPE SCAL-WEEK, "   
lv_date_after_range  TYPE SCAL, "   
lv_select_begin  TYPE SY-DATUM, "   
lv_date_before_range  TYPE SY, "   
lv_factory_calendar_id  TYPE WORKFLDS-CALID, "   SPACE
lv_select_end  TYPE SY-DATUM, "   
lv_date_invalid  TYPE SY, "   
lv_gregorian_calendar_flag  TYPE SY, "   SPACE
lv_select_month  TYPE SCAL-WEEK, "   
lv_holiday_calendar_id  TYPE WORKFLDS-HIDENT, "   SPACE
lv_factory_calendar_not_found  TYPE WORKFLDS, "   
lv_holiday_style  TYPE I, "   '6'
lv_holiday_calendar_not_found  TYPE I, "   
lv_parameter_conflict  TYPE I, "   
lv_progname_for_first_month  TYPE SY-REPID, "   SPACE
lv_week_begin_day  TYPE T246-WOTNR, "   1
lv_select_option_week  TYPE WORKFLDS-DISPL. "   SPACE

  CALL FUNCTION 'F4_DATE_CONTROL'  "Display factory calendar or Gregor. calendar and choose a day
    EXPORTING
         DATE_FOR_FIRST_MONTH = lv_date_for_first_month
         SELECT_OPTION_MONTH = lv_select_option_month
         DISPLAY = lv_display
         FACTORY_CALENDAR_ID = lv_factory_calendar_id
         GREGORIAN_CALENDAR_FLAG = lv_gregorian_calendar_flag
         HOLIDAY_CALENDAR_ID = lv_holiday_calendar_id
         HOLIDAY_STYLE = lv_holiday_style
         PROGNAME_FOR_FIRST_MONTH = lv_progname_for_first_month
         WEEK_BEGIN_DAY = lv_week_begin_day
         SELECT_OPTION_WEEK = lv_select_option_week
    IMPORTING
         SELECT_DATE = lv_select_date
         SELECT_WEEK = lv_select_week
         SELECT_BEGIN = lv_select_begin
         SELECT_END = lv_select_end
         SELECT_MONTH = lv_select_month
    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
. " F4_DATE_CONTROL




ABAP code using 7.40 inline data declarations to call FM F4_DATE_CONTROL

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

"SELECT single GKDAY FROM WORKFLDS INTO @DATA(ld_select_date).
 
"SELECT single GKDAY FROM WORKFLDS INTO @DATA(ld_date_for_first_month).
DATA(ld_date_for_first_month) = SY-DATUM.
 
 
"SELECT single DISPL FROM WORKFLDS INTO @DATA(ld_select_option_month).
DATA(ld_select_option_month) = ' '.
 
"SELECT single DISPL FROM WORKFLDS INTO @DATA(ld_display).
DATA(ld_display) = ' '.
 
"SELECT single WEEK FROM SCAL INTO @DATA(ld_select_week).
 
 
"SELECT single DATUM FROM SY INTO @DATA(ld_select_begin).
 
 
"SELECT single CALID FROM WORKFLDS INTO @DATA(ld_factory_calendar_id).
DATA(ld_factory_calendar_id) = ' '.
 
"SELECT single DATUM FROM SY INTO @DATA(ld_select_end).
 
 
DATA(ld_gregorian_calendar_flag) = ' '.
 
"SELECT single WEEK FROM SCAL INTO @DATA(ld_select_month).
 
"SELECT single HIDENT FROM WORKFLDS INTO @DATA(ld_holiday_calendar_id).
DATA(ld_holiday_calendar_id) = ' '.
 
 
DATA(ld_holiday_style) = '6'.
 
 
 
"SELECT single REPID FROM SY INTO @DATA(ld_progname_for_first_month).
DATA(ld_progname_for_first_month) = ' '.
 
"SELECT single WOTNR FROM T246 INTO @DATA(ld_week_begin_day).
DATA(ld_week_begin_day) = 1.
 
"SELECT single DISPL FROM WORKFLDS INTO @DATA(ld_select_option_week).
DATA(ld_select_option_week) = ' '.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!