SAP K_CONTROL_RECORDS_READ Function Module for









K_CONTROL_RECORDS_READ is a standard k control records read 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 control records read FM, simply by entering the name K_CONTROL_RECORDS_READ into the relevant SAP transaction such as SE37 or SE38.

Function Group: KV20
Program Name: SAPLKV20
Main Program:
Appliation area: K
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function K_CONTROL_RECORDS_READ 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_CONTROL_RECORDS_READ'"
EXPORTING
PAR_TCODE = "Transaction code
* PAR_IDATE = "Date (last control record before ...)
* PAR_ITIME = "Time (last control record before ...)
* PAR_IPERI = "Period (last control record before ...)
* PAR_IYEAR = "Fiscal year (last control record before ...)
* PAR_KOKRS = "Controlling area
* PAR_WERKS = "Plant

IMPORTING
PAR_EDATE = "Date of last control record
PAR_ETIME = "Time of last control record
PAR_CNTCR = "Number of control records
PAR_EYEAR = "Period of last control record
PAR_EPERI = "Fiscal year of last control record

TABLES
* TAB_KKS021 = "Control record structure

EXCEPTIONS
NO_CONTROL_RECORD_FOUND = 1 WRONG_DATA_INPUT = 2
.



IMPORTING Parameters details for K_CONTROL_RECORDS_READ

PAR_TCODE - Transaction code

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

PAR_IDATE - Date (last control record before ...)

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

PAR_ITIME - Time (last control record before ...)

Data type: KKS02-UZEIT
Optional: Yes
Call by Reference: No ( called with pass by value option)

PAR_IPERI - Period (last control record before ...)

Data type: KKS02-POPER
Optional: Yes
Call by Reference: No ( called with pass by value option)

PAR_IYEAR - Fiscal year (last control record before ...)

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

PAR_KOKRS - Controlling area

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

PAR_WERKS - Plant

Data type: KKS00-WERKS
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for K_CONTROL_RECORDS_READ

PAR_EDATE - Date of last control record

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

PAR_ETIME - Time of last control record

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

PAR_CNTCR - Number of control records

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

PAR_EYEAR - Period of last control record

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

PAR_EPERI - Fiscal year of last control record

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

TABLES Parameters details for K_CONTROL_RECORDS_READ

TAB_KKS021 - Control record structure

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

EXCEPTIONS details

NO_CONTROL_RECORD_FOUND - No control record found

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

WRONG_DATA_INPUT - Wrong data input

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

Copy and paste ABAP code example for K_CONTROL_RECORDS_READ 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_par_edate  TYPE KKS02-DATUM, "   
lv_par_tcode  TYPE KKS00-TCODE, "   
lt_tab_kks021  TYPE STANDARD TABLE OF KKS02, "   
lv_no_control_record_found  TYPE KKS02, "   
lv_par_etime  TYPE KKS02-UZEIT, "   
lv_par_idate  TYPE KKS02-DATUM, "   
lv_wrong_data_input  TYPE KKS02, "   
lv_par_cntcr  TYPE SY-TABIX, "   
lv_par_itime  TYPE KKS02-UZEIT, "   
lv_par_eyear  TYPE KKS02-GJAHR, "   
lv_par_iperi  TYPE KKS02-POPER, "   
lv_par_eperi  TYPE KKS02-POPER, "   
lv_par_iyear  TYPE KKS02-GJAHR, "   
lv_par_kokrs  TYPE KKS00-KOKRS, "   
lv_par_werks  TYPE KKS00-WERKS. "   

  CALL FUNCTION 'K_CONTROL_RECORDS_READ'  "
    EXPORTING
         PAR_TCODE = lv_par_tcode
         PAR_IDATE = lv_par_idate
         PAR_ITIME = lv_par_itime
         PAR_IPERI = lv_par_iperi
         PAR_IYEAR = lv_par_iyear
         PAR_KOKRS = lv_par_kokrs
         PAR_WERKS = lv_par_werks
    IMPORTING
         PAR_EDATE = lv_par_edate
         PAR_ETIME = lv_par_etime
         PAR_CNTCR = lv_par_cntcr
         PAR_EYEAR = lv_par_eyear
         PAR_EPERI = lv_par_eperi
    TABLES
         TAB_KKS021 = lt_tab_kks021
    EXCEPTIONS
        NO_CONTROL_RECORD_FOUND = 1
        WRONG_DATA_INPUT = 2
. " K_CONTROL_RECORDS_READ




ABAP code using 7.40 inline data declarations to call FM K_CONTROL_RECORDS_READ

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 KKS02 INTO @DATA(ld_par_edate).
 
"SELECT single TCODE FROM KKS00 INTO @DATA(ld_par_tcode).
 
 
 
"SELECT single UZEIT FROM KKS02 INTO @DATA(ld_par_etime).
 
"SELECT single DATUM FROM KKS02 INTO @DATA(ld_par_idate).
 
 
"SELECT single TABIX FROM SY INTO @DATA(ld_par_cntcr).
 
"SELECT single UZEIT FROM KKS02 INTO @DATA(ld_par_itime).
 
"SELECT single GJAHR FROM KKS02 INTO @DATA(ld_par_eyear).
 
"SELECT single POPER FROM KKS02 INTO @DATA(ld_par_iperi).
 
"SELECT single POPER FROM KKS02 INTO @DATA(ld_par_eperi).
 
"SELECT single GJAHR FROM KKS02 INTO @DATA(ld_par_iyear).
 
"SELECT single KOKRS FROM KKS00 INTO @DATA(ld_par_kokrs).
 
"SELECT single WERKS FROM KKS00 INTO @DATA(ld_par_werks).
 


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!