SAP Function Modules

FKK_SAMPLE_0785 SAP Function module - Calculate Account Balances







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

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


Pattern for FM FKK_SAMPLE_0785 - FKK SAMPLE 0785





CALL FUNCTION 'FKK_SAMPLE_0785' "Calculate Account Balances
  EXPORTING
*   i_vkont = ' '               " fkkvk-vkont   Relevant Account
*   i_gpart = ' '               " gpart_kk      Business Partner
*   i_vtref = ' '               " vtref_kk      Contract Reference
*   i_subap = SPACE             " subap_kk      Subapplication in Contract Accounts Receivable and Payable
    i_start_date =              " sy-datum      Start Date
    i_start_time =              " coitm_kk      Start Time to the Second
    i_end_date =                " sy-datum      End Date
    i_end_time =                " coitm_kk      End Time to the Second
*   i_xallf = ' '               " xfeld         Read Dunning and Returns Data
  IMPORTING
    e_balance =                 " fkkop-betrh
    e_sum_openitems =           " fkkop-betrh
    e_sum_clearings =           " fkkop-betrh
    e_sum_institems =           " fkkop-betrh
    e_sum_interestitems =       " fkkop-betrh   Amount in Local Currency with +/- Signs
    e_sum_chargeitems =         " fkkop-betrh   Amount in Local Currency with +/- Signs
* TABLES
*   t_postab =                  " fkkepos
*   t_augtab =                  " fkkepos
*   t_insttab =                 " fkkepos
*   t_interesttab =             " sfkkop
*   t_chargetab =               " fkkop
    .  "  FKK_SAMPLE_0785

ABAP code example for Function Module FKK_SAMPLE_0785





The ABAP code below is a full code listing to execute function module FKK_SAMPLE_0785 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_balance  TYPE FKKOP-BETRH ,
ld_e_sum_openitems  TYPE FKKOP-BETRH ,
ld_e_sum_clearings  TYPE FKKOP-BETRH ,
ld_e_sum_institems  TYPE FKKOP-BETRH ,
ld_e_sum_interestitems  TYPE FKKOP-BETRH ,
ld_e_sum_chargeitems  TYPE FKKOP-BETRH ,
it_t_postab  TYPE STANDARD TABLE OF FKKEPOS,"TABLES PARAM
wa_t_postab  LIKE LINE OF it_t_postab ,
it_t_augtab  TYPE STANDARD TABLE OF FKKEPOS,"TABLES PARAM
wa_t_augtab  LIKE LINE OF it_t_augtab ,
it_t_insttab  TYPE STANDARD TABLE OF FKKEPOS,"TABLES PARAM
wa_t_insttab  LIKE LINE OF it_t_insttab ,
it_t_interesttab  TYPE STANDARD TABLE OF SFKKOP,"TABLES PARAM
wa_t_interesttab  LIKE LINE OF it_t_interesttab ,
it_t_chargetab  TYPE STANDARD TABLE OF FKKOP,"TABLES PARAM
wa_t_chargetab  LIKE LINE OF it_t_chargetab .


SELECT single VKONT
FROM FKKVK
INTO @DATA(ld_i_vkont).

DATA(ld_i_gpart) = 'Check type of data required'.
DATA(ld_i_vtref) = 'Check type of data required'.
DATA(ld_i_subap) = 'Check type of data required'.
DATA(ld_i_start_date) = '20210129'.
DATA(ld_i_start_time) = '20210129'.
DATA(ld_i_end_date) = '20210129'.
DATA(ld_i_end_time) = '20210129'.
DATA(ld_i_xallf) = '20210129'.

"populate fields of struture and append to itab
append wa_t_postab to it_t_postab.

"populate fields of struture and append to itab
append wa_t_augtab to it_t_augtab.

"populate fields of struture and append to itab
append wa_t_insttab to it_t_insttab.

"populate fields of struture and append to itab
append wa_t_interesttab to it_t_interesttab.

"populate fields of struture and append to itab
append wa_t_chargetab to it_t_chargetab. . CALL FUNCTION 'FKK_SAMPLE_0785' EXPORTING * i_vkont = ld_i_vkont * i_gpart = ld_i_gpart * i_vtref = ld_i_vtref * i_subap = ld_i_subap i_start_date = ld_i_start_date i_start_time = ld_i_start_time i_end_date = ld_i_end_date i_end_time = ld_i_end_time * i_xallf = ld_i_xallf IMPORTING e_balance = ld_e_balance e_sum_openitems = ld_e_sum_openitems e_sum_clearings = ld_e_sum_clearings e_sum_institems = ld_e_sum_institems e_sum_interestitems = ld_e_sum_interestitems e_sum_chargeitems = ld_e_sum_chargeitems * TABLES * t_postab = it_t_postab * t_augtab = it_t_augtab * t_insttab = it_t_insttab * t_interesttab = it_t_interesttab * t_chargetab = it_t_chargetab . " FKK_SAMPLE_0785
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_e_balance  TYPE FKKOP-BETRH ,
ld_i_vkont  TYPE FKKVK-VKONT ,
it_t_postab  TYPE STANDARD TABLE OF FKKEPOS ,
wa_t_postab  LIKE LINE OF it_t_postab,
ld_e_sum_openitems  TYPE FKKOP-BETRH ,
ld_i_gpart  TYPE GPART_KK ,
it_t_augtab  TYPE STANDARD TABLE OF FKKEPOS ,
wa_t_augtab  LIKE LINE OF it_t_augtab,
ld_e_sum_clearings  TYPE FKKOP-BETRH ,
ld_i_vtref  TYPE VTREF_KK ,
it_t_insttab  TYPE STANDARD TABLE OF FKKEPOS ,
wa_t_insttab  LIKE LINE OF it_t_insttab,
ld_e_sum_institems  TYPE FKKOP-BETRH ,
ld_i_subap  TYPE SUBAP_KK ,
it_t_interesttab  TYPE STANDARD TABLE OF SFKKOP ,
wa_t_interesttab  LIKE LINE OF it_t_interesttab,
ld_e_sum_interestitems  TYPE FKKOP-BETRH ,
ld_i_start_date  TYPE SY-DATUM ,
it_t_chargetab  TYPE STANDARD TABLE OF FKKOP ,
wa_t_chargetab  LIKE LINE OF it_t_chargetab,
ld_e_sum_chargeitems  TYPE FKKOP-BETRH ,
ld_i_start_time  TYPE COITM_KK ,
ld_i_end_date  TYPE SY-DATUM ,
ld_i_end_time  TYPE COITM_KK ,
ld_i_xallf  TYPE XFELD .


SELECT single VKONT
FROM FKKVK
INTO ld_i_vkont.


"populate fields of struture and append to itab
append wa_t_postab to it_t_postab.
ld_i_gpart = '20210129'.

"populate fields of struture and append to itab
append wa_t_augtab to it_t_augtab.
ld_i_vtref = '20210129'.

"populate fields of struture and append to itab
append wa_t_insttab to it_t_insttab.
ld_i_subap = '20210129'.

"populate fields of struture and append to itab
append wa_t_interesttab to it_t_interesttab.
ld_i_start_date = '20210129'.

"populate fields of struture and append to itab
append wa_t_chargetab to it_t_chargetab.
ld_i_start_time = '20210129'.
ld_i_end_date = '20210129'.
ld_i_end_time = '20210129'.
ld_i_xallf = '20210129'.

SAP Documentation for FM FKK_SAMPLE_0785


This function module calculates the balance of the items posted between the i_startdate-i_starttime and i_enddate-i_endtime. ...See here for full SAP fm documentation

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