SAP Function Modules

K_ABC_COST_ELEMENTS_READ SAP Function module







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

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


Pattern for FM K_ABC_COST_ELEMENTS_READ - K ABC COST ELEMENTS READ





CALL FUNCTION 'K_ABC_COST_ELEMENTS_READ' "
  EXPORTING
    kokrs =                     " ccss-kokrs
    objnr =                     " aufk-objnr    Order Number
*   lednr = '00'                " ccss-lednr    Ledger for Controlling objects
    gjahr =                     " ccss-gjahr    Fiscal Year
    versn =                     " ccss-versn    Version
    wrttp =                     " ccss-wrttp    Value Type
*   beknz = 'S'                 " ccss-beknz    Charge Indicator
    mengen_typ =                " abc_f4_structure-quan_type
*   kstar =                     " ccss-kstar
*   kstar_group =               " rkpln-kagru
*   ktopl = SPACE               " ccss-ktopl
*   calc_type = 1               " abc_f4_structure-calc_type  CO-OM-ABC: Data Element for Possible Entries, Calc. Type
    period_from =               "               Initial Period
    period_cnt =                "               Number of Periods
    call_prog =                 " sy-repid
  TABLES
    rtable_val =                " tplic_rval_tab
    .  "  K_ABC_COST_ELEMENTS_READ

ABAP code example for Function Module K_ABC_COST_ELEMENTS_READ





The ABAP code below is a full code listing to execute function module K_ABC_COST_ELEMENTS_READ 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:
it_rtable_val  TYPE STANDARD TABLE OF TPLIC_RVAL_TAB,"TABLES PARAM
wa_rtable_val  LIKE LINE OF it_rtable_val .


DATA(ld_kokrs) = some text here

SELECT single OBJNR
FROM AUFK
INTO @DATA(ld_objnr).


DATA(ld_lednr) = some text here

DATA(ld_gjahr) = Check type of data required

DATA(ld_versn) = some text here

DATA(ld_wrttp) = some text here

DATA(ld_beknz) = some text here

DATA(ld_mengen_typ) = some text here

DATA(ld_kstar) = some text here

DATA(ld_kstar_group) = some text here

DATA(ld_ktopl) = some text here

DATA(ld_calc_type) = some text here
DATA(ld_period_from) = 'some text here'.
DATA(ld_period_cnt) = 'some text here'.
DATA(ld_call_prog) = '20210129'.

"populate fields of struture and append to itab
append wa_rtable_val to it_rtable_val. . CALL FUNCTION 'K_ABC_COST_ELEMENTS_READ' EXPORTING kokrs = ld_kokrs objnr = ld_objnr * lednr = ld_lednr gjahr = ld_gjahr versn = ld_versn wrttp = ld_wrttp * beknz = ld_beknz mengen_typ = ld_mengen_typ * kstar = ld_kstar * kstar_group = ld_kstar_group * ktopl = ld_ktopl * calc_type = ld_calc_type period_from = ld_period_from period_cnt = ld_period_cnt call_prog = ld_call_prog TABLES rtable_val = it_rtable_val . " K_ABC_COST_ELEMENTS_READ
IF SY-SUBRC EQ 0. "All OK 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_kokrs  TYPE CCSS-KOKRS ,
it_rtable_val  TYPE STANDARD TABLE OF TPLIC_RVAL_TAB ,
wa_rtable_val  LIKE LINE OF it_rtable_val,
ld_objnr  TYPE AUFK-OBJNR ,
ld_lednr  TYPE CCSS-LEDNR ,
ld_gjahr  TYPE CCSS-GJAHR ,
ld_versn  TYPE CCSS-VERSN ,
ld_wrttp  TYPE CCSS-WRTTP ,
ld_beknz  TYPE CCSS-BEKNZ ,
ld_mengen_typ  TYPE ABC_F4_STRUCTURE-QUAN_TYPE ,
ld_kstar  TYPE CCSS-KSTAR ,
ld_kstar_group  TYPE RKPLN-KAGRU ,
ld_ktopl  TYPE CCSS-KTOPL ,
ld_calc_type  TYPE ABC_F4_STRUCTURE-CALC_TYPE ,
ld_period_from  TYPE STRING ,
ld_period_cnt  TYPE STRING ,
ld_call_prog  TYPE SY-REPID .


ld_kokrs = some text here

"populate fields of struture and append to itab
append wa_rtable_val to it_rtable_val.

SELECT single OBJNR
FROM AUFK
INTO ld_objnr.


ld_lednr = some text here

ld_gjahr = Check type of data required

ld_versn = some text here

ld_wrttp = some text here

ld_beknz = some text here

ld_mengen_typ = some text here

ld_kstar = some text here

ld_kstar_group = some text here

ld_ktopl = some text here

ld_calc_type = some text here
ld_period_from = 'some text here'.
ld_period_cnt = 'some text here'.
ld_call_prog = '20210129'.

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