SAP Function Modules

COPA_READ_CALCULATION SAP Function module







COPA_READ_CALCULATION is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name COPA_READ_CALCULATION into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: KEAC
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM COPA_READ_CALCULATION - COPA READ CALCULATION





CALL FUNCTION 'COPA_READ_CALCULATION' "
  EXPORTING
*   i_kalaw =                   " tkeva03-kalaw
    i_artnr =                   " cest1-artnr
    i_werks =                   " cest1-werks
*   i_bwtar =                   " keko-bwtar
*   i_kaufn =                   " cest1-kaufn
*   i_kdpos =                   " cest1-kdpos
*   i_budat = SY-DATUM          " cest1-budat
*   i_wadat =                   " cest1-wadat
*   i_bdatj =                   " keko-bdatj
*   i_poper =                   " keko-poper
*   i_kalpk =                   " tkeva03-kalpk
*   i_kadky =                   " keko-kadky
    i_klvar =                   " keko-klvar
    i_tvers =                   " keko-tvers
    i_kkzma =                   " keko-kkzma
    i_keart =                   " tkeva03-keart
    i_losfx =                   " tkeva03-losfx
    i_aufka =                   " tkeva03-aufka
*   i_paledger =                " cest1-paledger
  IMPORTING
    e_keko =                    " keko
    e_keph =                    " keph
  EXCEPTIONS
    CALC_ERROR = 1              "
    NO_CALC_FOUND = 2           "               No product cost estimate found
    SYSTEM_ERROR = 3            "
    .  "  COPA_READ_CALCULATION

ABAP code example for Function Module COPA_READ_CALCULATION





The ABAP code below is a full code listing to execute function module COPA_READ_CALCULATION including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_e_keko  TYPE KEKO ,
ld_e_keph  TYPE KEPH .


SELECT single KALAW
FROM TKEVA03
INTO @DATA(ld_i_kalaw).


DATA(ld_i_artnr) = some text here

DATA(ld_i_werks) = some text here

SELECT single BWTAR
FROM KEKO
INTO @DATA(ld_i_bwtar).


DATA(ld_i_kaufn) = some text here

DATA(ld_i_kdpos) = Check type of data required

DATA(ld_i_budat) = 20210129

DATA(ld_i_wadat) = 20210129

SELECT single BDATJ
FROM KEKO
INTO @DATA(ld_i_bdatj).


SELECT single POPER
FROM KEKO
INTO @DATA(ld_i_poper).


SELECT single KALPK
FROM TKEVA03
INTO @DATA(ld_i_kalpk).


SELECT single KADKY
FROM KEKO
INTO @DATA(ld_i_kadky).


SELECT single KLVAR
FROM KEKO
INTO @DATA(ld_i_klvar).


SELECT single TVERS
FROM KEKO
INTO @DATA(ld_i_tvers).


SELECT single KKZMA
FROM KEKO
INTO @DATA(ld_i_kkzma).


SELECT single KEART
FROM TKEVA03
INTO @DATA(ld_i_keart).


SELECT single LOSFX
FROM TKEVA03
INTO @DATA(ld_i_losfx).


SELECT single AUFKA
FROM TKEVA03
INTO @DATA(ld_i_aufka).


DATA(ld_i_paledger) = some text here . CALL FUNCTION 'COPA_READ_CALCULATION' EXPORTING * i_kalaw = ld_i_kalaw i_artnr = ld_i_artnr i_werks = ld_i_werks * i_bwtar = ld_i_bwtar * i_kaufn = ld_i_kaufn * i_kdpos = ld_i_kdpos * i_budat = ld_i_budat * i_wadat = ld_i_wadat * i_bdatj = ld_i_bdatj * i_poper = ld_i_poper * i_kalpk = ld_i_kalpk * i_kadky = ld_i_kadky i_klvar = ld_i_klvar i_tvers = ld_i_tvers i_kkzma = ld_i_kkzma i_keart = ld_i_keart i_losfx = ld_i_losfx i_aufka = ld_i_aufka * i_paledger = ld_i_paledger IMPORTING e_keko = ld_e_keko e_keph = ld_e_keph EXCEPTIONS CALC_ERROR = 1 NO_CALC_FOUND = 2 SYSTEM_ERROR = 3 . " COPA_READ_CALCULATION
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_e_keko  TYPE KEKO ,
ld_i_kalaw  TYPE TKEVA03-KALAW ,
ld_e_keph  TYPE KEPH ,
ld_i_artnr  TYPE CEST1-ARTNR ,
ld_i_werks  TYPE CEST1-WERKS ,
ld_i_bwtar  TYPE KEKO-BWTAR ,
ld_i_kaufn  TYPE CEST1-KAUFN ,
ld_i_kdpos  TYPE CEST1-KDPOS ,
ld_i_budat  TYPE CEST1-BUDAT ,
ld_i_wadat  TYPE CEST1-WADAT ,
ld_i_bdatj  TYPE KEKO-BDATJ ,
ld_i_poper  TYPE KEKO-POPER ,
ld_i_kalpk  TYPE TKEVA03-KALPK ,
ld_i_kadky  TYPE KEKO-KADKY ,
ld_i_klvar  TYPE KEKO-KLVAR ,
ld_i_tvers  TYPE KEKO-TVERS ,
ld_i_kkzma  TYPE KEKO-KKZMA ,
ld_i_keart  TYPE TKEVA03-KEART ,
ld_i_losfx  TYPE TKEVA03-LOSFX ,
ld_i_aufka  TYPE TKEVA03-AUFKA ,
ld_i_paledger  TYPE CEST1-PALEDGER .


SELECT single KALAW
FROM TKEVA03
INTO ld_i_kalaw.


ld_i_artnr = some text here

ld_i_werks = some text here

SELECT single BWTAR
FROM KEKO
INTO ld_i_bwtar.


ld_i_kaufn = some text here

ld_i_kdpos = Check type of data required

ld_i_budat = 20210129

ld_i_wadat = 20210129

SELECT single BDATJ
FROM KEKO
INTO ld_i_bdatj.


SELECT single POPER
FROM KEKO
INTO ld_i_poper.


SELECT single KALPK
FROM TKEVA03
INTO ld_i_kalpk.


SELECT single KADKY
FROM KEKO
INTO ld_i_kadky.


SELECT single KLVAR
FROM KEKO
INTO ld_i_klvar.


SELECT single TVERS
FROM KEKO
INTO ld_i_tvers.


SELECT single KKZMA
FROM KEKO
INTO ld_i_kkzma.


SELECT single KEART
FROM TKEVA03
INTO ld_i_keart.


SELECT single LOSFX
FROM TKEVA03
INTO ld_i_losfx.


SELECT single AUFKA
FROM TKEVA03
INTO ld_i_aufka.


ld_i_paledger = some text here

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name COPA_READ_CALCULATION or its description.