SAP K_PLANVERSION_COPY Function Module for









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

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



Function K_PLANVERSION_COPY 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_PLANVERSION_COPY'"
EXPORTING
KOKRS = "Controlling area
* X_COST = "Cost element planning
* X_ERLOESE = "Revenues
* X_GESAMT = "Overall values
* X_EINZKALK = "Unit costing
* X_NO_CHANGE = 'X' "Do not change existing target data
* X_STATKZ = "Statistical key figures
* X_DETAIL = "
* V_GJAHR = "Fiscal year (model)
* V_FROM_PERIOD = "From period (model)
* V_TO_PERIOD = "To period (model)
* Z_GJAHR = "Fiscal year (target)
* Z_FROM_PERIOD = "From period (target)
* Z_TO_PERIOD = "To period (target)
V_VERSN = "Version (model)
Z_VERSN = "Version (target)

IMPORTING
DATA_COPIED = "Data copied or deleted

TABLES
T_OBJNR = "Object numbers
* T_COIOB = "COIOB for RWIN (only for unit costing)

EXCEPTIONS
INVALID_PARAMETERS = 1
.



IMPORTING Parameters details for K_PLANVERSION_COPY

KOKRS - Controlling area

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

X_COST - Cost element planning

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

X_ERLOESE - Revenues

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

X_GESAMT - Overall values

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

X_EINZKALK - Unit costing

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

X_NO_CHANGE - Do not change existing target data

Data type: BPDY-V_NO_CHANG
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

X_STATKZ - Statistical key figures

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

X_DETAIL -

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

V_GJAHR - Fiscal year (model)

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

V_FROM_PERIOD - From period (model)

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

V_TO_PERIOD - To period (model)

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

Z_GJAHR - Fiscal year (target)

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

Z_FROM_PERIOD - From period (target)

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

Z_TO_PERIOD - To period (target)

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

V_VERSN - Version (model)

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

Z_VERSN - Version (target)

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

EXPORTING Parameters details for K_PLANVERSION_COPY

DATA_COPIED - Data copied or deleted

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

TABLES Parameters details for K_PLANVERSION_COPY

T_OBJNR - Object numbers

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

T_COIOB - COIOB for RWIN (only for unit costing)

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

EXCEPTIONS details

INVALID_PARAMETERS - Invalid input parameter

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

Copy and paste ABAP code example for K_PLANVERSION_COPY 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 COBK-KOKRS, "   
lt_t_objnr  TYPE STANDARD TABLE OF IONRB, "   
lv_data_copied  TYPE BPDY-V_COST, "   
lv_invalid_parameters  TYPE BPDY, "   
lv_x_cost  TYPE BPDY-V_COST, "   
lv_x_erloese  TYPE BPDY-V_ERLOESE, "   
lv_x_gesamt  TYPE BPDY-V_GESAMT, "   
lv_x_einzkalk  TYPE BPDY-V_EINZKALK, "   
lv_x_no_change  TYPE BPDY-V_NO_CHANG, "   'X'
lv_x_statkz  TYPE BPDY-V_COST, "   
lv_x_detail  TYPE BPDY-V_COST, "   
lt_t_coiob  TYPE STANDARD TABLE OF COIOB, "   
lv_v_gjahr  TYPE COSP-GJAHR, "   
lv_v_from_period  TYPE COBK-PERAB, "   
lv_v_to_period  TYPE COBK-PERBI, "   
lv_z_gjahr  TYPE COSP-GJAHR, "   
lv_z_from_period  TYPE COBK-PERAB, "   
lv_z_to_period  TYPE COBK-PERBI, "   
lv_v_versn  TYPE COSP-VERSN, "   
lv_z_versn  TYPE COSP-VERSN. "   

  CALL FUNCTION 'K_PLANVERSION_COPY'  "
    EXPORTING
         KOKRS = lv_kokrs
         X_COST = lv_x_cost
         X_ERLOESE = lv_x_erloese
         X_GESAMT = lv_x_gesamt
         X_EINZKALK = lv_x_einzkalk
         X_NO_CHANGE = lv_x_no_change
         X_STATKZ = lv_x_statkz
         X_DETAIL = lv_x_detail
         V_GJAHR = lv_v_gjahr
         V_FROM_PERIOD = lv_v_from_period
         V_TO_PERIOD = lv_v_to_period
         Z_GJAHR = lv_z_gjahr
         Z_FROM_PERIOD = lv_z_from_period
         Z_TO_PERIOD = lv_z_to_period
         V_VERSN = lv_v_versn
         Z_VERSN = lv_z_versn
    IMPORTING
         DATA_COPIED = lv_data_copied
    TABLES
         T_OBJNR = lt_t_objnr
         T_COIOB = lt_t_coiob
    EXCEPTIONS
        INVALID_PARAMETERS = 1
. " K_PLANVERSION_COPY




ABAP code using 7.40 inline data declarations to call FM K_PLANVERSION_COPY

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 COBK INTO @DATA(ld_kokrs).
 
 
"SELECT single V_COST FROM BPDY INTO @DATA(ld_data_copied).
 
 
"SELECT single V_COST FROM BPDY INTO @DATA(ld_x_cost).
 
"SELECT single V_ERLOESE FROM BPDY INTO @DATA(ld_x_erloese).
 
"SELECT single V_GESAMT FROM BPDY INTO @DATA(ld_x_gesamt).
 
"SELECT single V_EINZKALK FROM BPDY INTO @DATA(ld_x_einzkalk).
 
"SELECT single V_NO_CHANG FROM BPDY INTO @DATA(ld_x_no_change).
DATA(ld_x_no_change) = 'X'.
 
"SELECT single V_COST FROM BPDY INTO @DATA(ld_x_statkz).
 
"SELECT single V_COST FROM BPDY INTO @DATA(ld_x_detail).
 
 
"SELECT single GJAHR FROM COSP INTO @DATA(ld_v_gjahr).
 
"SELECT single PERAB FROM COBK INTO @DATA(ld_v_from_period).
 
"SELECT single PERBI FROM COBK INTO @DATA(ld_v_to_period).
 
"SELECT single GJAHR FROM COSP INTO @DATA(ld_z_gjahr).
 
"SELECT single PERAB FROM COBK INTO @DATA(ld_z_from_period).
 
"SELECT single PERBI FROM COBK INTO @DATA(ld_z_to_period).
 
"SELECT single VERSN FROM COSP INTO @DATA(ld_v_versn).
 
"SELECT single VERSN FROM COSP INTO @DATA(ld_z_versn).
 


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!