Wednesday, January 8, 2014

TAW12 ENHANCEMENT USING CUSTOMER EXITS

ENHANCEMENT USING CUSTOMER EXITS: OVERVIEW DIAGRAM



You can categorize customer exits under Enhancements as shown here.

CUSTOMER EXITS: OVERVIEW



This slide shows an overview of Enhancement Management.


SAP APPLICATION ENHANCEMENT



Customers can enhance applications by defining their own functionality. Customer exits are preplanned by SAP and are usually a combination of several components. Initially, when application enhancements are delivered they are inactive. They can be modified and activated by customers as per their requirements.

CUSTOMER ENHANCEMENT PROJECT

Application programmer can create enhancements using program exits, menu exits, and screen exits or any combination of these. SAP provides a standard transaction code, SMOD, for managing the enhancements. This transaction code also gives a list of available enhancements. On the other hand, you need transaction CMOD for creating an enhancement project.


ENHANCEMENTS AND ENHACEMENT


Enhancement components consist of Program exits, menu exits, and screen exits. An enhancement is a combination of different components, as shown here. An enhancement project is a combination of different enhancements. As a customer, you must edit all enhancements that are activated simultaneously in an enhancement project.

THE SAP ENHANCEMENT CREATION PROCEDURE



Customer exits define program exits, menu exits, and screen exits. An enhancement created using a combination of these can be termed as an SAP enhancement. The developer must document enhancements properly, so that in future, customers can implement these enhancements without analyzing program source code or screen source code.

PROCEDURES AT THE CUSTOMER'S PREMISES

As a customer, you first need to create an enhancement project and then select the required SAP enhancements. The next step is to edit the individual components using the project management functions. The customer must also document enhancements. Finally, as soon as the enhancement project is active, all the components of the project get activated automatically.

CREATING A CUSTOMER ENHANCEMENT PROJECT



You can call transaction CMOD to create an enhancement project. Next, you need to specify a project name by which the system can identify the enhancement. Finally, you need to select the Attributes radio button to provide a short description for the enhancement project.

ASSIGNING SAP ENHANCEMENT TO CUSTOMER PROJECTS



An existing SAP enhancement can be assigned to a customer enhancement project using transaction CMOD. In the initial screen of CMOD, select Enhancement assignment radio button and click Change, as shown here. The resultant dialog box shows a list of available enhancements along with their description.

EDITING COMPONENTS



You can edit the components of an enhancement project in the initial screen of CMOD. For this, select Components and click Change. If the component you are editing is a function module, then the Function Builder screen appears. However, in case of a menu item, a dialog box with menu options appears. If a subscreen is edited, then the control is transferred to the Screen Painter screen.

ACTIVITING ENHANCEMENT PROJECTS

To activate an enhancement project, click the Activate button. After successful activation, all the components are automatically active, and the project status appears active.

TRANSPORTING PROJECTS


When a user creates an enhancement project, a transport request is assigned to it. All the components should also be assigned to the same change request. This facilitates smooth transport of the entire enhancement simultaneously using a single change request.


PROGRAM EXIT OVERVIEW



A customer can implement additional logic in applications by using Program Exit. It is executed using a function module. A programmer needs to clearly define the interface of the function module for data transfer and specify where it is used. The customer defines the source code for the function module. The additional source code is implemented when the enhancement project is active.

PROGRAM EXITS: ARCITECHTURE



A program exit is defined in an application program using a function module. The corresponding function module is called using the statement, CALL CUSTOMER-FUNCTION. When the function module is called, the function group is loaded in the user’s internal session.

PROGRAM EXITS: SYNTAX

You can call the function module ‘001’ using the statement, CALL CUSTOMER-FUNCTION. Here, ‘001’ represents a three-digit code. Function modules are present in the function groups which have names beginning with ‘X’. The name of a function module begins with the prefix EXIT, followed by the function module name, and a three-digit code. The three parts of the name are separated by an underscore. Customer-specific code is defined in the INCLUDE present in the function module.

FINDING PROGRAM EXITS


For finding program exits available for an application program, you need to
  follow the menu path, System → Status;

  double click the program name in the dialog box;

  search for the string, CALL CUSTOMER;

  call transaction CMOD;

  choose Utilities → SAP enhancements; and

  search for the component name EXIT_<program_name>

The name of the required enhancement can be found using the application hierarchy in Repository Information System or IMG.


EDITING PROGRAM EXITS

You need transaction CMOD to edit the function module exit. Select the Components radio button and click Change. Subsequently, the system shows the corresponding INCLUDE program. Finally, double-click the INCLUDE statement to modify the source code.

STRUCTURE OF A FUNCTION GROUP
When a program calls a function module, the associated function group is loaded in the program context. Global data of the program is stored in the TOP include. All function modules are stored in includes. As shown here, the include with suffix, UXX, stores all the function modules sequentially. The program also contains a subroutine.

STRUCTURE OF AN EXIT FUNCTION GROUP


The name of an exit function group defined for enhancements begins with LX or ZX. Here, ZXAAATOP contains global customer data; whereas, ZXAAAU01 and ZXAAAU02 contain customer source code. You can only edit the include stored in customer namespace.

GLOBAL DATA OF AN EXIT FUNCTION GROUP

In this example, the include program, LXAAATOP, contains FUNCTION-POOL that should not change. The include LXaaaTAP contains global SAP application data. However, customer-specific global data is present in include ZXaaaTOP.

CUSTOMER-SPECIFIC PROCESSING BLOCKS

The function module, LXAAAU01, contains the INCLUDE ZXaaaU01. Therefore, this include cannot contain any events or subroutines. Any data declarations done in this include are valid only in its context. The INCLUDE LXAAAF00 is created to specify source text.


OTHER SAP OBJECTS IN AN EXIT FUNCTION GROUP

Includes also contain various subobjects, such as subroutines, PBO modules, PAI modules, and ABAP events. As depicted here,
  LXAAAF01 contains subroutines delivered by SAP.

  LXAAAE01 contains the events belonging to the X function group.

  LXAAAO01 contains PBO modules for screens to be delivered.

  LXAAAI01 contains the corresponding PAI modules.


CUSTOMER OBJECTS IN AN EXIT FUNCTION GROUP

All subobjects are created as includes. These are included in a function group using another INCLUDE program, as shown here. The naming convention followed for different subobjects is
  ZXAAAF01 for subroutines;

  ZXAAAO01 for PBO modules;

  ZXAAAI01 for PAI modules; and

  ZXAAAE01 for events.


CUSTOMER SCREENS

The customer-defined screens in enhancements can be called using the CALL SCREEN statement. Here, the INCLUDE, ZXaaaU01, contains the CALL SCREEN statement. However, in this case, two separate includes, ZXAAAO01 and ZXAAAI01, need to be created for both PBO and PAI modules, respectively.

SUMMARY: PROGRAM EXITS


A customer can enhance SAP applications by adding source code at predefined points. As shown here, CALL CUSTOMER-FUNCTION calls the EXIT function module. The includes used in the process can call screens by defining their GUI and processing logic. The INCLUDE, ZXaaaU01, calls screen 9000, which in-turn calls the screen 9100. The text elements and GUI for the screens are defined in the INCLUDE.

MENU EXITS OVERVIEW


You can use menu exits to add menu options in standard SAP menus. There are certain menu options that are reserved by SAP in the user GUI interface. As a result, the user can add functions to those menu options. In this slide, Customer Fcn menu item is added to Menu 2. The user can also define the menu text. The user menus are visible only on activation.


MENU EXIT REQUIREMENTS

In menu exits, the function code for menu items must begin with ‘+.’ On activation, the added menu options are visible in the menus.

MENU EXITS AND PROGRAM EXITS

When the menu item is selected, the corresponding source code is implemented. The CALL CUSTOMER-FUNCTION statement calls the customer functions for the menu.

NAMING AND EDITING MENU EXITS

You can edit menu exits by using transaction CMOD. When you click Change, the system displays a dialog box where you can give a short description for additional menu items.

SCREEN EXITS OVERVIEW

By using screen exits, you can add additional screen fields to an existing screen. You can execute a screen exit through a reserved part on the main screen.

SUBSCREEN (GENERAL)

A subscreen is a reserved rectangular area on a screen. As shown in this example, the subscreens 200 and 300 contain different fields. These subscreen items are visible only after activation.

CALLING A NORMAL SUBSCREEN

In screen exits, a subscreen must be called within the PBO and PAI of the main screen. The syntax for subscreen call in PBO is CALL SUBSCREEN ‘abcd’ INCLUDING sy-cprog ‘1234’. Here, abcd is the subscreen name, sy-cprog is the system variable, which returns the name of the calling program, and ‘1234’ is the screen number. The syntax call in PAI is CALL SUBSCREEN abcd.

DEFINING SCREEN EXITS

Multiple subscreen areas can be added to the main screen in a screen exit. Customer-specific fields are inserted when the system encounters the CALL CUSTOMER-SUBSCREEN statement in the PBO of the main screen.

CALLING CUSTOMER SUBSCREEN

For each subscreen, PAI and PBO events are processed as if the subscreen is a part of the normal screen. When the CALL CUSTOMER-SUBSCREEN statement occurs in PBO, the subscreen area is called in the main screen. The statement, CALL CUSTOMER-SUBSCREEN, in PAI of the main screen triggers the PAI of the subscreen.

EXPORTING DATA TO SUBSCREENS

The X function group acts as a container for screens. It cannot access the global data declared in an application program. Therefore, program exits are used in order to transfer data from program to the subscreen.


TRANSPORTING DATA FROM SUBSCREENS

Global data of the X function group is unavailable to the program. However, data transfer between the program and the subscreen is mutual. It is for this reason that program exits are used to transfer data from program to subscreen.

NAMING AND EDITING SCREEN EXITS

This slide illustrates how to name and edit screen exits. For this, click transaction CMOD. You need to select Components and click Change, as shown here. The system displays the screen exit along with a list of associated program exits. You can then navigate to Screen Painter to modify the UI elements in the screen exit.

EDITING SUBSCREENS

When a user wishes to edit a screen exit, the system looks for subscreens associated with the screen exit. If a subscreen is present, the user can navigate to Screen Painter. However, if a subscreen does not exist, the system proposes the user to create one. While creating subscreens, the screen type should be specified as Subscreen.

1 comment: