SAP F4_DATE Function Module for Display factory calendar or Gregor. calendar and choose a day
F4_DATE is a standard f4 date 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 FM, simply by entering the name F4_DATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: SHLC
Program Name: SAPLSHLC
Main Program: SAPLSHLC
Appliation area: M
Release date: 11-Jan-1999
Mode(Normal, Remote etc): Normal Function Module
Update:
Function F4_DATE 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'"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
* DISPLAY = ' ' "X = no selection option
* FACTORY_CALENDAR_ID = ' ' "Factory calendar
* GREGORIAN_CALENDAR_FLAG = ' ' "Display Gregorian calendar
* HOLIDAY_CALENDAR_ID = ' ' "Public Holiday Calendar
* PROGNAME_FOR_FIRST_MONTH = ' ' "to determine the date at the cursor position
IMPORTING
SELECT_DATE = "selected date
SELECT_WEEK = "
SELECT_WEEK_BEGIN = "
SELECT_WEEK_END = "
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
DATE_FOR_FIRST_MONTH - For determining the first month to be displayed
Data type: WORKFLDS-GKDAYDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
DISPLAY - X = no selection option
Data type: WORKFLDS-DISPLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FACTORY_CALENDAR_ID - Factory calendar
Data type: WORKFLDS-CALIDDefault: 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-HIDENTDefault: SPACE
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-REPIDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for F4_DATE
SELECT_DATE - selected date
Data type: WORKFLDS-GKDAYOptional: No
Call by Reference: No ( called with pass by value option)
SELECT_WEEK -
Data type: SCAL-WEEKOptional: No
Call by Reference: No ( called with pass by value option)
SELECT_WEEK_BEGIN -
Data type: SY-DATUMOptional: No
Call by Reference: No ( called with pass by value option)
SELECT_WEEK_END -
Data type: SY-DATUMOptional: 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 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_display | TYPE WORKFLDS-DISPL, " SPACE | |||
lv_select_week | TYPE SCAL-WEEK, " | |||
lv_date_after_range | TYPE SCAL, " | |||
lv_date_before_range | TYPE SCAL, " | |||
lv_select_week_begin | TYPE SY-DATUM, " | |||
lv_factory_calendar_id | TYPE WORKFLDS-CALID, " SPACE | |||
lv_date_invalid | TYPE WORKFLDS, " | |||
lv_select_week_end | TYPE SY-DATUM, " | |||
lv_gregorian_calendar_flag | TYPE SY, " SPACE | |||
lv_holiday_calendar_id | TYPE WORKFLDS-HIDENT, " SPACE | |||
lv_factory_calendar_not_found | TYPE WORKFLDS, " | |||
lv_progname_for_first_month | TYPE SY-REPID, " SPACE | |||
lv_holiday_calendar_not_found | TYPE SY, " | |||
lv_parameter_conflict | TYPE SY. " |
  CALL FUNCTION 'F4_DATE' "Display factory calendar or Gregor. calendar and choose a day |
EXPORTING | ||
DATE_FOR_FIRST_MONTH | = lv_date_for_first_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 | |
PROGNAME_FOR_FIRST_MONTH | = lv_progname_for_first_month | |
IMPORTING | ||
SELECT_DATE | = lv_select_date | |
SELECT_WEEK | = lv_select_week | |
SELECT_WEEK_BEGIN | = lv_select_week_begin | |
SELECT_WEEK_END | = lv_select_week_end | |
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 |
ABAP code using 7.40 inline data declarations to call FM F4_DATE
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_display). | ||||
DATA(ld_display) | = ' '. | |||
"SELECT single WEEK FROM SCAL INTO @DATA(ld_select_week). | ||||
"SELECT single DATUM FROM SY INTO @DATA(ld_select_week_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_week_end). | ||||
DATA(ld_gregorian_calendar_flag) | = ' '. | |||
"SELECT single HIDENT FROM WORKFLDS INTO @DATA(ld_holiday_calendar_id). | ||||
DATA(ld_holiday_calendar_id) | = ' '. | |||
"SELECT single REPID FROM SY INTO @DATA(ld_progname_for_first_month). | ||||
DATA(ld_progname_for_first_month) | = ' '. | |||
Search for further information about these or an SAP related objects