SAP K_COSTING_VARIANT_GET_INS Function Module for









K_COSTING_VARIANT_GET_INS is a standard k costing variant get ins 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 costing variant get ins FM, simply by entering the name K_COSTING_VARIANT_GET_INS into the relevant SAP transaction such as SE37 or SE38.

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



Function K_COSTING_VARIANT_GET_INS 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_COSTING_VARIANT_GET_INS'"
EXPORTING
* AUFRUFMODUS = '0' "Functionality of the module: 1=Ref 2=oRef 3=Kop
* VBELN = ' ' "
* POSNR = '000000' "
* EXTNR = ' ' "
BZOBJ = "Reference object (for validation of KLVAR)
* KLVAR = ' ' "Proposed costing variant
* KOKRS = ' ' "KOKRS of the BZOBJ to be calculated
* MATNR = ' ' "
* MEEHT = ' ' "Unit of measure of the costing quantity
* MENGE_IMP = 1000 "Proposed quantity
* WERKS = ' ' "
* VERSN = '000' "

IMPORTING
ALLE_POSITIONEN_KOPIEREN = "Indicator: 'X'=No sel. screen during copying
KCV_KLVAR = "Costing variant
KCV_MENGE_EXP = "Export quantity
KCV_REF_KHS1 = "Header of the reference calculation
ER_REF_COST_ESTIMATE = "

TABLES
* KCV_REF_KIS1_EXP = "

EXCEPTIONS
MODUS_NOT_FOUND = 1 OBJECT_NOT_FOUND = 2 OBJECT_NO_INPUT = 3 POPUP_CANCELLED = 4
.



IMPORTING Parameters details for K_COSTING_VARIANT_GET_INS

AUFRUFMODUS - Functionality of the module: 1=Ref 2=oRef 3=Kop

Data type: CHAR1
Default: '0'
Optional: Yes
Call by Reference: No ( called with pass by value option)

VBELN -

Data type: RK70_KKEA-VBELN
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

POSNR -

Data type: RK70_KKEA-POSNR
Default: '000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTNR -

Data type: RK70_KKEA-EXTNR
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

BZOBJ - Reference object (for validation of KLVAR)

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

KLVAR - Proposed costing variant

Data type: TCK03-KLVAR
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

KOKRS - KOKRS of the BZOBJ to be calculated

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

MATNR -

Data type: MARA-MATNR
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

MEEHT - Unit of measure of the costing quantity

Data type: CKHS-MEEHT
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

MENGE_IMP - Proposed quantity

Data type: CKHS-MENGE
Default: 1000
Optional: Yes
Call by Reference: No ( called with pass by value option)

WERKS -

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

VERSN -

Data type: RK70K-VERSN
Default: '000'
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for K_COSTING_VARIANT_GET_INS

ALLE_POSITIONEN_KOPIEREN - Indicator: 'X'=No sel. screen during copying

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

KCV_KLVAR - Costing variant

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

KCV_MENGE_EXP - Export quantity

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

KCV_REF_KHS1 - Header of the reference calculation

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

ER_REF_COST_ESTIMATE -

Data type: CL_COST_ESTIMATE
Optional: No
Call by Reference: Yes

TABLES Parameters details for K_COSTING_VARIANT_GET_INS

KCV_REF_KIS1_EXP -

Data type: KIS1
Optional: Yes
Call by Reference: Yes

EXCEPTIONS details

MODUS_NOT_FOUND - Invalid call mode (valid values: 1,2,3)

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

OBJECT_NOT_FOUND - Reference object not found for costing

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

OBJECT_NO_INPUT - No entry for reference object

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

POPUP_CANCELLED - Popup was cancelled

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

Copy and paste ABAP code example for K_COSTING_VARIANT_GET_INS 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_aufrufmodus  TYPE CHAR1, "   '0'
lv_modus_not_found  TYPE CHAR1, "   
lt_kcv_ref_kis1_exp  TYPE STANDARD TABLE OF KIS1, "   
lv_alle_positionen_kopieren  TYPE CHAR1, "   
lv_vbeln  TYPE RK70_KKEA-VBELN, "   SPACE
lv_posnr  TYPE RK70_KKEA-POSNR, "   '000000'
lv_extnr  TYPE RK70_KKEA-EXTNR, "   SPACE
lv_bzobj  TYPE TCK12-BZOBJ, "   
lv_kcv_klvar  TYPE TCK03-KLVAR, "   
lv_object_not_found  TYPE TCK03, "   
lv_klvar  TYPE TCK03-KLVAR, "   SPACE
lv_kcv_menge_exp  TYPE CKHS-MENGE, "   
lv_object_no_input  TYPE CKHS, "   
lv_kokrs  TYPE CKBS-KOKRS, "   SPACE
lv_kcv_ref_khs1  TYPE KHS1, "   
lv_popup_cancelled  TYPE KHS1, "   
lv_matnr  TYPE MARA-MATNR, "   SPACE
lv_er_ref_cost_estimate  TYPE CL_COST_ESTIMATE, "   
lv_meeht  TYPE CKHS-MEEHT, "   SPACE
lv_menge_imp  TYPE CKHS-MENGE, "   1000
lv_werks  TYPE T001W-WERKS, "   SPACE
lv_versn  TYPE RK70K-VERSN. "   '000'

  CALL FUNCTION 'K_COSTING_VARIANT_GET_INS'  "
    EXPORTING
         AUFRUFMODUS = lv_aufrufmodus
         VBELN = lv_vbeln
         POSNR = lv_posnr
         EXTNR = lv_extnr
         BZOBJ = lv_bzobj
         KLVAR = lv_klvar
         KOKRS = lv_kokrs
         MATNR = lv_matnr
         MEEHT = lv_meeht
         MENGE_IMP = lv_menge_imp
         WERKS = lv_werks
         VERSN = lv_versn
    IMPORTING
         ALLE_POSITIONEN_KOPIEREN = lv_alle_positionen_kopieren
         KCV_KLVAR = lv_kcv_klvar
         KCV_MENGE_EXP = lv_kcv_menge_exp
         KCV_REF_KHS1 = lv_kcv_ref_khs1
         ER_REF_COST_ESTIMATE = lv_er_ref_cost_estimate
    TABLES
         KCV_REF_KIS1_EXP = lt_kcv_ref_kis1_exp
    EXCEPTIONS
        MODUS_NOT_FOUND = 1
        OBJECT_NOT_FOUND = 2
        OBJECT_NO_INPUT = 3
        POPUP_CANCELLED = 4
. " K_COSTING_VARIANT_GET_INS




ABAP code using 7.40 inline data declarations to call FM K_COSTING_VARIANT_GET_INS

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.

DATA(ld_aufrufmodus) = '0'.
 
 
 
 
"SELECT single VBELN FROM RK70_KKEA INTO @DATA(ld_vbeln).
DATA(ld_vbeln) = ' '.
 
"SELECT single POSNR FROM RK70_KKEA INTO @DATA(ld_posnr).
DATA(ld_posnr) = '000000'.
 
"SELECT single EXTNR FROM RK70_KKEA INTO @DATA(ld_extnr).
DATA(ld_extnr) = ' '.
 
"SELECT single BZOBJ FROM TCK12 INTO @DATA(ld_bzobj).
 
"SELECT single KLVAR FROM TCK03 INTO @DATA(ld_kcv_klvar).
 
 
"SELECT single KLVAR FROM TCK03 INTO @DATA(ld_klvar).
DATA(ld_klvar) = ' '.
 
"SELECT single MENGE FROM CKHS INTO @DATA(ld_kcv_menge_exp).
 
 
"SELECT single KOKRS FROM CKBS INTO @DATA(ld_kokrs).
DATA(ld_kokrs) = ' '.
 
 
 
"SELECT single MATNR FROM MARA INTO @DATA(ld_matnr).
DATA(ld_matnr) = ' '.
 
 
"SELECT single MEEHT FROM CKHS INTO @DATA(ld_meeht).
DATA(ld_meeht) = ' '.
 
"SELECT single MENGE FROM CKHS INTO @DATA(ld_menge_imp).
DATA(ld_menge_imp) = 1000.
 
"SELECT single WERKS FROM T001W INTO @DATA(ld_werks).
DATA(ld_werks) = ' '.
 
"SELECT single VERSN FROM RK70K INTO @DATA(ld_versn).
DATA(ld_versn) = '000'.
 


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!