Throughput Accounting Conclusion

Throughput Accounting (TA) with SAP – Conclusion

Make it easy

In this post, I am going to complete the tool for Throughput Accounting (TA) in SAP that we started in the previous post. At first, let´s complete the part called investment (I). Now, so far we have evaluated WIP and raw materials as well as unfinished and finished goods. The next part of investment (I) is assets. (For more information see “The Haystack Syndrome” by Dr E.M. Goldratt 1990 or “Throughput Accounting” by Thomas Corbett 1998.)

Fortunately, there are standard function modules, which can be used to evaluate these assets. For this purpose, I chose “BAPI_GL_GETGLACCPERIODBALANCES“. It is easy to use; the input parameters are clear. You also get an internal table with all the necessary balances. These can be summed in the final value of assets in the financial period.

Here is the ABAP class for this action :

CLASS zcl_ta_i_ledger DEFINITION PUBLIC 
INHERITING FROM zcl_ta_i_asset 
CREATE PUBLIC . 
PUBLIC SECTION. 
DATA gs_account_balances TYPE bapi1028_4 .
 METHODS get_value_for_period IMPORTING !i_saknr TYPE saknr . 
PROTECTED SECTION. 
DATA saknr TYPE saknr . 
CONSTANTS c_currencytype TYPE curtp VALUE '10' ##NO_TEXT. 
DATA: gt_account_balances TYPE TABLE OF bapi1028_4 . 
METHODS get_balance_for_period . 
METHODS get_ledger IMPORTING !i_saknr TYPE saknr . 
PRIVATE SECTION. 
ENDCLASS. 
CLASS ZCL_TA_I_LEDGER IMPLEMENTATION. 
METHOD get_balance_for_period. 
CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES' 
EXPORTING 
companycode = bukrs 
glacct = saknr 
fiscalyear = fyear 
currencytype = c_currencytype 
* IMPORTING 
* BALANCE_CARRIED_FORWARD = 
* RETURN = 
TABLES
account_balances = gt_account_balances . 
READ TABLE gt_account_balances WITH KEY 
fisc_year = fyear fis_period = period 
INTO gs_account_balances. 
ENDMETHOD. 
METHOD get_ledger. 
saknr = i_saknr. 
ENDMETHOD. 
METHOD get_value_for_period. 
get_ledger( i_saknr ). 
get_balance_for_period( ). 
ENDMETHOD. 
ENDCLASS. 

However, the basic question is: which ledgers should we take into account? The clue can be found in “Throughput Accounting” by Thomas Corbett 1998 p 39 Quote:…..

The definition of this measurement might cause some confusion:”All the money the system invests in purchasing things the system tends to sell.” Do the companies intend to sell their machines, buildings and so on? If we examine this question from the stockholder´s perspective, if the company does not generate the expected profitability he will sell his stock, which is the same as selling his part of the machines, buildings and so on….

You should definitely call up your colleague from the finance department to find out which ledgers in your particular case need to be evaluated. Once the ledgers are known, you get them using the next standard function module from the SAP.

Here is the ABAP class for this action :

CLASS zcl_ta_i_asset DEFINITION 
PUBLIC INHERITING FROM zcl_ta_investment CREATE PUBLIC . 
PUBLIC SECTION. 
TYPES: BEGIN OF t_itab. INCLUDE TYPE bapi3006_1. " include type BAPI1028_4. 
TYPES: balance TYPE bapisaldo. "balance type menge. 
TYPES END OF t_itab . 
DATA: gt_itab TYPE TABLE OF t_itab . 
METHODS get_list IMPORTING 
VALUE(i_rg_saknr) TYPE STANDARD TABLE OPTIONAL . 
PROTECTED SECTION. 
DATA: gt_account_list TYPE TABLE OF bapi3006_1 . 
DATA gs_account_list TYPE bapi3006_1 . 
DATA go_ledger TYPE REF TO zcl_ta_i_ledger . 
DATA gs_itab TYPE t_itab . 
DATA rg_saknr TYPE RANGE OF saknr. 
METHODS get_ledgers . 
METHODS get_values_for_ledgers . 
PRIVATE SECTION. 
ENDCLASS. 
CLASS ZCL_TA_I_ASSET IMPLEMENTATION. 
METHOD get_ledgers. 
CALL FUNCTION 'BAPI_GL_ACC_GETLIST' 
EXPORTING 
companycode = bukrs 
* LANGUAGE = 
* LANGUAGE_ISO = 
* IMPORTING 
* RETURN = 
TABLES 
account_list = gt_account_list . 
LOOP AT gt_account_list INTO gs_account_list.
 IF gs_account_list-gl_account NOT IN rg_saknr. 
DELETE TABLE gt_account_list FROM gs_account_list. 
ENDIF. 
CLEAR: gs_account_list. 
ENDLOOP. 
ENDMETHOD. 
METHOD get_list. 
rg_saknr = i_rg_saknr. 
get_ledgers( ). 
get_values_for_ledgers( ). 
ENDMETHOD. 
METHOD get_values_for_ledgers. 
DATA: sum TYPE bapisaldo. 
LOOP AT gt_account_list INTO gs_account_list. 
""create ZCL_TA_I_LEDGER get value for this period. 
CREATE OBJECT go_ledger 
EXPORTING i_fyear = me->fyear i_period = me->period 
* i_werks = 
i_bukrs = me->bukrs . 
go_ledger->get_value_for_period( gs_account_list-gl_account ). 
IF go_ledger->gs_account_balances-balance <> 0. 
MOVE-CORRESPONDING go_ledger->gs_account_balances TO gs_itab. 
gs_itab-short_text = gs_account_list-short_text.
 gs_itab-long_text = gs_account_list-long_text. 
APPEND gs_itab TO gt_itab. 
sum = sum + go_ledger->gs_account_balances-balance. 
ENDIF. 
CLEAR : gs_account_list,go_ledger,gs_itab. 
ENDLOOP. 
gs_itab-balance = sum. 
APPEND gs_itab TO gt_itab. 
CLEAR gs_itab. 
ENDMETHOD.
 ENDCLASS. 

This class is at the same time the superclass for ZCL_TA_I_LEDGER mentioned above and in this hierarchy at the top is placed the class ZCL_TA_INVESTMENT.

Here is the ABAP coding:

 CLASS zcl_ta_investment DEFINITION PUBLIC CREATE PUBLIC . 
PUBLIC SECTION. 
METHODS constructor 
IMPORTING !i_fyear TYPE cosp-gjahr
 !i_period TYPE cosp-perbl !i_werks TYPE werka OPTIONAL
 !i_bukrs TYPE bukrs OPTIONAL . 
PROTECTED SECTION. 
DATA fyear TYPE cosp-gjahr . 
DATA period TYPE cosp-perbl . 
DATA start TYPE sy-datum . 
DATA end TYPE sy-datum . 
CLASS-DATA c_periv TYPE t009b-periv VALUE 'Q1' ##NO_TEXT. 
DATA werks TYPE werks-werks VALUE '013' ##NO_TEXT. 
DATA bukrs TYPE bukrs VALUE '013' ##NO_TEXT. 
METHODS get_dates_for_period . 
PRIVATE SECTION. 
ENDCLASS. 
CLASS zcl_ta_investment IMPLEMENTATION. 
METHOD constructor. 
fyear = i_fyear. 
period = i_period. 
get_dates_for_period( ). 
werks = i_werks. 
bukrs = i_bukrs. 
ENDMETHOD. 
METHOD get_dates_for_period. 
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET' EXPORTING i_gjahr = fyear 
* I_MONMIT = 00
 i_periv = c_periv 
i_poper = period 
IMPORTING 
e_date = start 
* EXCEPTIONS 
* INPUT_FALSE = 1 
* T009_NOTFOUND = 2 
* T009B_NOTFOUND = 3 
* OTHERS = 4 . 
IF sy-subrc <> 0. 
* Implement suitable error handling here 
ENDIF. 
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET' 
EXPORTING
 i_gjahr = fyear 
* I_MONMIT = 00 
i_periv = c_periv 
i_poper = period 
IMPORTING 
e_date = end 
* EXCEPTIONS 
* INPUT_FALSE = 1
* T009_NOTFOUND = 2 
* T009B_NOTFOUND = 3 
* OTHERS = 4 . 
IF sy-subrc <> 0. 
* Implement suitable error handling here 
ENDIF. 
ENDMETHOD. 
ENDCLASS.

All these classes can be used together in order to gain the part of investments (I) for purpose TA. For instance this way:

Here is the ABAP coding:

*&---------------------------------------------------------------------* *& Report ZTEST *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* 
REPORT zta_test. 
CLASS main DEFINITION. 
PUBLIC SECTION. 
CLASS-DATA: lo TYPE REF TO zcl_ta_wip, 
lo_bestand TYPE REF TO zcl_ta_stock, alv TYPE REF TO cl_salv_table, 
lr_functions TYPE REF TO cl_salv_functions_list, 
subrc TYPE syst-subrc. 
CLASS-METHODS main. 
ENDCLASS. 
CLASS main IMPLEMENTATION. 
METHOD main. 
CREATE OBJECT lo_bestand EXPORTING i_fyear = 2017 i_period = 003 .
 lo_bestand->get_tvc_sum_for_stock( ). 
TRY. cl_salv_table=>factory( IMPORTING r_salv_table = alv CHANGING t_table = lo_bestand->gt_print ). 
lr_functions = alv->get_functions( ). 
lr_functions->set_all( abap_true ). 
alv->display( ). 
CATCH cx_salv_msg. 
MESSAGE 'ALV display not possible' TYPE 'I' DISPLAY LIKE 'E'. 
ENDTRY. 
* *CREATE OBJECT lo 
* EXPORTING 
* i_fyear = 2018  
* i_period = 002 * . 
*lo->get_tvc_sum( ). * 
*clear lo. 
ENDMETHOD. 
ENDCLASS. 
START-OF-SELECTION. main=>main( ). 

Now we have the complete ABAP code to evaluate investments (I) as a part of throughput accounting (TA). Now, it is time to gain the next two measurements: Throughput (T) and Operating expense (OE). Let´s start with some Quotes from “Throughput Accounting” by Thomas Corbett 1998:

p.29 …… Throughput (T) is defined as all the money that comes into the company minus what it paid to its vendors….

p.31 … Operating Expense (OE) – All the money the system spends in turning investment into throughput…

It leads us to the same logic as in the case of assets. We can use the same principle and the same function module BAPI_GL_GETGLACCPERIODBALANCES. The difference will only be the use of the retrieved internal table. For T, we will use credits and debits for OE. Once again, you should discuss it with your colleagues in the financial department.

And that is it. We now have all the parts of throughput accounting. They can be used for making the right decisions in the TOC way, using simple common sense.