cancel
Showing results for 
Search instead for 
Did you mean: 

user exits and pricing control table

Former Member
0 Kudos

dear sapgurus

i am not getting any idea about userexits, even i have gone thro williams but, in vain. can any body help me out in giving step by step procedure to follow, i do remember your help

ii) in pricing control how can i use a formula, even i am confused with terms e.g. requirements, altcty and altcbv from where exactly we are getting the numbers and how to fill these numbers accordingly. i request u all in sorting out this problem.

my email id: ukbhaskar2004@yahoo.com

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member

Hi Krishna Bhaskar,

Please Find the Useful Stuff Related to User Exits.

User exits are the enhancements provided by SAP

you can use them in transactions. Each transaction will have user exits.

If you want to use your own requirements by making your coding while the transaction is run you can use user exits.

For example if you want to run the MRP in MD02 specific to MRP controller you can user exit.

Please also refer the document below.

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 bundled in enhancement packages . Nevertheless 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 newly 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. Freight 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 type 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 components 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.

Hope this Clarifies your Doubts and Please Reward If Really Helpful,

Thanks and Regards,

Sateesh.Kandula

Former Member
0 Kudos

HI

REFER THE LINK FOR USER EXITS

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

. Introduction

2. How to find user exits

3. Using Project management of SAP Enhancements

1. Introduction:

User exits (Function module exits) are exits developed by SAP. The exit is implementerd as a call to a functionmodule. The code for the function module is writeen by the developer. You are not writing the code directly in the function module, but in the include that is implemented in the function module.

The naming standard of function modules for functionmodule exits is:

EXIT_<3 digit suffix>

The call to a functionmodule exit is implemented as:

CALL CUSTOMER.-FUNCTION ❤️ 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

2. How to find user exits?

Display the program where you are searching for and exit and search for CALL CUSTOMER-EXIT

If you know the Exit name, go to transaction CMOD.

Choose menu Utillities->SAP Enhancements. Enter the exit name and press enter.

You will now come to a screen that shows the function module exits for the exit.

3. 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”

The alternate base value is used as the calculation basis only, while the alternate calculation is used to modify the final value.

For example, imagine you have a condition type ZZ01, with a condition record maintained (master data) for $100. Now, condition ZZ02 also exists lower in the schema, but with a rate of 10%. The standard calculation would result in a final value of $110.

The alternate base value could say, "don't use $100 as the basis -- use the original price PR00 only, which was $90." Then, the final value would be $100 + (10% of $90) = $109.

The alternate calculation routine says, "ignore the 10% altogether. Instead, use an externally calculated 20%." Then, you end up with a final value of $100 + (20% of $100) = $120.

Put them both together, and you could end up with $100 + (20% of $90) = $118.

Now once again,

Alternative Calculation Type:

Normally if you want to calculate a value you have to use a calculation type for determinating the value. This calculation type is either addition, subtraction or multiplication. Similarly SAP also has got a default calculation type in the control data of the condition type. There you have the options of either Qty based , Fixed Amount Based or Percentage based.

Here what happens is suppose if you define Your condition type that calculates the base price of a material on Qty based. Then the calculation will be done based on the quantity of the material. If the customer orders 10 Nos and you have maintained a unit price of 100 Rs for each material then the value determined is 1000 INR. Similarly if the discount condition type , you maintain the calculation type as %. This means if you maintain the value of 10 % in the condition record. Then this percentage is taken as the calculation type and the condition value is determined.

In some cases you have to forego the default calculation types and use the customer specific method for calculating a value. For ex if you are calculating the Freight charges for a Material . it depends on so many criteria like, the weight, volume and also the minimum amount etc etc, in those cases, you forego the default value and then use the alternative calculation type in calculating the condition value against the particular condition.

Alternative Condition Base value :

If you have to calculate any value then you have to have a base value for it. For ex if you want to calculate the discount of 10 % for a material then you have to have a base value on which this 10% is calculated. Normally you take the condition value of the base price of the material to calculate the value.

Now you don't want to take the base value and take other values as base value which are derived on some formulae. So you create a routine which will do the mathematical operations in the routine and derive you a value which is now used as the base value for calculating the condition value for a particular condition type.

Requirement:

A factor in the condition technique that restricts access to a condition table. The system only accesses a condition table to determine the price if the requirement specified has been met.

Example:

The system uses an access sequence to determine the price of a material. One of the accesses in the sequence contains the requirement "in foreign currency." The system only uses the table behind this access if the sales order for which the price must be calculated is in a foreign currency.

Former Member
0 Kudos

Hi Krishna Bhaskar,

In Addition to the above find some more Stuff related to User Exits.

User exits in the SD orders. These are program names (SE38):

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 User exits in the SD orders. These are program names (SE38):

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. e 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.

SMOD is the transaction to view user exits assigned to an object.

CMOD is the transaction to change the user exits according to your requirement.

You can find user exits by looking into the phrase USER_EXIT.

Check this program to find out user exits for a transaction

Userexits are system modifications. The requirements of the client which can be met with Standard SAP are done with help of routines or userexits.

Userexits are nothing but a provision given by sap to write your own code/logic in the standard program.

Say for example while processing a sales order you want to check certain criteria weather they are met or not then you can use userxit_save_document_prepare.Here depending on the code you write system checks the if the criteria is fulfilling if not you can set an error or warning message in the code. This userexit is being executed just before saving of document.

one more commonly used exit is adding field in field catalog

In spro check this path Sales and Distribution-System modifications-Userexits.

Read the document provided,you will find all the exits in different processing for SD with program name and their purpose

Please Reward If Really Helpful,

Thanks and Regards,

Sateesh.Kandula