SAP K_PERIOD_CHECK_IN_KOKRS Function Module for Checks Validity of Periods and Determines Next/Previous Period









K_PERIOD_CHECK_IN_KOKRS is a standard k period check in kokrs SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Checks Validity of Periods and Determines Next/Previous Period 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 k period check in kokrs FM, simply by entering the name K_PERIOD_CHECK_IN_KOKRS into the relevant SAP transaction such as SE37 or SE38.

Function Group: KALL
Program Name: SAPLKALL
Main Program: SAPLKALL
Appliation area:
Release date: 02-Feb-1999
Mode(Normal, Remote etc): Normal Function Module
Update:



Function K_PERIOD_CHECK_IN_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_CHECK_IN_KOKRS'"Checks Validity of Periods and Determines Next/Previous Period
EXPORTING
I_PERIO = "Period
I_GJAHR = "Fiscal year
I_KOKRS = "Controlling area

IMPORTING
E_NEXT_PERIO = "Next period
E_NEXT_GJAHR = "Fiscal year for next period
E_PREVIOUS_PERIO = "Previous period
E_PREVIOUS_GJAHR = "Fiscal year for previous period
E_LAST_PERIO = "Last period in specified fiscal year

EXCEPTIONS
PERIOD_NOT_VALID = 1 KOKRS_NOT_FOUND = 2
.



IMPORTING Parameters details for K_PERIOD_CHECK_IN_KOKRS

I_PERIO - Period

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

I_GJAHR - Fiscal year

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

I_KOKRS - Controlling area

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

EXPORTING Parameters details for K_PERIOD_CHECK_IN_KOKRS

E_NEXT_PERIO - Next period

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

E_NEXT_GJAHR - Fiscal year for next period

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

E_PREVIOUS_PERIO - Previous period

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

E_PREVIOUS_GJAHR - Fiscal year for previous period

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

E_LAST_PERIO - Last period in specified fiscal year

Data type: AUAK-PERIO
Optional: No
Call by Reference: Yes

EXCEPTIONS details

PERIOD_NOT_VALID - Period not allowed in fiscal year variant

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

KOKRS_NOT_FOUND - Controlling area does not exist

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

Copy and paste ABAP code example for K_PERIOD_CHECK_IN_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_i_perio  TYPE AUAK-PERIO, "   
lv_e_next_perio  TYPE AUAK-PERIO, "   
lv_period_not_valid  TYPE AUAK, "   
lv_i_gjahr  TYPE AUAK-GJAHR, "   
lv_e_next_gjahr  TYPE AUAK-GJAHR, "   
lv_kokrs_not_found  TYPE AUAK, "   
lv_i_kokrs  TYPE TKA01-KOKRS, "   
lv_e_previous_perio  TYPE AUAK-PERIO, "   
lv_e_previous_gjahr  TYPE AUAK-GJAHR, "   
lv_e_last_perio  TYPE AUAK-PERIO. "   

  CALL FUNCTION 'K_PERIOD_CHECK_IN_KOKRS'  "Checks Validity of Periods and Determines Next/Previous Period
    EXPORTING
         I_PERIO = lv_i_perio
         I_GJAHR = lv_i_gjahr
         I_KOKRS = lv_i_kokrs
    IMPORTING
         E_NEXT_PERIO = lv_e_next_perio
         E_NEXT_GJAHR = lv_e_next_gjahr
         E_PREVIOUS_PERIO = lv_e_previous_perio
         E_PREVIOUS_GJAHR = lv_e_previous_gjahr
         E_LAST_PERIO = lv_e_last_perio
    EXCEPTIONS
        PERIOD_NOT_VALID = 1
        KOKRS_NOT_FOUND = 2
. " K_PERIOD_CHECK_IN_KOKRS




ABAP code using 7.40 inline data declarations to call FM K_PERIOD_CHECK_IN_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 PERIO FROM AUAK INTO @DATA(ld_i_perio).
 
"SELECT single PERIO FROM AUAK INTO @DATA(ld_e_next_perio).
 
 
"SELECT single GJAHR FROM AUAK INTO @DATA(ld_i_gjahr).
 
"SELECT single GJAHR FROM AUAK INTO @DATA(ld_e_next_gjahr).
 
 
"SELECT single KOKRS FROM TKA01 INTO @DATA(ld_i_kokrs).
 
"SELECT single PERIO FROM AUAK INTO @DATA(ld_e_previous_perio).
 
"SELECT single GJAHR FROM AUAK INTO @DATA(ld_e_previous_gjahr).
 
"SELECT single PERIO FROM AUAK INTO @DATA(ld_e_last_perio).
 


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!