【转自 http://blog.csdn.net/zhongguomao/article/details/6712580】
choose the table VBAP or VBAK ( depending on header or item)
click on button "append Structures" .
it will propose you the standard name for the table ZAVBAP or ZAVBAK
add fields with prefix ZZ
trans SE51 maintain user exit screens in program SAPMV45A
8459 user exit item level
8309 user exit header level
you can then design your own layout. and define your flow logic
PBO modules MV45AOZZ
PAI modules MV45AIZZ
Data definitions MV45ATZZ
Subroutines in MV45AFZZ
User Exits In Sales Document Processing
This IMG step describes additional installation-specific processing in sales document processing. In particular, the required INCLUDES and user exits are described.
Involved program components
System modifications for sales document processing affect different areas. Depending on the modification, you make the changes in the program components provided:
? MV45ATZZ
For entering metadata for sales document processing. User-specific metadata must start with "ZZ".
? MV45AOZZ
For entering additional installation-specific modules for sales document processing which are called up by the screen and run under PBO (Process Before Output) prior to output of the screen. The modules must start with "ZZ".
? MV45AIZZ
For entering additional installation-specific modules for sales document processing. These are called up by the screen and run under PAI (Process After Input) after data input (for example, data validation). The modules must start with "ZZ".
? MV45AFZZ and MV45EFZ1
For entering installation-specific FORM routines and for using user exits, which may be required and can be used if necessary. These program components are called up by the modules in MV45AOZZ or MV45AIZZ.
User exits in the program MV45AFZZ
The user exits which you can use for modifications in sales document processing are listed below.
? USEREXIT_DELETE_DOCUMENT
This user exit can be used for deleting data which was stored in a separate table during sales document creation, for example, if the sales document is deleted.
For example, if an additional table is filled with the name of the person in charge (ERNAM) during order entry, this data can also be deleted after the sales order has been deleted.
The user exit is called up at the end of the FORM routine BELEG_LOESCHEN shortly before the routine BELEG_SICHERN.
? USEREXIT_FIELD_MODIFICATION
This user exit can be used to modify the attributes of the screen fields.
To do this, the screen fields are allocated to so-called modification groups 1 - 4 and can be edited together during a modification in ABAP. If a field has no field name, it cannot be allocated to a group.|
The usage of the field groups (modification group 1-4) is as follows:
? Modification group 1: Automatic modification with transaction MFAW
? Modification group 2: It contains ‘LOO‘ for step loop fields
? Modification group 3: For modifications which depend on check tables or on other fixed information
? Modification group 4: is not used
The FORM routine is called up for every field of a screen. If you require changes to be made, you must make them in this user exit.
This FORM routine is called up by the module FELDAUSWAHL.
See the Screen Painter manual for further information on structuring the interface.
? USEREXIT_MOVE_FIELD_TO_VBAK
Use this user exit to assign values to new fields at sales document header level. It is described in the section "Transfer of the customer master fields into the sales document".
The user exit is called up at the end of the FORM routine VBAK_FUELLEN.
? USEREXIT_MOVE_FIELD_TO_VBAP
Use this user exit to assign values to new fields at sales document item level. It is described in the section "Copy customer master fields into the sales document".
The user exit is called up at the end of the FORM routine VBAP_FUELLEN.
? USEREXIT_MOVE_FIELD_TO_VBEP
Use this user exit to assign values to new fields at the level of the sales document schedule lines.
The user exit is called up at the end of the FORM routine VBEP_FUELLEN.
? USEREXIT_MOVE_FIELD_TO_VBKD
Use this user exit to assign values to new fields for business data of the sales document. It is described in the section "Copy customer master fields into sales document" .
The user exit is called up at the end of the FORM routine VBKD_FUELLEN.
? USEREXIT_NUMBER_RANGE
Use this user exit to define the number ranges for internal document number assignment depending on the required fields. For example, if you want to define the number range depending on the sales organization (VKORG) or on the selling company (VKBUR), use this user exit.
The user exit is called up in the FORM routine BELEG_SICHERN.
? USEREXIT_PRICING_PREPARE_TKOMK
Use this user exit if you want to include and assign a value to an additional header field in the communication structure KOMK taken as a basis for pricing.
? USEREXIT_PRICING_PREPARE_TKOMP
Use this user exit if you want to include or assign a value to an additional item field in the communication structure KOMP taken as a basis for pricing.
? USEREXIT_READ_DOCUMENT
You use this user exit if further additional tables are to be read when importing TA01 or TA02.
The user exit is called up at the end of the FORM routine BELEG_LESEN.
? USEREXIT_SAVE_DOCUMENT
Use this user exit to fill user-specific statistics update tables.
The user exit is called up by the FORM routine BELEG-SICHERN before the COMMIT command.
Note
If a standard field is changed, the field r185d-dataloss is set to X. The system queries this indicator at the beginning of the safety routine. This is why this indicator must also be set during the maintenance of user-specific tables that are also to be saved.
? USEREXIT_SAVE_DOCUMENT_PREPARE
Use this user exit to make certain changes or checks immediately before saving a document. It is the last possibility for changing or checking a document before posting.
The user exit is carried out at the beginning of the FORM routine BELEG_SICHERN.
User exits in the program MV45AFZA
? USEREXIT_MOVE_FIELD_TO_KOMKD
Use this user exit to include or assign values to additional header fields in the communication structure KOMKD taken as a basis for the material determination. This is described in detail in the section "New fields for material determination" .
? USEREXIT_MOVE_FIELD_TO_KOMPD
Use this user exit to include or assign values to additional item fields in the communication structure KOMPD taken as a basis for the material determination. This is described in detail in the section "New fields for material determination ".
? USEREXIT_MOVE_FIELD_TO_KOMKG
Use this user exit to include or assign values to additional fields in the communication structure KOMKG taken as a basis for material determination and material listing. This is described in detail in the section "New fields for listing/exclusion".
? USEREXIT_MOVE_FIELD_TO_KOMPG
Use this user exit to include or assign values to additional fields in the communication structure KOMPG taken as a basis for material determination and material listung. This is described in detail in the section "New fields for listing/exclusion".
? USEREXIT_REFRESH_DOCUMENT
With this user exit, you can reset certain customer-specific fields as soon as processing of a sales document is finished and before the following document is edited.
For example, if the credit limit of the sold-to party is read during document processing, in each case it must be reset again before processing the next document so that the credit limit is not used for the sold-to party of the following document.
The user exit is executed when a document is saved if you leave the processing of a document with F3 or F15.
The user exit is called up at the end of the FORM routine BELEG_INITIALISIEREN.