SAP COPA_SPREAD_VALUE Function Module for









COPA_SPREAD_VALUE is a standard copa spread value 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 copa spread value FM, simply by entering the name COPA_SPREAD_VALUE into the relevant SAP transaction such as SE37 or SE38.

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



Function COPA_SPREAD_VALUE 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 'COPA_SPREAD_VALUE'"
EXPORTING
APERIO = "Starting period in the transfer ta
VALUE = "Value to be distributed
* CALCM = '1' "
* I_SPREADMULTI_USE = ' ' "
* COPA_EXTENSION = ' ' "Flag: Cross-year distribution seri
* DECIMALS = 0 "Number of places behind decimal po
* DECIMALS_ANDEC = -1 "
* ERRSUM0 = ' ' "
LENGTH = "Length of the P-fields OLDVALUE/NE
* PERFLAG = '1' "Period type indicator
PERIV = "Business annual variant
SPREAD_KEY = "Distribution key

TABLES
VALUES = "Value table

EXCEPTIONS
DECIMAL_OVERFLOW = 1 I_T821S_NOT_COPA = 10 SUM_SPREADKEY_EQ_0 = 11 SPREADMULTI_ALL_EQ_0 = 12 WEIGHT_SPREADVALUE_ALL_EQ_0 = 13 I_COPA_APERIO = 2 I_COPA_PERFLAG = 3 I_COPA_PERIV = 4 I_COPA_ZYKEL = 5 I_SPREADKEY_INVALID = 6 I_SPREADKEY_NOT_SPREAD = 7 I_T821S_COPA = 8 I_T821S_NOTFOUND = 9
.



IMPORTING Parameters details for COPA_SPREAD_VALUE

APERIO - Starting period in the transfer ta

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

VALUE - Value to be distributed

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

CALCM -

Data type: KPP0L-CALCM
Default: '1'
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_SPREADMULTI_USE -

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

COPA_EXTENSION - Flag: Cross-year distribution seri

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

DECIMALS - Number of places behind decimal po

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

DECIMALS_ANDEC -

Data type: T006-ANDEC
Default: -1
Optional: Yes
Call by Reference: No ( called with pass by value option)

ERRSUM0 -

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

LENGTH - Length of the P-fields OLDVALUE/NE

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

PERFLAG - Period type indicator

Data type: T821S-PERFLAG
Default: '1'
Optional: Yes
Call by Reference: No ( called with pass by value option)

PERIV - Business annual variant

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

SPREAD_KEY - Distribution key

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

TABLES Parameters details for COPA_SPREAD_VALUE

VALUES - Value table

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

EXCEPTIONS details

DECIMAL_OVERFLOW - Decimal place overflow 505

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

I_T821S_NOT_COPA - VTL not intended for use in COPA 5

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

SUM_SPREADKEY_EQ_0 -

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

SPREADMULTI_ALL_EQ_0 -

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

WEIGHT_SPREADVALUE_ALL_EQ_0 -

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

I_COPA_APERIO - Starting period in VTL not defined

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

I_COPA_PERFLAG - Period type indicators do not matc

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

I_COPA_PERIV - Fiscal year variants do not match

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

I_COPA_ZYKEL - Time pattern weeks cannot be cycli

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

I_SPREADKEY_INVALID - Distribution key not defined 501

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

I_SPREADKEY_NOT_SPREAD - VTL references input aid 502

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

I_T821S_COPA - VTL only intended for use in COPA

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

I_T821S_NOTFOUND - VTL in table T821S not defined 506

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

Copy and paste ABAP code example for COPA_SPREAD_VALUE 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_aperio  TYPE T821S-APERIO, "   
lt_values  TYPE STANDARD TABLE OF CEPFV, "   
lv_decimal_overflow  TYPE CEPFV, "   
lv_value  TYPE CEPFV, "   
lv_i_t821s_not_copa  TYPE CEPFV, "   
lv_calcm  TYPE KPP0L-CALCM, "   '1'
lv_sum_spreadkey_eq_0  TYPE KPP0L, "   
lv_i_spreadmulti_use  TYPE KPP1L-XFELD, "   SPACE
lv_spreadmulti_all_eq_0  TYPE KPP1L, "   
lv_weight_spreadvalue_all_eq_0  TYPE KPP1L, "   
lv_i_copa_aperio  TYPE KPP1L, "   
lv_copa_extension  TYPE KPP1L, "   SPACE
lv_decimals  TYPE KPP1L, "   0
lv_i_copa_perflag  TYPE KPP1L, "   
lv_i_copa_periv  TYPE KPP1L, "   
lv_decimals_andec  TYPE T006-ANDEC, "   -1
lv_errsum0  TYPE T006, "   ' '
lv_i_copa_zykel  TYPE T006, "   
lv_length  TYPE T006, "   
lv_i_spreadkey_invalid  TYPE T006, "   
lv_perflag  TYPE T821S-PERFLAG, "   '1'
lv_i_spreadkey_not_spread  TYPE T821S, "   
lv_periv  TYPE T821S-PERIV, "   
lv_i_t821s_copa  TYPE T821S, "   
lv_spread_key  TYPE T821S-SPRED, "   
lv_i_t821s_notfound  TYPE T821S. "   

  CALL FUNCTION 'COPA_SPREAD_VALUE'  "
    EXPORTING
         APERIO = lv_aperio
         VALUE = lv_value
         CALCM = lv_calcm
         I_SPREADMULTI_USE = lv_i_spreadmulti_use
         COPA_EXTENSION = lv_copa_extension
         DECIMALS = lv_decimals
         DECIMALS_ANDEC = lv_decimals_andec
         ERRSUM0 = lv_errsum0
         LENGTH = lv_length
         PERFLAG = lv_perflag
         PERIV = lv_periv
         SPREAD_KEY = lv_spread_key
    TABLES
         VALUES = lt_values
    EXCEPTIONS
        DECIMAL_OVERFLOW = 1
        I_T821S_NOT_COPA = 10
        SUM_SPREADKEY_EQ_0 = 11
        SPREADMULTI_ALL_EQ_0 = 12
        WEIGHT_SPREADVALUE_ALL_EQ_0 = 13
        I_COPA_APERIO = 2
        I_COPA_PERFLAG = 3
        I_COPA_PERIV = 4
        I_COPA_ZYKEL = 5
        I_SPREADKEY_INVALID = 6
        I_SPREADKEY_NOT_SPREAD = 7
        I_T821S_COPA = 8
        I_T821S_NOTFOUND = 9
. " COPA_SPREAD_VALUE




ABAP code using 7.40 inline data declarations to call FM COPA_SPREAD_VALUE

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 APERIO FROM T821S INTO @DATA(ld_aperio).
 
 
 
 
 
"SELECT single CALCM FROM KPP0L INTO @DATA(ld_calcm).
DATA(ld_calcm) = '1'.
 
 
"SELECT single XFELD FROM KPP1L INTO @DATA(ld_i_spreadmulti_use).
DATA(ld_i_spreadmulti_use) = ' '.
 
 
 
 
DATA(ld_copa_extension) = ' '.
 
 
 
 
"SELECT single ANDEC FROM T006 INTO @DATA(ld_decimals_andec).
DATA(ld_decimals_andec) = -1.
 
DATA(ld_errsum0) = ' '.
 
 
 
 
"SELECT single PERFLAG FROM T821S INTO @DATA(ld_perflag).
DATA(ld_perflag) = '1'.
 
 
"SELECT single PERIV FROM T821S INTO @DATA(ld_periv).
 
 
"SELECT single SPRED FROM T821S INTO @DATA(ld_spread_key).
 
 


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!