SAP makes different possibilities available to extend SAP functionality in the R/3 without modifying the delivered R/3-Standard. Thus these extensions are further present also after a R/3-Release-Wechsel.
User exits are original one in the selling module (SD) developed expandability.
They consist of empty subroutines (FORM) in special Includes, which can be filled by a ABAP Use developer. In special places in the SA P-CODE such subroutine references were inserted by SAP. An extension is thus only possible, where SAP planned it.
They usually offer a rather rudimentary expandability, since purely technically objects in the SAP name area are modified.
Field exits are bypasses of a Dynprofield with data element purchase into a functional module. These will go through when leaving the Dynpros. There are global and local field exits.
v Global field exits
are not limited to a Dynpro. If a data element is used on several Dynpros, after activation of the field exit with all this Dynpros to a functional module one branches out.
v Local one field exit
work only on a Dynpro limited. There is the possibility of putting on bus to 36 local field exits to a data element.
With text extensions it acts around user keywords and user documentation (F1-Hilfe) to data elements. The new keywords can refer to SAP documentation and to user documentation. Thus one has also the possibility of overwriting the keywords delivered by SAP.
With text extensions the changes are global effective for all SAP applications concerned contrary to application extensions after activation.
An application function can be extended by application extensions by the customer. Customer exits must be intended by SAP. They consist generally of several components. The interface SAP/Kunde is clearly defined.
With a R/3-Release-Wechsel and/or. Upgrade remain the customer extensions without effort.
By functional module exits the customer can implement additional logic in an application function.
SAP built such exits in different places into many application functions. Thus are the interfaces are already given, and/or which data handed over.
These functional modules can be filled now by the customer. It can insert also user Dynpros with associated processing logic and GUI surface and put on user text elements.
Menu exits make it for the customer possible to build and occupy with a function code in an SAP application new menu entries.
SAP determined, where in the program additional function codes are queried and like to it is being reacted, either by a functional module exit or by an already firmly given functionality.
Dynpro exits permit the customer to arrange ranges of a dynpros reserved by SAP. Within these ranges large information can be indicated or data be seized. Those for this force fields by the customer on a user Dynpro are arranged.
Using t-code: SE93 and specify the transaction code. from here goto the main program and click on the FIND button. Specify USEREXIT and select find in main program radio button and click search... if any user exit is used, it will list all the places as in SAP if any user exit is used, a comment is been written above the user exit.
1. 通过一些专门的程序. 网上找。
2. Search string “call customer” in the main program source code;
3. SE80 -> Repository Infomation System -> Enhancements -> Customer Exits -> Input search condition -> Execute
4. SE11 -> Database table: MODSAPVIEW -> Display Contents -> Input "*program name*" into Enhancement field -> Execute -> 得到的SAP extension name 即为 Customer Exits Enhancement Name
MODULE user_exit_0001 INPUT
CASE okcode.
WHEN 'BACK OR EXIT'.
CASE sy-dynnr.
WHEN '100'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN '200'.
******************************************************************************
**** Note that you can write any code that satisfy your needs. ****
**** But in this case, this was wrote as a sample code for reference sake. ****
**** And you can test it. ****
******************************************************************************
SET SCREEN 100.
LEAVE SCREEN.
ENDCASE.
ENDCASE.
SAP User Exits Routine
User exits are routine which SAP allows you to add in additional customized programs process without affecting the standard SAP programs.
SAP user exit are usually declare as a form routine :-
form userexit_xxxxx
........................
endform
In VL01 - Create Delivery Order, standard program SAPMV50A, the standard program did not check for storage location equal to space, and delivery quantity less than one when the user click the save button. Therefore I have to insert the additional checking into the userexit routine.
Steps:-
Another way of determining the list of user exits could be bus executing the Tcode SE80.
For example if U need to search for the user exits for the above mentioned program, execute the Tcode SE80 and enter the above program name, the following screen appears:
The highlighted row denotes a user exit, which is used in this program
form userexit_save_document_prepare.
case xlips-pstyv.
when 'TAX' or 'REX'.
* Accept this two Delivery item category
when 'REN'.
if xlips-lgort = space.
* Reject this Delivery item category
message e001.
endif.
when others.
if xlips-matnr <> space.
* Check storage location not space
if xlips-lgort = space.
message e002.
endif.
* Check delivery quantity not zero
if xlips-pikmg < 1.
message e003.
endif.
endif.
endcase.
endform.
*
* Finding the user-exits of a SAP transaction code
*
* Enter the transaction code in which you are looking for the user-exit
* and it will list you the list of user-exits in the transaction code.
* Also a drill down is possible which will help you to branch to SMOD.
*
* Written by : SAP Basis, ABAP Programming and Other IMG Stuff
*
report zuserexit no standard page heading.
tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
tables : tstct.
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
parameters : p_tcode like tstc-tcode obligatory.
select single * from tstc where tcode eq p_tcode.
if sy-subrc eq 0.
select single * from tadir where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = tstc-pgmna.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
select single * from trdir where name = tstc-pgmna.
if trdir-subc eq 'F'.
select single * from tfdir where pname = tstc-pgmna.
select single * from enlfdir where funcname =
tfdir-funcname.
select single * from tadir where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
endif.
endif.
select * from tadir into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct where sprsl eq sy-langu and
tcode eq p_tcode.
format color col_positive intensified off.
write:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
skip.
if not jtab[] is initial.
write:/(95) sy-uline.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
write:/(95) sy-uline.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
format color col_normal intensified off.
write:/1 sy-vline,
2 jtab-obj_name hotspot on,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
endloop.
write:/(95) sy-uline.
describe table jtab.
skip.
format color col_total intensified on.
write:/ 'No of Exits:' , sy-tfill.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
at line-selection.
get cursor field field1.
check field1(4) eq 'JTAB'.
set parameter id 'MON' field sy-lisel+1(10).
call transaction 'SMOD' and skip first screen.
*---End of Program
Syntax:
=Uzzzz (zzzz = up to 4 characters - this is true for Document Level validations - call point 3 - *Header Level & Line Item Level - call points 1 & 2 - allow up to 30 charaters.)
/NORFB->Bus.transactions->Base parameters->Validation
/NORFB->Bus.transactions->Base parameters->Substitution
Example
=ULTE "FI_DOCU 001 "Parked SA,FY,SI=>long text CORRESP. "
=U&VALID_WBS_IN_ZUONR "FI_ITEM 011 Spon.Res: Check WBS valid in ZUONR"
* changed in 4.5B (* Form UFIA -- formerly U&VALID_WBS_IN_ZUONR)
User exits are form routines that the user programs. There are two types of user-exits:
1. Validation exits are used in the prerequisites and checks. They have either the value 'T' for true or 'F' for false. They are interpreted as a part of the logical statement, like a constant or field comparison. For this type of user exit, you must fill a parameter with the results of your check ('T' for true; 'F' for false).
Example
FORM Uzzzz USING B_RESULT. "'T' or 'F'
from program ZGGBR000 (ZGGBRI03)
2. Substitution exits are used to change one or more fields. However, you can only change those fields that are permitted in the Boolean class for the substitution. You can display these fields by selecting the following menu options in substitution maintenance: Fields for substitutions>
Example
FORM Uzzzz USING COST_CENTER.
from program ZGGBS000 (ZGGBSI02)
Substitution Fields can be found from this window
/NORFB->Bus.transactions->Base parameters->Substitution->Call Pnt 2->Substitution step 3->Extras->Substitution flds
The name of the form pool (e.g., ZGGBR000 & ZGGBS000) that contains your user exit must be stored in table T80D.
Note
1. Data declaration
Tables and field stings cannot be declared in form routines, so that the contents can be used along with the calling transaction.
2. Parameter definition
It is important that you make declare the code generation program for your user exit; how many and what type of parameters you are using for the user exit. You do this by entering your newly defined user exits in the form routine GET_EXIT_TITLES.
found in program ZGGBR000 (ZGGBRTIT)
found in program ZGGBS000 (ZGGBSTIT)
One exception is the parameter for the results of a validation exit. You must not declare this, it is automatically generated be the system. What types of parameters are available and how you use them is described in the online documentation. When creating your user exits, you can use the example form pools delivered by SAP (RGGBR000 for validations; RGBBS000 for substitutions) as a reference. We recommend that you copy the example form pools delivered by SAP when creating your own user exits. In these example form pools, entries already exist in the form routine GET_EXIT_TITLES for the examples delivered. The GET_EXIT_TITLES must absolutely exist in your form pool.
You can find additional information on the creation of user exits in the online documentation on validations and substitutions.
SAP exits are form rountines programmed by SAP. The name of the form pool is SAPFGBEB.
Syntax:
=Szzzz (zzzz = up to four characters)
FORM Szzzz using B_result. "'T' or 'F'
Example
=S01 "SAP exit S01"
Display description of T80D configuration
Return ->
Change Validation: FI_ITEM (Message view)
The naming standard of function modules for functionmodule exits is:
EXIT_<program name><3 digit suffix>
The call to a functionmodule exit is implemented as:
CALL CUSTOMER.-FUNCTION <3 digit suffix>
Example:
The program for transaction VA01 Create salesorder is SAPMV45A
If you search for CALL CUSTOMER-FUNCTION i program
SAPMV45A you will find ( Among other user exits):
CALL CUSTOMER-FUNCTION '003'
exporting
xvbak = vbak
xvbuk = vbuk
xkomk = tkomk
importing
lvf_subrc = lvf_subrc
tables
xvbfa = xvbfa
xvbap = xvbap
xvbup = xvbup.
The exit calls function module EXIT_SAPMV45A_003
Using Project management of SAP Enhancements, we want to create a project to enahance trasnaction VA01 .
- Go to transaction CMOD
- Create a project called ZVA01
- Choose the Enhancement assign radio button and press the Change button
In the first column enter V45A0002 Predefine sold-to party in sales document.
Note that an enhancement can only be used in 1 project. If the enhancement is already in use, and error message will be displayed
Press Save
Press Components. You can now see that enhancement uses user exit EXIT_SAPMV45A_002. Double click on the exit.
Now the function module is displayed. Double click on include ZXVVAU04 in the function module
Insert the following code into the include: E_KUNNR = '2155'.
Activate the include program. Go back to CMOD and activate the project.
Goto transaction VA01 and craete a salesorder.
Note that Sold-to-party now automatically is "2155"
1. USER EXITS are FORMS and are called by SAP standard programs using PERFORM. CUSTOMER EXITS are FUNCTIONS so they are called using CALL FUNCTION (or more exactly CALL CUSTOMER FUNCTION). 2. Inside the form (user exit) you can read and change almost any global data from host program. Inside a function (customer exit) you can only acces your import/export/changing/tables parameters. 3. User exits are more flexible because you have more information to use in your code but on the other hand , it is very easy to manipulate erroneously global data and lead the standard program to a dump or even to make database inconsistent. Customer exits are more restrictive but you are sure any change you can make to any parameters will never lead to inconsistency 4. User-exit doesn’t have any classification. In customer-exit we have function-module exit , screen exit , menu exit. 5. User exits are Basically designed For SD module. Costomer exits Are available for MM,SD,FI,HR…..Basically designed for all modules.
1. USER EXITS 是以 FORM的形式存在,所以通过被SAP standard programs 通过 PERFORM调用. CUSTOMER EXITS 以 FUNCTION module形式存在, 通过CALL CUSTOMER-FUNCTION语句调用.
2. 在user exit里你可以读写几乎所有的全局变量. 在customer exit里你只能访问import/export/changing/tables parameters.
3. User exits 更加灵活(因为你可以获得更多的信息,例如所有的全局变量),但同时也很容易因为对数据的不合理处理导致系统级错误,甚至是数据库数据的一致性出现问题.
Customer exits 更具有限制性,但是你可以确性你的程序不会导致数据库一致性出现问题.
4. User-exit 没有什么分类. 而customer-exit 可以分为function-module exit, screen exit, menu exit.
5. User exits 基本上都是为SD模块设计的. Customer exits被运用在MM, SD, FI, HR... 等几乎所有的模块当中.