Skip to Content

Hello SAPers!

There are quite many guides on how to use user exits in FI-substitutions, however these materials refer primarily to application of exits for substitution logic i.e. the logic that is triggered once the prerequisites are met. However, you can also use exits to enhance prerequisites logic. The following post provides some insights on this topic.

Consider the following definition of substitution step (in t-code GGB1). Constant value “BS account” will be populated into line item when two prerequisites are met:

  • Company code is “UKRP”;
  • GLBS custom prerequisite based on user exit that check if GL account is balance sheet account.

Exit GLBS can be chosen on dedicated tab during prerequisite definition.

Custom exits should be developed beforehand in a dedicated program pool for prerequisites. You can check the settings in your system in transaction code GCX2.

As you can see, there two Z-programs ZRGGBR000 and ZRGGBS000 in this menu. Both programs are copies of standard programs RGGBR000 / RGGBS000 respectively. The program for application area GBLR (i.e. ZRGGBR000) is used for prerequisites logic, whereas the program for area GBLS (i.e. ZRGGBS000) is used for substitution logic. Please note, that you can use one program for both areas, but for clarify purposes it is recommended to split it into two programs.

From programming perspective custom exit should be created as a subroutine (similarly as for substitution logic). An example of custom program with some comments can be found attached bellow.

program zrggbr000 .
* EXIT-Formpool for FI substitutions                                  *

include fgbbgd00.

* Activate tables types, that you want to use

*&      Form  get_exit_titles
*       text
*      -->ETAB       text
form get_exit_titles tables etab.

  data: begin of exits occurs 50,
          name(5)   type c,
          param     like c_exit_param_none,
          title(60) type c,
        end of exits.

  exits-name  = 'GLBS'.
  exits-param = c_exit_param_none.    " Complete data used in exit.
  exits-title = text-900.             " GL account is BS
  append exits.
  " Add definitions of other exits for prerequisites here

  " Refresh exit names (visible in GGB1)
  refresh etab.
  loop at exits.
    etab = exits.
    append etab.

endform.                    " get_exit_titles

First part of the program deals with common logic that is used to generate a list of exists and their descriptions. The descriptions of exits (visible in GGB1) are handled as text elements (via menu Goto -> Text Elements -> Text Symbols).

Second part of the program contains logic for separate exits (e.g. for exit GLBS):

* GL account is balance sheet account
form glbs using b_result.

  constants: lc_bs_account type xbilk value 'X'.

  data: lv_saknr type saknr.

  b_result = b_false.

  select single ska1~saknr
    into lv_saknr
    from t001 inner join ska1 on ska1~ktopl = t001~ktopl
    where t001~bukrs = bseg-bukrs
      and ska1~saknr = bseg-hkont
      and ska1~xbilk = lc_bs_account.

  if sy-subrc = 0.
    b_result = b_true.

endform.                    " GLBS, GL account is balance sheet account

Example in this post might seem quite trivial, but it is provided for demonstration purposes only and is intended to deliver basic idea behind this functionality. If you need to check whether GL account is BS you can simply check the value of BSEG-XBILK, which is available by default. Generally speaking, exits should be reserved for those cases which involve complicated logic, especially those involving custom tables.

That’s all there is to usage of exits. If you are experienced FI-consultant, you probably already know all about it. However, if you’re just starting out on a journey it should be quite helpful. To be honest, I have been writing quite complex substitutions for some time, but never considered usage of this technique. Just because I was not really sure how to use it.



Bohdan Petrushchak

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply