Added by Milosavljevic Sreten, last edited by Nathan Genez on Oct 29, 2007 (view change)
Prerequisite represents conditions which has to be fulfilled in order to substitution to work. There are in total three structures where you can find data for this conditions and these are: BSEG (document items), SYST (ABAP system fields) and BKPF (document header). There are three so called "Callup points" where you can run your substitution: document header, line item and complete document. In all this three callup point structures BKPF and SYST are available for conditions, and BSEG is available only in line item and complete document place.
Substitution value is a field (string or number) which should replace value entered. For i.e. for documents entered which are type SA (in prerequisite this would be BKPF-BLART = 'SA'), field ZUONR should be filled some text, so BKPF-ZUONR = 'test'. So, in this case substitution value is 'test'.
Substitution exit is used when you need more complex substitution. In previous example imagine that you want to fill field ZUONR with document date + user who entered document. This can not be achieved by simple field to field assignment; you must write a user-exit. User exit represents routine to replace data in substitution. Every user exit you write must begin with U, and that state that user exit is user defined one. I will not write more about this because there is good documentation regarding writing user-exits, so I point you on standard SAP documentation. Let us do something more fun
.L1S52 Unknown macro: { color} update gb01 set bexclude = ' ' where boolclass = '015' and classtype = 'S' and bcltab = 'BSEG' and bclfield = 'MWSKZ'. Now you can see field MWSKZ in list for substitution and use it. But this is not end. If you now run transaction where substitution should occur nothing will happen. For this field actually be used in substitution, program RGUGBR00 must be run. This program regenerates all programs where substitution is used. Choose Application area FI, Callup point 015, regenerate main program, generate substitutions, generate substitution usage, generate substn exp. routines and you are ready to go!
Additional informations
Trace. Move your mouse on substitution and go to menu -> Extras -> Activate total trace. Now when you start transaction and enter data something like debugging screen will appear and you will be able to see is your substitution is running, which data are available in current moment.... For i.e. you can make substitution to run on transaction F-32 and put that in condition, but in fact SYST-TCODE is FB1D and you will see this in trace.
Think twice what are you trying to accomplice with substitution. And not only because previously described side effects. For example, you wish to substitute cost center based on some data in BSEG, so at first moment you may think that you need to substitute BSEG-KOSTL, which is locked for substituting. But, think about Cost center substitutions and structure COBL where this is standard.
Activating and deactivating of substitution. Transaction OBBH, here you can mark each substitution rule as activated or deactivated. When you create some rule, it will not work until you mark it as Active. service.sap.com and help.sap.com. Spend some time trying to find more informations here, it may save you a lot of time and energy, I'm speaking from own experience
Comments (1)
Show Comments