SAP Function Modules

COPCA_ACTIVE_PLAN SAP Function module







COPCA_ACTIVE_PLAN 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 COPCA_ACTIVE_PLAN into the relevant SAP transaction such as SE37 or SE80.

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


Pattern for FM COPCA_ACTIVE_PLAN - COPCA ACTIVE PLAN





CALL FUNCTION 'COPCA_ACTIVE_PLAN' "
  EXPORTING
    gjahr =                     " tka00-gjahr
    kokrs =                     " tka00-kokrs
    pcrch =                     " tka00-pcrch
    rvers =                     " t895pca-rvers
  IMPORTING
    epskz =                     " t895pca-epskz
    lmona =                     " tka01-lmona
    onlkz =                     " t895pca-onlkz
    pcacur =                    " tka01-pcacur
    pcacurtp =                  " tka01-pcacurtp
    pcatrcur =                  " tka01-pcatrcur
    vspkz =                     " t895pca-vspkz
    pcbel =                     " tka01-pcbel
    dprct =                     " tka01-dprct
    kurst =                     " t895pca-kurst
    pldat =                     " t895pca-pldat
    variant =                   " t895pca-variant
    pca_valu =                  " tka01-pca_valu
  EXCEPTIONS
    COPCA_NOT_ACTIVE = 1        "
    KOKRS_NOT_FOUND = 2         "
    WRONG_PARAMETER_PCRCH = 3   "
    WRONG_VERSION = 4           "
    WRONG_VERSION_MISSING_YEAR = 5  "
    NO_CURRENCY_FOUND = 6       "
    .  "  COPCA_ACTIVE_PLAN

ABAP code example for Function Module COPCA_ACTIVE_PLAN





The ABAP code below is a full code listing to execute function module COPCA_ACTIVE_PLAN 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_epskz  TYPE T895PCA-EPSKZ ,
ld_lmona  TYPE TKA01-LMONA ,
ld_onlkz  TYPE T895PCA-ONLKZ ,
ld_pcacur  TYPE TKA01-PCACUR ,
ld_pcacurtp  TYPE TKA01-PCACURTP ,
ld_pcatrcur  TYPE TKA01-PCATRCUR ,
ld_vspkz  TYPE T895PCA-VSPKZ ,
ld_pcbel  TYPE TKA01-PCBEL ,
ld_dprct  TYPE TKA01-DPRCT ,
ld_kurst  TYPE T895PCA-KURST ,
ld_pldat  TYPE T895PCA-PLDAT ,
ld_variant  TYPE T895PCA-VARIANT ,
ld_pca_valu  TYPE TKA01-PCA_VALU .


SELECT single GJAHR
FROM TKA00
INTO @DATA(ld_gjahr).


SELECT single KOKRS
FROM TKA00
INTO @DATA(ld_kokrs).


SELECT single PCRCH
FROM TKA00
INTO @DATA(ld_pcrch).


SELECT single RVERS
FROM T895PCA
INTO @DATA(ld_rvers).
. CALL FUNCTION 'COPCA_ACTIVE_PLAN' EXPORTING gjahr = ld_gjahr kokrs = ld_kokrs pcrch = ld_pcrch rvers = ld_rvers IMPORTING epskz = ld_epskz lmona = ld_lmona onlkz = ld_onlkz pcacur = ld_pcacur pcacurtp = ld_pcacurtp pcatrcur = ld_pcatrcur vspkz = ld_vspkz pcbel = ld_pcbel dprct = ld_dprct kurst = ld_kurst pldat = ld_pldat variant = ld_variant pca_valu = ld_pca_valu EXCEPTIONS COPCA_NOT_ACTIVE = 1 KOKRS_NOT_FOUND = 2 WRONG_PARAMETER_PCRCH = 3 WRONG_VERSION = 4 WRONG_VERSION_MISSING_YEAR = 5 NO_CURRENCY_FOUND = 6 . " COPCA_ACTIVE_PLAN
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 ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "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_epskz  TYPE T895PCA-EPSKZ ,
ld_gjahr  TYPE TKA00-GJAHR ,
ld_lmona  TYPE TKA01-LMONA ,
ld_kokrs  TYPE TKA00-KOKRS ,
ld_onlkz  TYPE T895PCA-ONLKZ ,
ld_pcrch  TYPE TKA00-PCRCH ,
ld_pcacur  TYPE TKA01-PCACUR ,
ld_rvers  TYPE T895PCA-RVERS ,
ld_pcacurtp  TYPE TKA01-PCACURTP ,
ld_pcatrcur  TYPE TKA01-PCATRCUR ,
ld_vspkz  TYPE T895PCA-VSPKZ ,
ld_pcbel  TYPE TKA01-PCBEL ,
ld_dprct  TYPE TKA01-DPRCT ,
ld_kurst  TYPE T895PCA-KURST ,
ld_pldat  TYPE T895PCA-PLDAT ,
ld_variant  TYPE T895PCA-VARIANT ,
ld_pca_valu  TYPE TKA01-PCA_VALU .


SELECT single GJAHR
FROM TKA00
INTO ld_gjahr.


SELECT single KOKRS
FROM TKA00
INTO ld_kokrs.


SELECT single PCRCH
FROM TKA00
INTO ld_pcrch.


SELECT single RVERS
FROM T895PCA
INTO ld_rvers.

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 COPCA_ACTIVE_PLAN or its description.