SAP K_PERIOD_GET_FOR_DATE_KOKRS Function Module for
K_PERIOD_GET_FOR_DATE_KOKRS is a standard k period get for date kokrs SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 k period get for date kokrs FM, simply by entering the name K_PERIOD_GET_FOR_DATE_KOKRS into the relevant SAP transaction such as SE37 or SE38.
Function Group: KPTL
Program Name: SAPLKPTL
Main Program: SAPLKPTL
Appliation area: K
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function K_PERIOD_GET_FOR_DATE_KOKRS 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 'K_PERIOD_GET_FOR_DATE_KOKRS'".
EXPORTING
KOKRS = "
* DATE = SY-DATLO "
IMPORTING
PERIO = "
GJAHR = "
ANZBP = "
ANZSP = "
LMONA = "
BEGDA = "
ENDDA = "
EXCEPTIONS
KOKRS_NOT_FOUND = 1 DATE_INVALID = 2
IMPORTING Parameters details for K_PERIOD_GET_FOR_DATE_KOKRS
KOKRS -
Data type: TKA01-KOKRSOptional: No
Call by Reference: No ( called with pass by value option)
DATE -
Data type: SY-DATUMDefault: SY-DATLO
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for K_PERIOD_GET_FOR_DATE_KOKRS
PERIO -
Data type: T009B-POPEROptional: No
Call by Reference: No ( called with pass by value option)
GJAHR -
Data type: CSSL-GJAHROptional: No
Call by Reference: No ( called with pass by value option)
ANZBP -
Data type: T009-ANZBPOptional: No
Call by Reference: No ( called with pass by value option)
ANZSP -
Data type: T009-ANZSPOptional: No
Call by Reference: No ( called with pass by value option)
LMONA -
Data type: TKA01-LMONAOptional: No
Call by Reference: No ( called with pass by value option)
BEGDA -
Data type: SY-DATUMOptional: No
Call by Reference: No ( called with pass by value option)
ENDDA -
Data type: SY-DATUMOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
KOKRS_NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DATE_INVALID -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_PERIOD_GET_FOR_DATE_KOKRS 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_kokrs | TYPE TKA01-KOKRS, " | |||
| lv_perio | TYPE T009B-POPER, " | |||
| lv_kokrs_not_found | TYPE T009B, " | |||
| lv_date | TYPE SY-DATUM, " SY-DATLO | |||
| lv_gjahr | TYPE CSSL-GJAHR, " | |||
| lv_date_invalid | TYPE CSSL, " | |||
| lv_anzbp | TYPE T009-ANZBP, " | |||
| lv_anzsp | TYPE T009-ANZSP, " | |||
| lv_lmona | TYPE TKA01-LMONA, " | |||
| lv_begda | TYPE SY-DATUM, " | |||
| lv_endda | TYPE SY-DATUM. " |
|   CALL FUNCTION 'K_PERIOD_GET_FOR_DATE_KOKRS' " |
| EXPORTING | ||
| KOKRS | = lv_kokrs | |
| DATE | = lv_date | |
| IMPORTING | ||
| PERIO | = lv_perio | |
| GJAHR | = lv_gjahr | |
| ANZBP | = lv_anzbp | |
| ANZSP | = lv_anzsp | |
| LMONA | = lv_lmona | |
| BEGDA | = lv_begda | |
| ENDDA | = lv_endda | |
| EXCEPTIONS | ||
| KOKRS_NOT_FOUND = 1 | ||
| DATE_INVALID = 2 | ||
| . " K_PERIOD_GET_FOR_DATE_KOKRS | ||
ABAP code using 7.40 inline data declarations to call FM K_PERIOD_GET_FOR_DATE_KOKRS
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 KOKRS FROM TKA01 INTO @DATA(ld_kokrs). | ||||
| "SELECT single POPER FROM T009B INTO @DATA(ld_perio). | ||||
| "SELECT single DATUM FROM SY INTO @DATA(ld_date). | ||||
| DATA(ld_date) | = SY-DATLO. | |||
| "SELECT single GJAHR FROM CSSL INTO @DATA(ld_gjahr). | ||||
| "SELECT single ANZBP FROM T009 INTO @DATA(ld_anzbp). | ||||
| "SELECT single ANZSP FROM T009 INTO @DATA(ld_anzsp). | ||||
| "SELECT single LMONA FROM TKA01 INTO @DATA(ld_lmona). | ||||
| "SELECT single DATUM FROM SY INTO @DATA(ld_begda). | ||||
| "SELECT single DATUM FROM SY INTO @DATA(ld_endda). | ||||
Search for further information about these or an SAP related objects