Enhancements
SAP has developed its various
modules with standards, which are broadly practiced all over. But yet the
requirements of customers differ from place to place. In this scenario it
becomes imperative to modify SAP objects to suit the customer’s needs.
1. Customizing: Customizing
constitutes changing the system parameters with its own special user interface.
These changes are organized and preplanned. It is an obligatory part of a SAP
implementation process.
2. Enhancement Concept: It constitutes
changing of SAP Repository objects by the customer without modification
3. Modification: Modifying the
SAP repository objects in the form custom changes. This should be avoided
because when SAP changes occur in new versions then the customer version and
the new SAP version have to be reconciled manually. This means an increased
maintenance workload because of the need to adjust all such modifications.
Hence, use of this option should be avoided as far as possible.
4. Customer Development: If the
customer requirements are not met by SAP then we should go in for customer
development. These means that we need to create customer specific objects
within the customer range. Modification and Customer Development involve high
maintenance and costs. Hence use these only when customer requirements are not
met by customizing or by exits. SAP creates customer exits for specific
programs, screens and menus within standard R/3 applications.
There are two methods in enhancements.
- User
Exits.
- BADI
(Business Add Ins)
User Exits
There are mainly two reasons to
why we have to use exits if we ever have to.
1. You should them because they
do not affect the SAP source code but still allow you to change the
functionality of SAP to suit your needs. SAP has provided us with some standard
exits that we should modify by adding our encapsulated as separate objects.
When you create Exits, they are encapsulated as separate objects.
2. And since, they do not affect
the source code and are named as per the SAP naming conventions; they do affect
future software upgrades. Hence you do not have to save them and then reenter
add-ons attached to exits. You can only use exits if they already exist within
the SAP R/3 System In case you do not find an exit available for an area where
you would want to make a change, then you should request SAP to develop an
exit.
There are four types of exits:
1. Menu Exits
2. Screen Exits
3. Function module Exits
4. Field Exit
1. Menu Exits
Using the Menu Exits you can add
menu items to the menus of standard R/3 Applications. The Menu Exit
entries have function codes that begin with + (plus sign).
2. Function Exits
This includes creating function
modules with the administrative part, the interface and the documentation but
usually without any additional code. Function module exits play a role in both
in menu and screen exits When you add a new menu item to a standard pull-down
menu, for example, you can use a function module exit.
3. Screen Exits
Screen Exits defines special
areas called Subscreens within a screen. Using Screen Exits you can add
subscreens to the screens within R/3 applications.
4. FIELD EXITS
Let us now see how to create
field exits.
Ø
First and foremost, ask your system
administrator to include the parameter abap/fieldexit = Y in your Instance Profile
Ø
For the Field Exits we do not need an
Enhancement project.
Ø
To create a Field Exit, you need to first
determine which Data Element you
would want to change, The program that you would like to have the effect
on, The screen number.
In our example we will consider
the transaction MM02, which is for changing the material master. We will select
the Basic Data view and then make fields exit for restricting the Basic Unit Of
Measurement. For example, we will not allow the user to enter ‘BOX’ as basic unit of
measurement. For this field, we need to have details such the Data Element,
Program name and Screen Number.
i. Start the Transaction MM02.
ii. Select a material and click
enter
iii. From the pop up that you
get, select the Basic Data view
iv. Locate the label Base Unit of
Measure in the General Data section.
v. Place your cursor in the field
and press F1
vi. In the Help screen of this
field, press on Technical Info button and note down the above information
BADI
Detailed explanation about BADI with an example
BADI (Business Add-In) is a new SAP Object Oriented
enhancement technique which is used to add our own business functionality to
the existing SAP standard functionality. BADI's are available in SAP R/3
from the system release 4.6c
Why BADI?
In contrast to the earlier enhancement techniques, BADI follows Object Oriented approach to make them reusable. A BADI can be used any number of times where as standard enhancement techniques can be used only once.
Transaction code for BADI Definition: SE18
When you create a BAdI definition, a class interface will be automatically created and you can define your methods in the interface. The implementation of the methods can be done in SE19 transaction.
Transaction code to Implement BADI: SE19
Types of BADI's:
While creating a BADI using the T-code SE18, it provides the
pop-up screen to select the type of BADI to be used is as shown below.
BADI
Detailed explanation about BADI with an example
Defination:
In contrast to the earlier enhancement techniques, BADI follows Object Oriented approach to make them reusable. A BADI can be used any number of times where as standard enhancement techniques can be used only once.
For example if we assign an enhancement to one custom project, then that
enhancement cannot be assigned to any other custom projects. To overcome this
drawback SAP has provided a new enhancement technique called BADI.
When you create a BAdI definition, a class interface will be automatically created and you can define your methods in the interface. The implementation of the methods can be done in SE19 transaction.
When a BAdi is created following are automatically generated:An interface with
'IF_EX_' inserted between the first and second characters of the BAdi name. An
adapter class with 'CL_EX_' inserted between the first and second characters of
the BAdi name.
There are two types of BADI's.
1) Multi use BADI:
With this option, any number of active implementations can be assigned to the same definition BADI. By default this option is checked.If we want the BADI for multiple use
With this option, any number of active implementations can be assigned to the same definition BADI. By default this option is checked.If we want the BADI for multiple use
If you have multiple-use BADI definitions, the sequence must
not play any role.
The drawback in Multiple use BADI is, it is not
possible to know which BADI is active especially in country specific version.
2) Filter dependent BADI:
Using this option we can define the BADI's according to the
filter values to control the add-in implementation on specific criteria.
Ex: Specific country value.
1. Go to SE 24 transaction, type CL_EXITHANDLER and then click on display.
2. Double click on GET_INSTANCE method.
3.Put a break-point on class method
CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE.
4. Run any transaction on which we want finds the BADI's say
VA01.
5. Give the transaction name VA01 and press enter.
6. It will automatically take you to the break-point which we have set the in the SE24 transaction. Each time if you press F8 a list BADI names will be displayed
7. You can find the BADI name in field EXIT_NAME and
if you double click on it, we can get the corresponding BADI name before hit
the corresponding screen. Based on the requirement find the BADI name and
accordingly implement your functionality using the transaction se19.
Method 2:
Go to transaction SE84 and click on Enhancements. Then double click on Business Add-Ins. For example if you want to find the BADI's for the standard transaction ME22n, the procedure is as follows. This example shows, finding the way of BADI names by providing the Package of ME22n.
Go to transaction SE84 and click on Enhancements. Then double click on Business Add-Ins. For example if you want to find the BADI's for the standard transaction ME22n, the procedure is as follows. This example shows, finding the way of BADI names by providing the Package of ME22n.
1) Go to transaction ME22n. Select the System option from the menu and then click on Status. It displays the following information.
2) Double click on the
program name i.e. SAPLMEGUI. It will take you into the program and click on Go
to tab from the Menu. There we can find the package name of the standard
transaction ME22n.Copy and paste it in the package filed.
Method 3:
Finding the BADI names using SE18 transaction
1) Go to transaction SE
18. Select F4 help for the definition name and click on Information System
button as shown below
3) Now Press F8, a list of
BADI names will be displayed as shown below. Select the appropriate BADI name
and implement it based on the business requirement using the transaction SE19.
Finding the BADI names using SE18 transaction
2). A pop-up screen will be
displayed and give the package name for any standard transaction say VA02.
Finding the package is explained above. Please refer above method to find the
package name. The package name for VA02 transaction is 'VA.'
3) A list of BADI
names will be displayed for the transaction VA02. Select the appropriate BADI
name and implement it using T-code SE19.
Example :
This Example explains how to implement BADI's. Here I am trying to show how to add
custom screen to the ME23N
Transactions using BADI's.
The procedure is as explained below.
This Example explains how to implement BADI's. Here I am trying to show how to add
The procedure is as explained below.
- Find the BADI
using the method 1 as shown above.
The BADI name to add the custom screen to ME23n is 'ME_GUI_PO_CUST'.
- Go to T-code SE19 and create an implementation ZME_GUI_PO_CUST and then click on create button
- Give the Definition name "ME_GUI_PO_CUST" and continue, give short text, save
- Click on Interface Tab, you can find the implementation class name as ZCL_IM_ME_GUI_PO_CUST2.
- Click on ZCL_IM_ME_GUI_PO_CUST2, which will take you to SE24.
- Add "MMMFD" in the Type Group Section of properties tab.
- Go to Attributes section and declare the following attribute
- SUBSCREEN1 Constant Public Type MEPO_NAME Name of a View
'ITEMSCREEN1 '.
- Go to Methods section, you can find the BADI interface methods.
- Double click on the method "IF_EX_ME_GUI_PO_CUST~SUBSCRIBE", this method is having 3 parameters
- Go to T-code SE19 and create an implementation ZME_GUI_PO_CUST and then click on create button
- Give the Definition name "ME_GUI_PO_CUST" and continue, give short text, save
- Click on Interface Tab, you can find the implementation class name as ZCL_IM_ME_GUI_PO_CUST2.
- Click on ZCL_IM_ME_GUI_PO_CUST2, which will take you to SE24.
- Add "MMMFD" in the Type Group Section of properties tab.
- Go to Attributes section and declare the following attribute
- SUBSCREEN1 Constant Public Type MEPO_NAME Name of a View
'ITEMSCREEN1 '.
- Go to Methods section, you can find the BADI interface methods.
- Double click on the method "IF_EX_ME_GUI_PO_CUST~SUBSCRIBE", this method is having 3 parameters
Go to the code section of the method and add the following
code there.
Code for IF_EX_ME_GUI_PO_CUST~SUBSCRIBE:
DATA: ls_subscriber LIKE LINE OF re_subscribers.
*--FIRST SCREEN POPULATION
DATA: ls_subscriber LIKE LINE OF re_subscribers.
*--FIRST SCREEN POPULATION
*--we want to add a customer
subscreen on the item detail tab
CHECK im_application = 'PO '.
CHECK
im_element = 'ITEM'.
*--each line in re_subscribers generates a subscreen. We add one subscreen
*--each line in re_subscribers generates a subscreen. We add one subscreen
*--in this example
CLEAR re_subscribers[].
*--the name is a unique identifier
for the subscreen and defined in this
*--class definition
ls_subscriber-name =
subscreen1.
*--the dynpro number to use
*--the dynpro number to use
ls_subscriber-dynpro =
'0002'.
*--the program where the dynpro can be found
*--the program where the dynpro can be found
ls_subscriber-program =
'ZME_GUI_PO_CUST_SCREEN'.
*--each subscreen needs itsown DDIC-Structure
*--each subscreen needs itsown DDIC-Structure
ls_subscriber-struct_name =
'ZMARA'.
*--a label can be defined
*--a label can be defined
ls_subscriber-label = 'Cust
BADI'.
*--the position within the tabstrib can be defined
*--the position within the tabstrib can be defined
ls_subscriber-position = 7.
*--the height of the screen can be
defined here. Currently we suport two
*--screen sizes:
*--value <= 7 a sevel line
subscreen
*--value > 7 a 16 line subscreen
ls_subscriber-height =
7.
APPEND ls_subscriber TO re_subscribers.
Save and check & back
Double click on method IF_EX_ME_GUI_PO_CUST~MAP_DYNPRO_FIELDS".
APPEND ls_subscriber TO re_subscribers.
Save and check & back
Double click on method IF_EX_ME_GUI_PO_CUST~MAP_DYNPRO_FIELDS".
Add the following code in the
method.
*given the field catalog of structure ZMARA we have to
*given the field catalog of structure ZMARA we have to
*establish a mapping to metafields
which are used for field selection
*purposes and error handling
Standard definitions can be found in type
*pool MMMFD. It is important for
customer fields to use integer
*constants above 90000000 for the
metafield.
FIELD-SYMBOLS: LIKE LINE OF ch_mapping.
LOOP AT ch_mapping ASSIGNING.
CASE-fieldname.
WHEN 'MATNR'.-metafield = mmmfd_cust_08.
FIELD-SYMBOLS:
LOOP AT ch_mapping ASSIGNING
CASE
WHEN 'MATNR'.
WHEN
'MTART'. -metafield =
mmmfd_cust_09.
WHEN
'MATKL'. -metafield =
mmmfd_cust_10.
ENDCASE.
ENDCASE.
ENDLOOP.
Save, check and back
Activate the Implementation class.
Activate the BADI
Implementation.
Now create a structure in SE11 with
the name ZMARA.
Add the following fields in the
structure.
Now Create a Program with the Name 'ZME_GUI_PO_CUST_SCREEN'
and create a screen with sub screen type with the number 0002.
Add the fields on to screen from ZMARA program 'ZME_GUI_PO_CUST_SCREEN'.
De comments the PBO module in
screen flow logic & create the module in above program.
Add the following code in program ZME_GUI_PO_CUST_SCREEN.
TABLES: ZMARA.
DATA: call_subscreen TYPE sy-dynnr,
TABLES: ZMARA.
DATA: call_subscreen TYPE sy-dynnr,
call_prog TYPE sy-repid,
call_view TYPE REF TO cl_screen_view_mm,
call_view_stack TYPE REF TO cl_screen_view_mm OCCURS 0.
* FORM
SET_SUBSCREEN_AND_PROG
*
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
* -->
DYNNR
*
* -->
PROG *
* -->
VIEW
*
* -->
TO
*
* -->
CL_SCREEN_VIEW_MM
*
*--------------------------------------------------------------------*
FORM set_subscreen_and_prog USING dynnr TYPE sy-dynnr
prog TYPE sy-repid
view TYPE REF TO cl_screen_view_mm.
call_subscreen = dynnr.
call_prog = prog.
call_view = view.
ENDFORM.
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module
STATUS_0002 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0002 OUTPUT.
SELECT SINGLE * FROM MARA
INTO
CORRESPONDING FIELDS OF ZMARA
WHERE
MATNR = '100-100'.
ENDMODULE. " STATUS_0002 OUTPUT
ENDMODULE. " STATUS_0002 OUTPUT
The sub-routine
"set_subscreen_and_prog" is must with the same signature.
This routine is called from BADI to
call the sub screen.
Activate the screen &
program.
Now Go to T-Code ME23N to test the
application.
You can find a new tab is added in
the item level with the name CUST BADI.
No comments:
Post a Comment