SAP K_VARIANCE_KEY_GET Function Module for
K_VARIANCE_KEY_GET is a standard k variance key get 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 variance key get FM, simply by entering the name K_VARIANCE_KEY_GET 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:
![](https://www.se80.co.uk/training-education/wp-content/uploads/2019/07/normal-function-module.png)
Function K_VARIANCE_KEY_GET 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_VARIANCE_KEY_GET'".
EXPORTING
* PAR_AWOBA = CON_AWOBA-OR "
PAR_AWSLS = "
* PAR_SPRAS = SY-LANGU "
IMPORTING
PAR_AWDEG = "
PAR_AWEAB = "
PAR_AWEAU = "
PAR_AWEPS = "
PAR_AWESO = "
PAR_AWESP = "
PAR_AWEWP = "
PAR_AWKUM = "
PAR_AWSTX = "
EXCEPTIONS
KEY_NOT_FOUND = 1 OBJECT_TYPE_INVALID = 2
IMPORTING Parameters details for K_VARIANCE_KEY_GET
PAR_AWOBA -
Data type: TKV02-AWOBADefault: CON_AWOBA-OR
Optional: Yes
Call by Reference: No ( called with pass by value option)
PAR_AWSLS -
Data type: TKV02-AWSLSOptional: No
Call by Reference: No ( called with pass by value option)
PAR_SPRAS -
Data type: TKV02-SPRASDefault: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for K_VARIANCE_KEY_GET
PAR_AWDEG -
Data type: TKV01-AWDEGOptional: No
Call by Reference: No ( called with pass by value option)
PAR_AWEAB -
Data type: TKV01-AWEABOptional: No
Call by Reference: No ( called with pass by value option)
PAR_AWEAU -
Data type: TKV01-AWEAUOptional: No
Call by Reference: No ( called with pass by value option)
PAR_AWEPS -
Data type: TKV01-AWEPSOptional: No
Call by Reference: No ( called with pass by value option)
PAR_AWESO -
Data type: TKV01-AWESOOptional: No
Call by Reference: No ( called with pass by value option)
PAR_AWESP -
Data type: TKV01-AWESPOptional: No
Call by Reference: No ( called with pass by value option)
PAR_AWEWP -
Data type: TKV01-AWEWPOptional: No
Call by Reference: No ( called with pass by value option)
PAR_AWKUM -
Data type: TKV01-AWKUMOptional: No
Call by Reference: No ( called with pass by value option)
PAR_AWSTX -
Data type: TKV02-AWSTXOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
KEY_NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OBJECT_TYPE_INVALID -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_VARIANCE_KEY_GET 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_awdeg | TYPE TKV01-AWDEG, " | |||
lv_par_awoba | TYPE TKV02-AWOBA, " CON_AWOBA-OR | |||
lv_key_not_found | TYPE TKV02, " | |||
lv_par_aweab | TYPE TKV01-AWEAB, " | |||
lv_par_awsls | TYPE TKV02-AWSLS, " | |||
lv_object_type_invalid | TYPE TKV02, " | |||
lv_par_aweau | TYPE TKV01-AWEAU, " | |||
lv_par_spras | TYPE TKV02-SPRAS, " SY-LANGU | |||
lv_par_aweps | TYPE TKV01-AWEPS, " | |||
lv_par_aweso | TYPE TKV01-AWESO, " | |||
lv_par_awesp | TYPE TKV01-AWESP, " | |||
lv_par_awewp | TYPE TKV01-AWEWP, " | |||
lv_par_awkum | TYPE TKV01-AWKUM, " | |||
lv_par_awstx | TYPE TKV02-AWSTX. " |
  CALL FUNCTION 'K_VARIANCE_KEY_GET' " |
EXPORTING | ||
PAR_AWOBA | = lv_par_awoba | |
PAR_AWSLS | = lv_par_awsls | |
PAR_SPRAS | = lv_par_spras | |
IMPORTING | ||
PAR_AWDEG | = lv_par_awdeg | |
PAR_AWEAB | = lv_par_aweab | |
PAR_AWEAU | = lv_par_aweau | |
PAR_AWEPS | = lv_par_aweps | |
PAR_AWESO | = lv_par_aweso | |
PAR_AWESP | = lv_par_awesp | |
PAR_AWEWP | = lv_par_awewp | |
PAR_AWKUM | = lv_par_awkum | |
PAR_AWSTX | = lv_par_awstx | |
EXCEPTIONS | ||
KEY_NOT_FOUND = 1 | ||
OBJECT_TYPE_INVALID = 2 | ||
. " K_VARIANCE_KEY_GET |
ABAP code using 7.40 inline data declarations to call FM K_VARIANCE_KEY_GET
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 AWDEG FROM TKV01 INTO @DATA(ld_par_awdeg). | ||||
"SELECT single AWOBA FROM TKV02 INTO @DATA(ld_par_awoba). | ||||
DATA(ld_par_awoba) | = CON_AWOBA-OR. | |||
"SELECT single AWEAB FROM TKV01 INTO @DATA(ld_par_aweab). | ||||
"SELECT single AWSLS FROM TKV02 INTO @DATA(ld_par_awsls). | ||||
"SELECT single AWEAU FROM TKV01 INTO @DATA(ld_par_aweau). | ||||
"SELECT single SPRAS FROM TKV02 INTO @DATA(ld_par_spras). | ||||
DATA(ld_par_spras) | = SY-LANGU. | |||
"SELECT single AWEPS FROM TKV01 INTO @DATA(ld_par_aweps). | ||||
"SELECT single AWESO FROM TKV01 INTO @DATA(ld_par_aweso). | ||||
"SELECT single AWESP FROM TKV01 INTO @DATA(ld_par_awesp). | ||||
"SELECT single AWEWP FROM TKV01 INTO @DATA(ld_par_awewp). | ||||
"SELECT single AWKUM FROM TKV01 INTO @DATA(ld_par_awkum). | ||||
"SELECT single AWSTX FROM TKV02 INTO @DATA(ld_par_awstx). | ||||
Search for further information about these or an SAP related objects