SAP DETERMINE_PERIOD Function Module for Determine a posting period from the date
DETERMINE_PERIOD is a standard determine period SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Determine a posting period from the date 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 determine period FM, simply by entering the name DETERMINE_PERIOD into the relevant SAP transaction such as SE37 or SE38.
Function Group: F011
Program Name: SAPLF011
Main Program: SAPLF011
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function DETERMINE_PERIOD 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 'DETERMINE_PERIOD'"Determine a posting period from the date.
EXPORTING
DATE = "
* PERIOD_IN = '000' "Possible entered special period
VERSION = "
IMPORTING
PERIOD = "
YEAR = "
EXCEPTIONS
PERIOD_IN_NOT_VALID = 1 PERIOD_NOT_ASSIGNED = 2 VERSION_UNDEFINED = 3
IMPORTING Parameters details for DETERMINE_PERIOD
DATE -
Data type: SY-DATUMOptional: No
Call by Reference: No ( called with pass by value option)
PERIOD_IN - Possible entered special period
Data type:Default: '000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
VERSION -
Data type: T001-PERIVOptional: No
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for DETERMINE_PERIOD
PERIOD -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
YEAR -
Data type: T009B-BDATJOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
PERIOD_IN_NOT_VALID - Entered special period is not allo
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
PERIOD_NOT_ASSIGNED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
VERSION_UNDEFINED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for DETERMINE_PERIOD 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_date | TYPE SY-DATUM, " | |||
| lv_period | TYPE SY, " | |||
| lv_period_in_not_valid | TYPE SY, " | |||
| lv_year | TYPE T009B-BDATJ, " | |||
| lv_period_in | TYPE T009B, " '000' | |||
| lv_period_not_assigned | TYPE T009B, " | |||
| lv_version | TYPE T001-PERIV, " | |||
| lv_version_undefined | TYPE T001. " |
|   CALL FUNCTION 'DETERMINE_PERIOD' "Determine a posting period from the date |
| EXPORTING | ||
| DATE | = lv_date | |
| PERIOD_IN | = lv_period_in | |
| VERSION | = lv_version | |
| IMPORTING | ||
| PERIOD | = lv_period | |
| YEAR | = lv_year | |
| EXCEPTIONS | ||
| PERIOD_IN_NOT_VALID = 1 | ||
| PERIOD_NOT_ASSIGNED = 2 | ||
| VERSION_UNDEFINED = 3 | ||
| . " DETERMINE_PERIOD | ||
ABAP code using 7.40 inline data declarations to call FM DETERMINE_PERIOD
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 DATUM FROM SY INTO @DATA(ld_date). | ||||
| "SELECT single BDATJ FROM T009B INTO @DATA(ld_year). | ||||
| DATA(ld_period_in) | = '000'. | |||
| "SELECT single PERIV FROM T001 INTO @DATA(ld_version). | ||||
Search for further information about these or an SAP related objects