SAP Transportation Management 9.1%3a Overview of Innovations and Enhancements
SAP Enhancements
-
Upload
seenusrinivas -
Category
Documents
-
view
196 -
download
5
Transcript of SAP Enhancements
SAP User Exits and Enhancements.
Home
What is SAP ?
SAP LSMW Explained with example
SAP PM T-Codes
PM BRD/COR Maintenance
Add Your URL
User Exits & Enhancements
Best Of SAP Links
BDC Code
My Resume
SAP SmartForms Step by Step
SAP ABAP ALV Grid Explained with Example
Useful Tips
Contact Information Guest Book and Consultants List
ABAP Code
ABAP System Fields
SAPScript
SAPScript Graphics
SAPScript Print Program
ABAP ListViewer
Dialog Programming
SAP Tables
SAP ALE and IDOC
Recommended SAP ABAP Coding guidelines
SAP General ABAP
Submit Your Code
SAP Books For consultants
Free Website Submission and ROR Sitemap generator
User Exit and Enhancement explained in detail . User Exit Example Code MM Purchasing Exits
USEREXIT Userxits allow us to add our own functionality to SAP standard programwithout 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 necessarycustomer 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 extensionsinstead 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 fordifferent functions like PRICING, ORDER PROCESSING etc. Select the userexit according to the requirement and read the comment inserted in itand 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
Free Domain Search
Free HoroScope
KOMK for Header related fields and KOMP for item related fields. The fields which are not in either of the two tables KOMK and KOMPcannot be used in pricing .Sometimes a need arises when the pricingis 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 orUSEREXIT_PRICING_PREPARE_TKOMKDepending 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 ,theseare provided in the include RY60AFZZ which is in the standard SAPprogram SAPMV45A. The name of the userexits are same. i.eUSEREXIT_PRICING_PREPARE_TKOMP orUSEREXIT_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 newelycreated field in the communication structure KOMG for this we fill the code in the above userexit using the MOVE statement after the data thathas 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 purposeincludes 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 theassociated 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_RANGEThis userexit is used to assign a different internal document number to thesales 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 whenthe 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 EXITS2)FUNCTION EXITS3)TABLE EXITS4)SCREEN EXITS5)KEYWORD EXITS6)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 CMODselecting 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 formof ABAP statement CALL CUSTOMER-FUNCTION 'NNN' This is in contrast to USEREXITs where PERFORM statement is used to callthe 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 locatedin 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 theexit EXIT_SAPMV45A_002 . This exit is used for our purpose. Double clicking on this exit will takes us to function builder (SE37) . Thisfunction exit has one exporting parameters and two importing parameters, we are interested in exporting parameter which is E_KUNNRof type KNA1-KUNNR i.e if we move the desired customer name to thisstructure(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 includewill 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 predefinedcustomer . 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 parametersINPUT 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 parameterABAP/FIELDEXIT in all the application servers should be set to YES ABAP/FIELDEXIT = YES
Link to Content's target Space :
http://wiki.sdn.sap.com/wiki/x/
Applies to:
SAP ABAP, my SAP ECC 6.0, for more information, visit the ABAP homepage.
Summary
The enhancement concept allows you to add your own functionality to SAP's standard business applications without having to modify the original applications. To modify the standard SAP behavior as per customer requirements, we can use enhancement framework.This document explains about User exits and Customer Exits.
Author(s): Tutun Nandy
Company: Infosys Technology Ltd Created on: 20 May 2010
Author(s) Bio
Tutun Nandy is working with Infosys Technology Ltd since 2008. His expertise includes SAP ABAP.
Table of Contents
1) Overview of this document........................................................
2) User Exit with example............................................................
3) Customer Exit........................................................................
4) Types of Customer Exits..........................................................
5) Function Module exits.............................................................
6) Screen Exist.........................................................................
7) Menu Exits...........................................................................
8) Methods to find out customer Exits...........................................
9) CMOD and SMOD transactions................................................
Overview of this document
The enhancement concept allows you to add your own functionality to SAP's standard business applications without having to modify the original applications. To modify the standard SAP behavior as per customer requirements, we can use enhancement framework.
There are different ways to implement custom functionality in the SAP standard code. ex: User exits, customer exits, BADI etc.This document explains about User exits and Customer Exits.
User exitsThese are implemented in the form of subroutines and hence are also known as FORM EXITs. The user exits are generally collected in includes and attached to the standard program by the SAP.User exits are a type of system enhancement that was originally developed for the R/3 SD (Sales and distribution) module. User-exits are empty subroutines that SAP Developers have provided for you. You can fill them with your own source code. Technically this is a modification.All User exits start with the word USEREXIT_...FORM USEREXIT_XXXX.... INCLUDE ZZUSEREXIT....... ENDFORM. User exits can be found in the following ways:Go to Object Navigator (SE80), select Package and put VMOD (Application development R/3 SD customer modification) and press enter. You will find all the includes for user exits in SD. You will get User exits for Sales order, Delivery, Billing, Pricing etc. Most of the time documentation is maintained for each subroutine which helps developer for better understanding of the subroutine. Select the subroutine according to the requirement and start coding within the subroutine.
Examples:- In User exits MV45AFZZ(Sales Order Exit), we have subroutine USEREXIT_PRICING_PREPARE_TKOMK USEREXIT_PRICING_PREPARE_TKOMPThis user exit can be used to move additional fields into the communication table which is used for pricing. TKOMK for header fields and TKOMG for item fields. The fields which are not in either of the two tables KOMK and KOMP cannot be used in pricing.
zvendpgm (Vendor Program), zpricegrp (Price Group), kvgr5(Airport Code) fields value moving from VBAP to KOMP table.
- In User exits MV50AFZ1(Delivery Exit), you have subroutine USEREXIT_SAVE_DOCUMENT_PREPAREThis user exit can be used for changes or checks, before a document is saved.
Customer exitsSAP 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.Customer exits are nothing but a include in customer name space will be provided in the function module which starts with CALL CUSTOMER. You can fill them with your own source code. Technically this is an enhancement. User exits generally refer to SD module while customer exits refer to all modules like MM, SD, PP, FICO etc.
Advantage: - They do not affect standard SAP source code- They do not affect software updatesDisadvantage:- 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.
Types of Customer Exits1. Function Module exits2. Screen exits3. Menu exits
1. Function Module exitsFunction module exits are exits developed by SAP. The exit is implemented as a call to a function module. The code for the function module is written 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.
Format: CALL CUSTOMER-FUNCTION '910' The naming standard of function modules for function module exits is: EXIT_<program name>_<3 digit suffix> Examples:
Before User exits using: No error comes for any Country code.
Below Function Module Exits: EXIT_SAPMF02K_001.
We are writing our code in the Include ZXF05U01.
After User exits using: Error comes for any Country code like 'IN'. Only permissible country code is 'US'.
2. Screen Exits:Allow customer to add fields to a screen via a sub screen in an SAP program. The sub screen is called within the standard screen's flow logic. Format: CALL CUSTOMER-SUBSCREEN CUSTSCR1 3. Menu exits:Menu exits allow you to add your own functionality to menus. Menu exits are implemented by SAP and are reserved menu entries in the GUI interface. The developer can add his/her own text and logic for the menu.Function codes for menu exits all start with "+". Format: +CUS (additional item in GUI status) Methods to find out customer Exits:There are numbers of way by using we can find out Customer Exits.
Method # 1: Call customerIf you are searching customer exits based on particular transaction.
Go to Transaction. Ex: VA01.
Then system-> status
Double click on Program(screen).
Find(Cntrl+F)
Then use Call customer and select in main program radio button tab and press Enter.
We can find out all the possible Customer exits based on this transaction.
Method # 2: SMODGo to Transaction SMOD (SAP Enhancement).
Then Utilities-> Find
Give Package name and Execute (F8).
For Purchase Order package is ME.
We can find out all the possible Enhancement (Customer exits) based on this package.
Method # 3: SE84
Go to Transaction SE84.Select Enhancements -> Customer Exits -> Enhancements
Give Package and Execute. We can find out all the possible Enhancement (Customer exits) based on this Package.
Method # 4: SE81Go to Transaction SE81.
Click on Module name (ex: SD).
Then from top menu select Edit -> Select sub tree +/-.
Select Information System.
A new Screen will appear, it looks like SE84.Then select Enhancements -> Customer Exits ->Enhancements.
Double click on Enhancements and Execute.We can find out all the possible Enhancement (Customer exits) based on this Module.
Method # 5: ST05Go to Transaction ST05. Select Table Buffer Trace & Activate Trace.
Then go to the transaction, based on which you want to see the customer exits.Come back to ST05, Deactivate Trace & display Trace.Then go to FIND & write text EXIT_ & press ENTER.
We can find out all the possible Enhancement (Customer exits) based on this Transaction .This is not good technique to find out customer exits because all the possible exits may not be find out using this technique.
SAP Enhancements (SMOD):This transaction is used to see the list of objects in an enhancement. It is a container which holds many related objects within it.
If you Double click on TEST button, you will get below screen.
From the above screen shot we can say that the Function Exit is already implemented (Green light) but in Inactive stage (Red light). Project Creation (CMOD):This Transaction is used to create a project. Project is also a container, which holds several Enhancements. If we identify the User Exits and write down the code only within it, then the functionality will not be worked. That is why we require adding the enhancement into a project & making it active.CMOD Transaction is used to create a project.
Select Enhancement assignments and you add your Enhancement in this project.
You can add multiple Enhancements in one project. But you can't add one enhancement in multiple projects. Then error message will be generated.
Error message generate, because Enhancement V45A0002 is already exist in other project.
From screen short no: 2 of CMOD description, if we click on Components, we will get the list of Customer exits belongs to these enhancements.
Both green light shows that the exit is already implemented & is Active stage.
Sales and Distribution:
Table Description
Customers KNA1 General Data KNB1 Customer Master – Co. Code Data (payment method, reconciliation acct) KNB4 Customer Payment History KNB5 Customer Master – Dunning info KNBK Customer Master Bank Data KNKA Customer Master Credit Mgmt. KNKK Customer Master Credit Control Area Data (credit limits) KNVV Sales Area Data (terms, order probability) KNVI Customer Master Tax Indicator
KNVP Partner Function key KNVD Output type KNVS Customer Master Ship Data KLPA Customer/Vendor Link Sales Documents VBAKUK VBAK + VBUK VBUK Header Status and Administrative Data VBAK Sales Document - Header Data VBKD Sales Document - Business Data VBUP Item Status VBAP Sales Document - Item Data VBPA Partners VBFA Document Flow VBEP Sales Document Schedule Line VBBE Sales Requirements: Individual Records
SD Delivery DocumeLIPS Delivery Document item data, includes referencing PO LIKP Delivery Document Header data
Billing Document VBRK Billing Document Header VBRP Billing Document Item