cancel
Showing results for 
Search instead for 
Did you mean: 

SAP SD

ipsit_mohapatra
Participant
0 Kudos

Hi all

Can anybody give some real time situations where we can use the user exits ??

thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

In Sales Order & Billing, if we want to have different number range may be plant wise or sales office wise, then we use user exit.

For Sales Order:

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.

For Billing:

USEREXIT_NUMBER_RANGE (Module pool SAPLV60A, program RV60AFZZ)

The internal number range used in the standard system is specified

in the billing type table and can be changed in this user exit. This

user exit is only called when the billing documents is created.

Similarly there may be different requirement, for which different User Exit can be identified & used.

IMG (SPRO) --> Sales and Distribution --> System Modifications --> User Exits --> .......

Regards,

Rajesh Banka

reward points if helpful.

Answers (5)

Answers (5)

Former Member
0 Kudos

HI the scenario may be

You want to to display the document numbers prefixed with the document types.

If you you have document types : K and D

documents maintained for type K are 65,67 etc.

documents maintained for type D are 66, 68, 69 etc.

Hence, you want to display the documents as K_65, K_67, D_66, D_68, D_69 etc though you store the data in database without the prefixes.

You would implement a proper BADI/Enhancement to achieve this. You would get document number and document type.

You would concatenate document type '_' document number into document number to be displayed.

)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_data element_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.

Former Member
0 Kudos

Dear Ipsit,

User exits :

1. 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_<program name><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"

Regards,

Rakesh

Former Member
0 Kudos

Hi Ipsit,

User exit - A user exit is a three character code that instructs the system to access a program during system processing.

SXX: S is for standard exits that are delivered by SAP. XX represents the 2-digit exit number.

UXX: U is for user exits that are defined by the user. XX represents the 2-digit exit number

Customer exit - The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the original applications. SAP creates customer exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks. *-- Mani

The following document is about exits in SAP :-

The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the original applications.

SAP creates user exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.

Types of Exits

There are several different types of user exits. Each of these exits acts as hooks where you can attach or "hang" your own add-ons.

Menu Exits

Menu exits add items to the pulldown menus in standard SAP applications. You can use these menu items to call up your own screens or to trigger entire add-on applications.

SAP creates menu exits by defining special menu items in the Menu Painter. These special entries have function codes that begin with "+" (a plus sign). You specify the menu item’s text when activating the item in an add-on project.

Screen Exits

Screen exits add fields to screens in R/3 applications. SAP creates screen exits by placing special subscreen areas on a standard R/3 screen and calling a customer subscreen from the standard screen’s flow logic.

Function Module Exits

Function module exits add functions to R/3 applications. Function module exits play a role in both menu and screen exits.

When you add a new menu item to a standard pull down menu, you use a function module exit to define the actions that should take place once your menu is activated.

Function module exits also control the data flow between standard programs and screen exit fields. SAP application developers create function module exits by writing calls to customer functions into the source code of standard R/3 programs.

These calls have the following syntax:

CALL CUSTOMER-FUNCTION ‘001’.

Field Exits

Field exits allow you to create your own programming logic for any data element in the Dictionary. You can use this logic to carry out checks, conversions, or business-related processing for any screen field. Example: The data element BBBNR identifies a company’s international location number. You might want to set up your R/3 System so that all international location numbers are larger than 100.

The field exit concept lets you create a special function module that contains this logic.

You assign the special function module to the data element BBBNR. You then assign the module to any programs and screens in which users can add new international location numbers. When you activate your field exit, the system automatically triggers your special routine whenever a user enters a company location number.

In 4.6c, you can use "RSMODPRF" program to create field exits.

An example of a user exits :-

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.

Regards,

Rakesh

Former Member
0 Kudos

Here's an example

Mostly in SAP SD- Invoice numbering will start with the digit "9............."

but say your Org. wants that Invoicing for Delhi Region should start with digit "2..."

Bombay region should start with digit "11......"

chennai region should start with a "C1......"

as this is a deviation from the default SAP working, people resort to user exits.

Hope this provides some insight into 'real use' of user exits.

Thanks & Regards

Former Member
0 Kudos

hi Mohapatra,

Welcome to SDN.

http://www.ficoexpertonline.com/downloads/User%20ExitsWPedit.doc

User exits are hooks in standard SAP code, which allow you to add functionality. The positioning of these exits has been defined by SAP, so often you can't find one where you need it!

Customer exits are not available for all programs and screens found in the SAP System. You can only use customer exits if they already exist in the SAP System.

Customer Exit

-


SAP creates customer exits for specific programs, screens, and menus within standard applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.

If you want to enhance the functionality of your SAP System, you should take advantage of the exits available in standard applications. There are two main reasons why you should use exits rather than modifying SAP software yourself. Add-ons attached to exits have the advantage that:

• They do not affect standard SAP source code

When you add new functionality to your SAP System using SAP’s exits, you do not alter the source code of standard SAP programs in any way. The code and screens you create are encapsulated as separate objects. These customer objects are linked to standard applications, but exist separately from SAP’s standard software package.

• They do not affect software updates

When you add new functionality to your SAP System using SAP’s exits, your objects (called customer objects) must adhere to strict naming conventions. When it comes time to upgrade a to a new software release, customer objects’ names ensure that they will not be affected by any changes or new additions to the standard software package.

Customer exits are not available for all programs and screens found in the SAP System. You can only use customer exits if they already exist in the SAP System. You find find more information about locating applications with pre-defined exits in Locating Applications that have Exits

http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm

http://www.sapgenie.com/abap/code/abap26.htm

http://www.sap-img.com/abap/what-is-user-exits.htm

http://wiki.ittoolbox.com/index.php/HOWTO:Implement_a_screen_exit_to_a_standard_SAP_transaction

<b>Reward Useful answers</b>

Siva

Message was edited by:

SivaKumar