SAP Function Modules

K_TRANSACTION_BASICCOSTS_READ SAP Function module







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

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


Pattern for FM K_TRANSACTION_BASICCOSTS_READ - K TRANSACTION BASICCOSTS READ





CALL FUNCTION 'K_TRANSACTION_BASICCOSTS_READ' "
  EXPORTING
*   par_awkab = SPACE           " kv042-xfeld   No settlement debits
    par_awkum =                 " tkv01-awkum   Cumulation
    par_awvsb =                 " tkv09-awvsb   Reference version
*   par_awwtb = '04'            " tkv09-awwtb   Reference value type
    par_gjahr1 =                " t009b-bdatj   Fiscal Year From
*   par_gjahr2 = 0              " t009b-bdatj   Fiscal Year To
    par_kokrs =                 " tkv09-kokrs   Controlling area
    par_objnr =                 " kv011-objnr   Object number
    par_poper1 =                " t009b-poper   Posting Period From
*   par_poper2 = 0              " t009b-poper   Posting Period To
*   par_slkom = SPACE           " kv042-xfeld   Key complete
*   par_vsall = 'X'             " kv042-xfeld
  TABLES
    pta_kv012 =                 " kv012         Control Costs
    pta_kv011 =                 " kv011         Reference Output Quantities
    pta_kv0122 =                " kv012         Transaction control costs
    pta_vrgng =                 " kv041         Transaction
  EXCEPTIONS
    BASICCOSTS_IMPOSSIBLE = 1   "               Not possible to calculate control costs
    SYSTEM_ERROR = 2            "               System error
    .  "  K_TRANSACTION_BASICCOSTS_READ

ABAP code example for Function Module K_TRANSACTION_BASICCOSTS_READ





The ABAP code below is a full code listing to execute function module K_TRANSACTION_BASICCOSTS_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_pta_kv012  TYPE STANDARD TABLE OF KV012,"TABLES PARAM
wa_pta_kv012  LIKE LINE OF it_pta_kv012 ,
it_pta_kv011  TYPE STANDARD TABLE OF KV011,"TABLES PARAM
wa_pta_kv011  LIKE LINE OF it_pta_kv011 ,
it_pta_kv0122  TYPE STANDARD TABLE OF KV012,"TABLES PARAM
wa_pta_kv0122  LIKE LINE OF it_pta_kv0122 ,
it_pta_vrgng  TYPE STANDARD TABLE OF KV041,"TABLES PARAM
wa_pta_vrgng  LIKE LINE OF it_pta_vrgng .


DATA(ld_par_awkab) = some text here

SELECT single AWKUM
FROM TKV01
INTO @DATA(ld_par_awkum).


SELECT single AWVSB
FROM TKV09
INTO @DATA(ld_par_awvsb).


SELECT single AWWTB
FROM TKV09
INTO @DATA(ld_par_awwtb).


SELECT single BDATJ
FROM T009B
INTO @DATA(ld_par_gjahr1).


SELECT single BDATJ
FROM T009B
INTO @DATA(ld_par_gjahr2).


SELECT single KOKRS
FROM TKV09
INTO @DATA(ld_par_kokrs).


DATA(ld_par_objnr) = some text here

SELECT single POPER
FROM T009B
INTO @DATA(ld_par_poper1).


SELECT single POPER
FROM T009B
INTO @DATA(ld_par_poper2).


DATA(ld_par_slkom) = some text here

DATA(ld_par_vsall) = some text here

"populate fields of struture and append to itab
append wa_pta_kv012 to it_pta_kv012.

"populate fields of struture and append to itab
append wa_pta_kv011 to it_pta_kv011.

"populate fields of struture and append to itab
append wa_pta_kv0122 to it_pta_kv0122.

"populate fields of struture and append to itab
append wa_pta_vrgng to it_pta_vrgng. . CALL FUNCTION 'K_TRANSACTION_BASICCOSTS_READ' EXPORTING * par_awkab = ld_par_awkab par_awkum = ld_par_awkum par_awvsb = ld_par_awvsb * par_awwtb = ld_par_awwtb par_gjahr1 = ld_par_gjahr1 * par_gjahr2 = ld_par_gjahr2 par_kokrs = ld_par_kokrs par_objnr = ld_par_objnr par_poper1 = ld_par_poper1 * par_poper2 = ld_par_poper2 * par_slkom = ld_par_slkom * par_vsall = ld_par_vsall TABLES pta_kv012 = it_pta_kv012 pta_kv011 = it_pta_kv011 pta_kv0122 = it_pta_kv0122 pta_vrgng = it_pta_vrgng EXCEPTIONS BASICCOSTS_IMPOSSIBLE = 1 SYSTEM_ERROR = 2 . " K_TRANSACTION_BASICCOSTS_READ
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 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_par_awkab  TYPE KV042-XFELD ,
it_pta_kv012  TYPE STANDARD TABLE OF KV012 ,
wa_pta_kv012  LIKE LINE OF it_pta_kv012,
ld_par_awkum  TYPE TKV01-AWKUM ,
it_pta_kv011  TYPE STANDARD TABLE OF KV011 ,
wa_pta_kv011  LIKE LINE OF it_pta_kv011,
ld_par_awvsb  TYPE TKV09-AWVSB ,
it_pta_kv0122  TYPE STANDARD TABLE OF KV012 ,
wa_pta_kv0122  LIKE LINE OF it_pta_kv0122,
ld_par_awwtb  TYPE TKV09-AWWTB ,
it_pta_vrgng  TYPE STANDARD TABLE OF KV041 ,
wa_pta_vrgng  LIKE LINE OF it_pta_vrgng,
ld_par_gjahr1  TYPE T009B-BDATJ ,
ld_par_gjahr2  TYPE T009B-BDATJ ,
ld_par_kokrs  TYPE TKV09-KOKRS ,
ld_par_objnr  TYPE KV011-OBJNR ,
ld_par_poper1  TYPE T009B-POPER ,
ld_par_poper2  TYPE T009B-POPER ,
ld_par_slkom  TYPE KV042-XFELD ,
ld_par_vsall  TYPE KV042-XFELD .


ld_par_awkab = some text here

"populate fields of struture and append to itab
append wa_pta_kv012 to it_pta_kv012.

SELECT single AWKUM
FROM TKV01
INTO ld_par_awkum.


"populate fields of struture and append to itab
append wa_pta_kv011 to it_pta_kv011.

SELECT single AWVSB
FROM TKV09
INTO ld_par_awvsb.


"populate fields of struture and append to itab
append wa_pta_kv0122 to it_pta_kv0122.

SELECT single AWWTB
FROM TKV09
INTO ld_par_awwtb.


"populate fields of struture and append to itab
append wa_pta_vrgng to it_pta_vrgng.

SELECT single BDATJ
FROM T009B
INTO ld_par_gjahr1.


SELECT single BDATJ
FROM T009B
INTO ld_par_gjahr2.


SELECT single KOKRS
FROM TKV09
INTO ld_par_kokrs.


ld_par_objnr = some text here

SELECT single POPER
FROM T009B
INTO ld_par_poper1.


SELECT single POPER
FROM T009B
INTO ld_par_poper2.


ld_par_slkom = some text here

ld_par_vsall = 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 K_TRANSACTION_BASICCOSTS_READ or its description.