SAP Function Modules

KA01_CALCULATE_COMPONENT SAP Function module







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

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


Pattern for FM KA01_CALCULATE_COMPONENT - KA01 CALCULATE COMPONENT





CALL FUNCTION 'KA01_CALCULATE_COMPONENT' "
  EXPORTING
    i_afvgd =                   " afvgdget
    i_resb =                    " resbdget
    i_klvar =                   " caufvd-klvarp
    i_auart =                   " caufvd-auart
    i_autyp =                   " caufvd-autyp
    i_aufnr =                   " caufvd-aufnr
    i_smsg_initialize =         " sy-uzeit
    i_kwaer =                   " tka01-waers
    i_posted =                  " i
  TABLES
    t_kalktab_resb =            " ckkalktab
    t_coeja =                   " coeja
    t_co_object =               " ck_co_object_itab
  EXCEPTIONS
    VALUATION_ERROR = 1         "
    .  "  KA01_CALCULATE_COMPONENT

ABAP code example for Function Module KA01_CALCULATE_COMPONENT





The ABAP code below is a full code listing to execute function module KA01_CALCULATE_COMPONENT 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_t_kalktab_resb  TYPE STANDARD TABLE OF CKKALKTAB,"TABLES PARAM
wa_t_kalktab_resb  LIKE LINE OF it_t_kalktab_resb ,
it_t_coeja  TYPE STANDARD TABLE OF COEJA,"TABLES PARAM
wa_t_coeja  LIKE LINE OF it_t_coeja ,
it_t_co_object  TYPE STANDARD TABLE OF CK_CO_OBJECT_ITAB,"TABLES PARAM
wa_t_co_object  LIKE LINE OF it_t_co_object .

DATA(ld_i_afvgd) = 'Check type of data required'.
DATA(ld_i_resb) = 'Check type of data required'.

DATA(ld_i_klvar) = some text here

DATA(ld_i_auart) = some text here

DATA(ld_i_autyp) = Check type of data required

DATA(ld_i_aufnr) = some text here
DATA(ld_i_smsg_initialize) = 'Check type of data required'.

SELECT single WAERS
FROM TKA01
INTO @DATA(ld_i_kwaer).

DATA(ld_i_posted) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_kalktab_resb to it_t_kalktab_resb.

"populate fields of struture and append to itab
append wa_t_coeja to it_t_coeja.

"populate fields of struture and append to itab
append wa_t_co_object to it_t_co_object. . CALL FUNCTION 'KA01_CALCULATE_COMPONENT' EXPORTING i_afvgd = ld_i_afvgd i_resb = ld_i_resb i_klvar = ld_i_klvar i_auart = ld_i_auart i_autyp = ld_i_autyp i_aufnr = ld_i_aufnr i_smsg_initialize = ld_i_smsg_initialize i_kwaer = ld_i_kwaer i_posted = ld_i_posted TABLES t_kalktab_resb = it_t_kalktab_resb t_coeja = it_t_coeja t_co_object = it_t_co_object EXCEPTIONS VALUATION_ERROR = 1 . " KA01_CALCULATE_COMPONENT
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "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_i_afvgd  TYPE AFVGDGET ,
it_t_kalktab_resb  TYPE STANDARD TABLE OF CKKALKTAB ,
wa_t_kalktab_resb  LIKE LINE OF it_t_kalktab_resb,
ld_i_resb  TYPE RESBDGET ,
it_t_coeja  TYPE STANDARD TABLE OF COEJA ,
wa_t_coeja  LIKE LINE OF it_t_coeja,
ld_i_klvar  TYPE CAUFVD-KLVARP ,
it_t_co_object  TYPE STANDARD TABLE OF CK_CO_OBJECT_ITAB ,
wa_t_co_object  LIKE LINE OF it_t_co_object,
ld_i_auart  TYPE CAUFVD-AUART ,
ld_i_autyp  TYPE CAUFVD-AUTYP ,
ld_i_aufnr  TYPE CAUFVD-AUFNR ,
ld_i_smsg_initialize  TYPE SY-UZEIT ,
ld_i_kwaer  TYPE TKA01-WAERS ,
ld_i_posted  TYPE I .

ld_i_afvgd = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_kalktab_resb to it_t_kalktab_resb.
ld_i_resb = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_coeja to it_t_coeja.

ld_i_klvar = some text here

"populate fields of struture and append to itab
append wa_t_co_object to it_t_co_object.

ld_i_auart = some text here

ld_i_autyp = Check type of data required

ld_i_aufnr = some text here
ld_i_smsg_initialize = 'Check type of data required'.

SELECT single WAERS
FROM TKA01
INTO ld_i_kwaer.

ld_i_posted = 'Check type of data required'.

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