SAP Function Modules

KLTE_CALCULATE_DATES SAP Function module - Get Market Value Change Period and Risk Commitment Period







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

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


Pattern for FM KLTE_CALCULATE_DATES - KLTE CALCULATE DATES





CALL FUNCTION 'KLTE_CALCULATE_DATES' "Get Market Value Change Period and Risk Commitment Period
  EXPORTING
    i_dat1 =                    " kldats-dfikt  Date To
    i_auswdate =                " kldats-dfikt  Evaluation Date (Date From)
    i_arr =                     " klarrc-arr    Default Risk Rule
*   i_mwae_rbd = SPACE          " c             X = Market Value Change Period; '   ' = Risk Commitment Period
    i_flag_separate = SPACE     " trff_flg      Exact Calculation of Market Value Change Period/Risk Commitment Period
*   i_prot_level = 1            " sprot-level   Log Level
*   i_objnr =                   " tvs_sfgdt_typ-kopf-objnr  Object Number
  IMPORTING
    e_value =                   " kl0_p_decimals4  Difference in Months, or Exactly, as per I_FLAG_SEPARATE
    e_klarrc =                  " klarrc        Definition of Default Risk Rule
  TABLES
    c_error_itab =              " bapierr       OR: Structure of Error Handling
  EXCEPTIONS
    NO_CALC = 1                 "
    .  "  KLTE_CALCULATE_DATES

ABAP code example for Function Module KLTE_CALCULATE_DATES





The ABAP code below is a full code listing to execute function module KLTE_CALCULATE_DATES 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_value  TYPE KL0_P_DECIMALS4 ,
ld_e_klarrc  TYPE KLARRC ,
it_c_error_itab  TYPE STANDARD TABLE OF BAPIERR,"TABLES PARAM
wa_c_error_itab  LIKE LINE OF it_c_error_itab .


DATA(ld_i_dat1) = 20210129

DATA(ld_i_auswdate) = 20210129

SELECT single ARR
FROM KLARRC
INTO @DATA(ld_i_arr).

DATA(ld_i_mwae_rbd) = 'Check type of data required'.
DATA(ld_i_flag_separate) = 'Check type of data required'.

DATA(ld_i_prot_level) = Check type of data required

DATA(ld_i_objnr) = some text here

"populate fields of struture and append to itab
append wa_c_error_itab to it_c_error_itab. . CALL FUNCTION 'KLTE_CALCULATE_DATES' EXPORTING i_dat1 = ld_i_dat1 i_auswdate = ld_i_auswdate i_arr = ld_i_arr * i_mwae_rbd = ld_i_mwae_rbd i_flag_separate = ld_i_flag_separate * i_prot_level = ld_i_prot_level * i_objnr = ld_i_objnr IMPORTING e_value = ld_e_value e_klarrc = ld_e_klarrc TABLES c_error_itab = it_c_error_itab EXCEPTIONS NO_CALC = 1 . " KLTE_CALCULATE_DATES
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_e_value  TYPE KL0_P_DECIMALS4 ,
ld_i_dat1  TYPE KLDATS-DFIKT ,
it_c_error_itab  TYPE STANDARD TABLE OF BAPIERR ,
wa_c_error_itab  LIKE LINE OF it_c_error_itab,
ld_e_klarrc  TYPE KLARRC ,
ld_i_auswdate  TYPE KLDATS-DFIKT ,
ld_i_arr  TYPE KLARRC-ARR ,
ld_i_mwae_rbd  TYPE C ,
ld_i_flag_separate  TYPE TRFF_FLG ,
ld_i_prot_level  TYPE SPROT-LEVEL ,
ld_i_objnr  TYPE TVS_SFGDT_TYP-KOPF-OBJNR .


ld_i_dat1 = 20210129

"populate fields of struture and append to itab
append wa_c_error_itab to it_c_error_itab.

ld_i_auswdate = 20210129

SELECT single ARR
FROM KLARRC
INTO ld_i_arr.

ld_i_mwae_rbd = 'Check type of data required'.
ld_i_flag_separate = 'Check type of data required'.

ld_i_prot_level = Check type of data required

ld_i_objnr = 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 KLTE_CALCULATE_DATES or its description.