cancel
Showing results for 
Search instead for 
Did you mean: 

user exits used in sales and distribution?

Former Member
0 Kudos

i need some user exits that we commonly used in sd. please if somebody has worked on user exits . and how are they used..

points will be awarded to all for replying...

thanks in advance

Neha.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

USEREXIT_DELETE_DOCUMENT

• USEREXIT_FIELD_MODIFICATION

• USEREXIT_MOVE_FIELD_TO_VBAP

• USEREXIT_MOVE_FIELD_TO_VBAK

• US USEREXIT_NUMBER_RANGE

• USEREXIT_SAVE_DOCUMENT

• USEREXIT_SAVE_DOCUMENT_PREPARE

• USEREXIT_CHECK_XVBAP_FOR_DELET

• USEREXIT_CHECK_VBAK

• USEREXIT_FILL_VBAP_FROM_HVBAP

USEREXIT

Userxits allow us to add our own functionality to SAP standard program

without modifying it . These are implemented in the form of subroutines and hence are also known as FORM EXITs. The userexits are generally collected in includes and attached to the standard program by the SAP.

All Userexits start with the word USEREXIT_...

FORM USEREXIT_

z..

ENDFORM.

The problem lies in finding the correct userexit and how to find it if one exists for the purpose. Once the correct userexit is found the necessary

customer code is inserted in the customer include starting with the z..

in the form routine.

e.g. USEREXIT_SAVE_DOCUMENT_PREPARE

Certain application like SD still provide this form of enhancement using userexit but this practice is no longer being followed for newer extensions

instead they are using EXITs which come bundeled in enhancement packages . Neverthiless existing USEREXITS will be supported by SAP an all the newer versions of SAP.

1)ADDING OF NEW FIELDS IN PRICING

In Pricing in SD the fields on the basis of which pricing is done are derived from the FIELD CATALOG which is a structure KOMG .This structure is used to transfer transaction data to the pricing procedure in SD and is also known as communication structure.This structure KOMG consists of two tables KOMK for Header related fields and KOMP for item related fields.

The fields which are not in either of the two tables KOMK and KOMP

cannot be used in pricing .Sometimes a need arises when the pricing

is to be based on some other criteria which is not present in the form of fields in either of the two tables.

This problem can be solved by using USEREXITS which are provided for pricing in SD.

Pricing takes place both when the SALES ORDER ( Transaction VA01) is created as well as when INVOICING ( Transaction VF01) is done.Hence SAP provides 2 userexits ,one for sales order processing which is

USEREXIT_PRICING_PREPARE_TKOMP or

USEREXIT_PRICING_PREPARE_TKOMK

Depending upon which table (KOMK or KOMP) the new fields were inserted we use either of the above two userexits.These userexits are found in include MV45AFZZ of the standard SAP sales order creation program SAPMV45A.

In the case of userexit which will be called when invoicing is done ,these

are provided in the include RY60AFZZ which is in the standard SAP

program SAPMV45A. The name of the userexits are same. i.e

USEREXIT_PRICING_PREPARE_TKOMP or

USEREXIT_PRICING_PREPARE_TKOMK

These userexits are used for passing the data from the communication structure to the pricing procedure, for this we have to fill the newely

created field in the communication structure KOMG for this we fill the code in the above userexit using the MOVE statement after the data that

has to be passed is taken from the database table by using the SELECT statement. The actual structure which is visible in these userexits and which is to be filled for that particular field is TKOMP or TKOMK.

Before the coding for these userexits is done ,it is necessary to create a new field in either of the two tables KOMK or KOMP .For this purpose

includes are provided in each of them .

To create the field in header data(KOMK) the include provided is KOMKAZ

and to create the field in item data(KOMP) the include provided is KOMPAZ.

One possible example for the need of creating new fields can be e.g. Frieght to be based upon transportation zone ,for this no field is available in field catalog and hence it can be created in KOMK and then above userexits can be used to fill the transportation data to it.

2)The other method of finding userexit is to find the word USEREXIT in the

associated program of the transaction for which we want to determine userexit using SE38.

3)The other method of finding userexits is to find the include in case of SD/MM applications where the userexits are located ,this can be found in the SAP reference IMG generally in the subfolder under SYSTEM MODIFICATION.

Some other examples of userexits in SD are:

USEREXIT_NUMBER_RANGE

This userexit is used to assign a different internal document number to the

sales order(VA01) when it is created depending on some criteria like a different SALES ORGANIZAION(VKORG) .

USEREXIT_SAVE_DOCUMENT_PREPARE

This userexit is used to insert the ABAP code which will be called when

the document (sales order VA01) is just about to be saved.This userexit is used generally for custom checks on different fields , to display some information before the order will be saved or for making changes to certain fields before the sales order will be saved.

Exits & Enhancements

There are mainly six types of EXITs in sap which have been collected in the form of enhancement packages and attached to standard code in SAP.

These are different from USEREXIT in the way that they are implemented

in the form of FUNCTIONs while in USEREXITS we use form routines for their implementation. These are also sometimes known as function exits .

These start from the word EXIT_ followed by the program name and then followed by a three digit number.

e.g. EXIT_SAPMV45A_002

This exit is found in SD in enhancement V45A0002.

http://www.easymarketplace.de/userexit.php

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi refer below

It is most common that one or other time we need to use this function while configuring multi tasking & complex Prcing Architecture.

Here Iam giving a simple guide to add fields to the Pricing Field Catalogues:

For example you want to use field PSTYV ('Sales document item category') that is included in structure KOMP ('Pricing Communication Item') as a key for a condition table.

When you create a condition table (Transaction V/03), however, the system does not propose the field in the field catalog.

Condition access, field catalog, allowed fields, KOMG, KOMK, KOMP, KOMPAZ, KOMKAZ, PSTYV are the other terms which we need to know about, to add Fields.

Reason and Prerequisites

For technical reasons, field PSTYV was included in structure KOMP, however, not in structure KOMG ('Allowed Fields for Condition Structures').

Proceed as follows:

1. Call up the ABAP Dictionary (Transaction SE11) and create data type ZZPSTYV. Choose PSTYV as a domain.As a short text, you can use, for example, 'ZZ - sales document item category' and as a field label, you can use the field labels of PSTYV.Save, check and activate your entries.

2. Call up structure KOMPAZ in the ABAP Dictionary (Transaction SE11) in the change mode and make the following entry:

Component Component type

ZZPSTYV ZZPSTYV

Save, check and activate the change you made.

3. Note:Because of the change in structure KOMPAZ, field ZZPSTYV is now known in structures KOMG and KOMP because structure KOMPAZ is included in both structures.

4. Call up Transaction SPRO. Navigate to 'Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control' and execute 'Define Condition Tables'.

Choose 'Conditions: Allowed fields' and include ZZPSTYV as a new entry.

5. Note:Now you can use field ZZPSTYV as a key field when you create a condition table Axxx.

6. Supply the new field you defined by including the following source code line in USEREXIT_PRICING_PREPARE_TKOMP:

MOVE xxxx-PSTYV TO TKOMP-ZZPSTYV.

In order processing you find the user exit in Include MV45AFZZ, and in billing document processing you find it in Include RV60AFZZ.

Consider that you can also use this note as a help if you want to use other customer-specific fields as key fields in a condition table.

For header fields, use structure KOMKAZ instead of structure KOMPAZ and USEREXIT_PRICING_PREPARE_TKOMK instead of USEREXIT_PRICING_PREPARE_TKOMP.

For more information, see Transaction SPRO via the path 'Sales and Distribution -> System Modifications -> Create New Fields (Using Condition Technique) -> New Fields for Pricing' and OSS Note 21040.

USEREXIT

Userxits allow us to add our own functionality to SAP standard program

without modifying it . These are implemented in the form of subroutines and hence are also known as FORM EXITs. The userexits are generally collected in includes and attached to the standard program by the SAP.

All Userexits start with the word USEREXIT_...

FORM USEREXIT_..

z..

ENDFORM.

The problem lies in finding the correct userexit and how to find it if one exists for the purpose. Once the correct userexit is found the necessary

customer code is inserted in the customer include starting with the z..

in the form routine.

e.g. USEREXIT_SAVE_DOCUMENT_PREPARE

Certain application like SD still provide this form of enhancement using userexit but this practice is no longer being followed for newer extensions

instead they are using EXITs which come bundeled in enhancement packages . Neverthiless existing USEREXITS will be supported by SAP an all the newer versions of SAP.

HOW TO FIND USEREXITS

Userexits can be found in number of ways:

1) To find userexits in SD module , goto object navigator(SE80) and select

development class from the list and enter VMOD in it. All of the userexits in SD are contained in the development class VMOD. Press

enter and you will find all the includes which contain userexits in SD for

different functions like PRICING, ORDER PROCESSING etc. Select the userexit according to the requirement and read the comment inserted in it

and start coding .

Some examples of userexits in SD(SALES & DISTRIBUTION ) are:

1)ADDING OF NEW FIELDS IN PRICING

In Pricing in SD the fields on the basis of which pricing is done are derived from the FIELD CATALOG which is a structure KOMG .This structure is used to transfer transaction data to the pricing procedure in SD and is also known as communication structure.This structure KOMG consists of two tables KOMK for Header related fields and KOMP for item related fields.

The fields which are not in either of the two tables KOMK and KOMP

cannot be used in pricing .Sometimes a need arises when the pricing

is to be based on some other criteria which is not present in the form of fields in either of the two tables.

This problem can be solved by using USEREXITS which are provided for pricing in SD.

Pricing takes place both when the SALES ORDER ( Transaction VA01) is created as well as when INVOICING ( Transaction VF01) is done.Hence SAP provides 2 userexits ,one for sales order processing which is

USEREXIT_PRICING_PREPARE_TKOMP or

USEREXIT_PRICING_PREPARE_TKOMK

Depending upon which table (KOMK or KOMP) the new fields were inserted we use either of the above two userexits.These userexits are found in include MV45AFZZ of the standard SAP sales order creation program SAPMV45A.

In the case of userexit which will be called when invoicing is done ,these

are provided in the include RY60AFZZ which is in the standard SAP

program SAPMV45A. The name of the userexits are same. i.e

USEREXIT_PRICING_PREPARE_TKOMP or

USEREXIT_PRICING_PREPARE_TKOMK

These userexits are used for passing the data from the communication structure to the pricing procedure, for this we have to fill the newely

created field in the communication structure KOMG for this we fill the code in the above userexit using the MOVE statement after the data that

has to be passed is taken from the database table by using the SELECT statement. The actual structure which is visible in these userexits and which is to be filled for that particular field is TKOMP or TKOMK.

Before the coding for these userexits is done ,it is necessary to create a new field in either of the two tables KOMK or KOMP .For this purpose

includes are provided in each of them .

To create the field in header data(KOMK) the include provided is KOMKAZ

and to create the field in item data(KOMP) the include provided is KOMPAZ.

One possible example for the need of creating new fields can be e.g. Frieght to be based upon transportation zone ,for this no field is available in field catalog and hence it can be created in KOMK and then above userexits can be used to fill the transportation data to it.

2)The other method of finding userexit is to find the word USEREXIT in the

associated program of the transaction for which we want to determine userexit using SE38.

3)The other method of finding userexits is to find the include in case of SD/MM applications where the userexits are located ,this can be found in the SAP reference IMG generally in the subfolder under SYSTEM MODIFICATION.

Some other examples of userexits in SD are:

USEREXIT_NUMBER_RANGE

This userexit is used to assign a different internal document number to the

sales order(VA01) when it is created depending on some criteria like a different SALES ORGANIZAION(VKORG) .

USEREXIT_SAVE_DOCUMENT_PREPARE

This userexit is used to insert the ABAP code which will be called when

the document (sales order VA01) is just about to be saved.This userexit is used generally for custom checks on different fields , to display some information before the order will be saved or for making changes to certain fields before the sales order will be saved.

Exits & Enhancements

There are mainly six types of EXITs in sap which have been collected in the form of enhancement packages and attached to standard code in SAP.

These are different from USEREXIT in the way that they are implemented

in the form of FUNCTIONs while in USEREXITS we use form routines for their implementation. These are also sometimes known as function exits .

These start from the word EXIT_ followed by the program name and then followed by a three digit number.

e.g. EXIT_SAPMV45A_002

This exit is found in SD in enhancement V45A0002.

TYPES OF EXITS

1)MENU EXITS

2)FUNCTION EXITS

3)TABLE EXITS

4)SCREEN EXITS

5)KEYWORD EXITS

6)FIELD EXITS

We use SAP transactions CMOD and SMOD to manage exits. Before implementing an exit , it is required to create the project by using CMOD

selecting the enhancement e.g. V45A0002 and selecting the component

(one which fulfills our need) i.e the exit which will be implemented in SMOD and after coding has been done the project has to be activated.

An exit can be coded only once.

FUNCTION EXITS

These are used to add functionality through ABAP code . These start from the word EXIT_programname_NNN ending in a 3 digit number. No access code is required to implement any tupe of exit including function exits.

The function exits are called from the standard SAP program in the form

of ABAP statement

CALL CUSTOMER-FUNCTION 'NNN'

This is in contrast to USEREXITs where PERFORM statement is used to call

the required userexit.

To implement the FUNCTION EXITs first of all the project is created and a suitable enhancement package is selected and from its compnents the function exit to be implemented is selected and on double clicking it the exit code will appear in ABAP EDITOR(se38) where a Z include will be found and the customer code should be entered in this include.

e.g.

ADDING A DEFAULT SOLD-TO-PARTY in Sales Order Creation

To show a default sold-to-party in this field when the user creates a sales order (VA01) we can use a function exit .This function exit is located

in enhancement no V45A0002 . Before we can choose the exit we have to

create a project in CMOD after that enter V45A0002 in the enhancement field and click on the components . In the components you will see the

exit EXIT_SAPMV45A_002 . This exit is used for our purpose.

Double clicking on this exit will takes us to function builder (SE37) . This

function exit has one exporting parameters and two importing parameters, we are interested in exporting parameter which is E_KUNNR

of type KNA1-KUNNR i.e if we move the desired customer name to this

structure(E_KUNNR) it will be shown in the field as the default value when we create the sales order.

This function also contains a customer include ZXVVA04 . This include

will be used to write our custom code .

Double clicking on this include and it will prompt us that this include does not exists do you want to create this object ,select yes and the include will be created .In this include we can write our own code that will fill the field E_KUNNR.

e.g. E_KUNNR = 301.

Activate the include and Activate the project. Now when ever the SALES ORDER will be created , sold-to-party field will come up with a predefined

customer .

FIELD EXITS

The field exits are managed,created,activated through program RSMODPRF. The field exit is associated with a data element existing in ABAP dictionary and hence to the screen field using that data element.

The format of field exit is :

FIELD_EXIT_dataelement_A-Z or 0-9

If a particular screen and program name is not specified than the field exit will effect all the screens containing that data element.

The function module associated with field exit shows two parameters

INPUT and OUTPUT. Input parameter contains the data passed to the field exit when the field exit was invoked by the R/3 , We can write our own code to change the output parameter depending upon our requirements.

Before the field exit can have any effect the system profile parameter

ABAP/FIELDEXIT in all the application servers should be set to YES

ABAP/FIELDEXIT = YES.

Dsk
Active Contributor
0 Kudos

1.These are Standard SAP fucntion whcihh are used to write our own logic which has to be implemented under some conditions

2. In SD lot of user exits are there .

3. As mentioned in the other replies the SPRO itsefl helps u to check what are all the user exites that we will be able to use..

4. The codes are writte in abap with help of the technical consultatn

if u are looking for a specific scenario let us konw

Former Member
0 Kudos

hi

User exits in SD

Menu Path:

SPRO- IMG- SD- System Modification- User Exists. User Exists are available in SD for the following processes:

• User exits for price determination

• User exits for partner determination

• User exits for credit check & risk management

• User exits in sales:

o User exits in sales doc processing

o User exits for contract processing

o User exits for product allocation processing

o User exits for availability checking

o User exits for component supply processing

o User exits for product selection

o User exits for billing plan

• User exits for shipping

• User exits for transportation

• User exits for billing

• User exits for general billing interface

• User exits for sales support

• User exits for lists.

The topic of user exits is a subject that concerns ABAP development & extensive experience in ABAP is required to understand and use the user exits.

A customer user exit is essentially a function module using a unique naming convention, in which set import and export parameters are defined to limit the data that can be manipulated. This is to protect certain data from being changed. This function module is attached to an enhancement that may contain other function modules. A user exit should only be used if the possibilities for customizing or application-specific user exits are inadequate.

NEW FIELDS IN PRICING:

To use a field in pricing, one creates a cond table. This cond table is created using the allowed fields from the field catalog. Should the fields one requires not be included in the list of allowed fields, one can add the fields from the list of available fields. However, one may find that a new field may not be in the list of available fields. For this reason, one must create new fields for pricing. The document & item data in SD is stored in data tables such as VBAK & VBAP (for the order transaction). Many of the fields from these tables are available in the field catalog.

The field catalog is a structure (KOMG) that consists of 2 tables (KOMK & KOMP). These tables contain the header & item data for pricing respectively. They are called KOM”x” because they are communications structures used to communicate the transaction data with the pricing procedure. Table KOMG contains the field KOMK & KOMP.

If you require a field that is not in KOMG, it means that it is not in KOMK or KOMP. This means that the field you require cannot be used in pricing because there is no communication of this field from the transaction to the pricing procedure via the communication structures.

To use a field not defined in the field catalog, you need to add this field to KOMK or KOMP structures, and then write the ABAP code to transfer the data in the field from the transaction tables to the communication structure. Follow these steps:

Create the field in the KOMK (header data) & KOMP (item data) tables using the standard includes provided for this requirement.

Write the code in the user exit to read the transaction data & transfer it to the KOM”x” structures.

Menu Path:

SPRO- IMG- SD- System Modification- Create New Fields (using the cond tech)- New fields for Pricing.

Adding the field to KOMK & KOMP:

This process requires some knowledge of the ABAP dictionary & how to use the ABAP dictionary to create & change fields & tables. If the field is from the header table (for e.g. the order table: VBAK), you will need to add it to the include table KOMKAZ in the table KOMK. If the field is from the item table (for e.g. the order item table: VBAP), you will need to add it to the include table KOMPAZ in table KOMP.

Let’s say you need to use the ‘base material’ to define a price & the base material is no in the pricing field catalog. The base material is a field on the MMR basic data screen & is defined as MARA-WRKST. Since this relates to the material, it is at the item level, so you would add the field to KOMKAZ include table.

• When you add a field to these tables, it must start with ‘ZZ’. Therefore, the field you add would be ZZWRKST. In ABAP, when you add the field, use the same domain as in the field in the original table MARA-WRKST.

• After adding the field, generate the structure KOMP. This field is not available in the field catalog & can be used in condition tables.

Menu Path:

SPRO- IMG- SD- System Modification- User Exists. User Exists are available in SD for the following processes:

• User exits for price determination

• User exits for partner determination

• User exits for credit check & risk management

• User exits in sales:

o User exits in sales doc processing

o User exits for contract processing

o User exits for product allocation processing

o User exits for availability checking

o User exits for component supply processing

o User exits for product selection

o User exits for billing plan

• User exits for shipping

• User exits for transportation

• User exits for billing

• User exits for general billing interface

• User exits for sales support

• User exits for lists.

The topic of user exits is a subject that concerns ABAP development & extensive experience in ABAP is required to understand and use the user exits.

A customer user exit is essentially a function module using a unique naming convention, in which set import and export parameters are defined to limit the data that can be manipulated. This is to protect certain data from being changed. This function module is attached to an enhancement that may contain other function modules. A user exit should only be used if the possibilities for customizing or application-specific user exits are inadequate.

NEW FIELDS IN PRICING:

To use a field in pricing, one creates a cond table. This cond table is created using the allowed fields from the field catalog. Should the fields one requires not be included in the list of allowed fields, one can add the fields from the list of available fields. However, one may find that a new field may not be in the list of available fields. For this reason, one must create new fields for pricing. The document & item data in SD is stored in data tables such as VBAK & VBAP (for the order transaction). Many of the fields from these tables are available in the field catalog.

The field catalog is a structure (KOMG) that consists of 2 tables (KOMK & KOMP). These tables contain the header & item data for pricing respectively. They are called KOM”x” because they are communications structures used to communicate the transaction data with the pricing procedure. Table KOMG contains the field KOMK & KOMP.

If you require a field that is not in KOMG, it means that it is not in KOMK or KOMP. This means that the field you require cannot be used in pricing because there is no communication of this field from the transaction to the pricing procedure via the communication structures.

To use a field not defined in the field catalog, you need to add this field to KOMK or KOMP structures, and then write the ABAP code to transfer the data in the field from the transaction tables to the communication structure. Follow these steps:

Create the field in the KOMK (header data) & KOMP (item data) tables using the standard includes provided for this requirement.

Write the code in the user exit to read the transaction data & transfer it to the KOM”x” structures.

Menu Path:

SPRO- IMG- SD- System Modification- Create New Fields (using the cond tech)- New fields for Pricing.

Adding the field to KOMK & KOMP:

This process requires some knowledge of the ABAP dictionary & how to use the ABAP dictionary to create & change fields & tables. If the field is from the header table (for e.g. the order table: VBAK), you will need to add it to the include table KOMKAZ in the table KOMK. If the field is from the item table (for e.g. the order item table: VBAP), you will need to add it to the include table KOMPAZ in table KOMP.

Let’s say you need to use the ‘base material’ to define a price & the base material is no in the pricing field catalog. The base material is a field on the MMR basic data screen & is defined as MARA-WRKST. Since this relates to the material, it is at the item level, so you would add the field to KOMKAZ include table.

• When you add a field to these tables, it must start with ‘ZZ’. Therefore, the field you add would be ZZWRKST. In ABAP, when you add the field, use the same domain as in the field in the original table MARA-WRKST.

• After adding the field, generate the structure KOMP. This field is not available in the field catalog & can be used in condition tables.

Former Member
0 Kudos

hi,

you can use user exits at various scenarios depending on the clients requirements.

for eg, one of the user exit can be==>to check if the document is complete at the item level. if not, than it should not allow the user to print or do the print preview of that document.

or depending on item status we can allow them to print.

like this you can have many user exits.

thanks

Message was edited by:

AKK