Abap Steps
Abap Steps
Abap Steps
Patil
mr.patilsumeet@gmail.com
odigotech
SE11 -> Select Domain radiobutton -> Specify name of the domain starting
with Z or Y -> Create -> Enter short description -> Select data type ->
Enter length -> Save -> Activate.
SE11 -> Select Data Type radiobutton -> Specify name of the data elementstarting with Z or Y -> Create -
> Enter short description -> Select 'Domain'radiobutton -> Specify name of the domain you created
previously -> PressEnter -> Save -> Activate -> Come back.
Create a table with the same navigations. Select 'DATA ELEMENT'
PUSHBUTTON from the Fields tab button.
Enter field name -> Select the checkbox of initial field to declare it as a
primary key -> Specify data element name -> Press Enter.
Database table
Create
(Sal asks reference table i.e. same table name & ref field is Sal type.)
Click on fields
Save(ctr+s)
local object
size category 0
save
back(F3)
save
back
********************************************************
st
[*] (1 data should be NUMC,if we gve another
like INT then buffering is not possible)[*]
(if activation log error comes then goto
utilities—database utility—click on activate—adjust database—click on yes—back)[*]
after display the records select the record—goto table
entry—change (here allows the changes the contents,save & back)[*]
(delete all ,it delets all slected records)[*]
(delete,it deletes one record)[*]
(transport entries,it sends to other person internet or
intranet or within R/3 to other user)[*]
to add 1 more field then click on rows then it allows
to rite another field[/list]
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
Below are step by step how to create append structure in SAP tables.
In this blog, I use my case where three new fields will be added into SAP table LIKP (Delivery Header
Data).
1. Using Abap Table Maintenance (transaction code SE11), display table LIKP. No need to change the
table. Just display!
2. In the table contain screen, click “Append Pushbutton” to add append structure.
3. It will rise pop up window contains created append structure object that ready to be assigned. On the
pop up window, click “Create Append” button.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
4. Input the append structure name and choose Enter. The name must lie in the customer namespace
(should begin with ZZ or YY).
5. On the Structure/Table maintenance screen, define the fields or component the build the structure. In
this screen, what we do here is same as like we create normal structure or tables. We can create foreign
key or search help attachment.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
The table will also be activated when the append structure is activated. The fields of the append structure
are appended to the SAP table in the database.
(Go To se21--> Enter name--->click CREAT--->Fill the attributes ---->Save---> Give the Transport
request.)
1. Open the Package Builder initial screen (SE21 or SPACKAGE).
2. In the Package field, enter a name for the package that complies with the tool’s Naming
Conventions
Within SAP itself, the name must begin with a letter from A to S, or from U to X.
3. Choose Create.
The system displays the Create Package dialog box.
4. Enter the following package attributes:
Short Text
Application Component
From the component hierarchy of the SAP system, choose the abbreviation for the application
component to which you want to assign the new package.
Software component
Select an entry. The software component describes a set of development objects that can only be
delivered in a single unit. You should assign all the sub-packages of the main package to this
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
software component.
Exception: Sub-packages that will not be delivered to customers must be assigned to
the HOMEsoftware component.
Main Package
This checkbox appears only if you have the appropriate authorization (see Prerequisites).
To indicate that the package is a main package, check this box.
5. Choose Save.
6. In the dialog box that appears, assign a transport request.
OR
2) Go to SE80 -> Edit Object (button) -> Development Coordination Tab -> Enter Package name and
then press the create button
You can add packages to a parent package in two ways. You can
● create new sub-packages from within a parent package
Or
● add existing packages to a parent package.
To create new sub-packages to the parent package:
...
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
1. Choose the Subpackages tab in the package builder OR right click on the parent package
name in the SE80 object list.
2. To create new sub-packages, choose the Create button in the Package Builder or choose
Create->Development Coordination->Package from the SE80 tree.
The system displays the Create Package dialog box.
3. Enter attributes for this package.
Enter a name for the package that complies with the Naming Conventions for Packages. Within
SAP itself, Basis package names must begin with S; other packages must begin with a letter
from A to R, or from U to X
4. Confirm your entries.
5. Repeat steps 1-4 for any other sub-packages you want to create.
6. Choose Save.
To add existing packages to a parent package, choose the Add button from within the Subpackages tab
and enter the name of the package.
=> The purpose of the foreign key is to validate the data that is being entered into a
table by checking entries in a check table. Foreign keys are checked by the front end user
interface only and it is not checked if you issue a direct a SQL statement to update the
database.
Follow the steps given below to create a foreign key in SAP table.
Step 1: Open the table in Data Dictionary (SE11) for which you want to create a foreign
key. Select the field for which you want to create the foreign key and press Foreign Keys
button.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
Step 2: In the popup window enter the check table name and press Generate proposal
button.
Step 3: The system proposes the foreign key relation based on the domain. Check that the
foreign key relationship proposed by the system is correct and press copy.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
Foreign key is created, now save and activate the table. To check the foreign key go to
menu path Utilities->Table Contents->Create Entries.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
Try to create an entry in “Zemployee” table with “Department ID” that is not there in the
“Department” table. Enter the values and try to save the entry.
Observe the error message in the status bar. The user interface does the foreign key
validation before creating the entries.
Go to transaction SE11 and select the radio button “Data type”. Enter a structure name starting with Y or
Z.
A pop-up screen appears with 3 different options. Select the radio button structure.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
1. Open TCode – SE11 for DDIC objects -> select the radio button for Search helps -> give the name of
the search help you want to create, ex – ZSH004.Click on Create .
2. In the next screen select the option “ Elementary search help “ .
3. Now you need to provide the short text for your search help.
4. In the selection method provide the table or view name you want to use for data retrieval. Ex.
ZMARA_01.
5. Select the dialog type according to your scope, ex. “ display values immediately’.
6. Then provide the search help parameters i.e. the interface parameters for the search help .
7. The ZMARA_01 table fields MATNR, ERSDA,MHDHB,MHDHT,MHDRZ are provided by selecting the
table fields , by doing this the data elements for these fields are automatically copied to the interface from
the selection method.
8. Now define the type of parameter ( import or export ) here for the selection and return of values in
runtime.
9. Provide the positions to these parameters to specify how they will be arranged in the hit list display.
10. Now save the object in the respective development class and check the same for errors and then
activate .Finally the creation of a ESH ( ex: ZSH004 ) is complete and can be used for providing the input
help.
You can test the operation of your search help by clicking F8.
The appearance of your search help will be like the fig. provided below.
1) Goto SE11
Enter the search help name and click on create.
2) Choose elementary search help radio button option as the search help type.
3) Enter the search help parameters, the selection method and activate the search help.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
2) Choose Collective search help radio button option as the search help type.
Note that there is no selection method to be entered for a collective search help.
4) Instead of the selection method, we enter the included search helps for the collective search help.
5)We need to assign parameters for each of the included search helps.
7) Collective search help offers the user to obtain F4 help using any of the included search helps.
1. Transaction: SE93
2. Enter Short Text
3. Select Radio button "Transaction with Parameters (Parameter Transaction)"
4. Next screen, give transaction as SM30
5. Check "Skip Initial Screen"
6. Under Default Values tab give two rows
a. VIEWNAME for screen field and <your table name> for value
b. UPDATE for screen and 'X' as value
7. Save and Execute.
ü Create container ( this is the area where u can view ur output ) by calling a screen.
Create reference variable for the container and create instance for container of class .Eg: r_container
TYPE REF TO cl_gui_custom_container
Double click on screen number,i.e 200,which gives a pop asking u if u want to create it.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
A icon with 'c' appears on the left side, click on it, this will come on right frame where u can drag it (this
will be your container).Give a name for the container.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
Goto flow logic,there u can find PBO(PROCESS BEFORE OUTPUT ),PAI(PROCESS AFTER INPUT ) events
with commented modules.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
U will get set pf-status and set title bar in the program .
With these create pf-status and give title for the ALV list.
Save it.
Create module under this event and double click this which will come to your program
Here u need to create objects for container and grid and call method of grid for displaying
ALV list.
In this screen select pattern for creating objects of container and grid
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
.
Create object of container and give the container name which u have assigned through
Graphical Screen painter.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
Now create object for the grid by selecting pattern and assign container as parent class.
Now call method of grid for ALV list display by selecting pattern
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
Pass the structure name and internal table name to this method.
Program : This is a simple ALV output which displays spfli records with ALV list.
* it_sort =
* it_filter = .
IF sy-subrc <> 0.
WHEN 'DISPLAY'.
LEAVE TO SCREEN 200.
ENDCASE.
ENDMODULE. " USER_COMMAND_2000 INPUT
12) VIEWS:
To implement the view created, use SE38 editor and write the following
code:
TABLES ZMYVIEW1.
SELECT * FROM ZMYVIEW1.
WRITE :/ ZMYVIEW1-MATNR, ZMYVIEW1-MTART, ZMYVIEW1-MBRSH,
ZMYVIEW1-MEINS,
ZMYVIEW1-WERKS, ZMYVIEW1-LVORM, ZMYVIEW1-MMSTA.
ENDSELECT.
Save -> Activate -> Execute.
In the above code, TABLES statement is used to create a temporary table
space area to hold the records of view.
STATEMENT:
SE11 -> Select SEARCH HELP RADIOBUTTON -> Specify search help name
starting with Z or Y -> Click on Create -> Select 'Elementary Search Help'
radiobutton -> Click on Continue -> Opens an interface -> Enter Short
description -> Specify table name in 'SELECTION TEXT' field -> Enter field
name in the first tabular column (Under search help parameter) -> Save ->
Activate.
To implement F4 functionality for parameters statement:
SE38 -> Create a program -> Enter the following code:
PARAMETERS MATNUM(20) MATCHCODE OBJECT ZMYSEARCH2.
WRITE MATNUM.
In the above code, 'MATCHCODE OBJECT' addition for parameters statement
is used to assign search help functionality for the parameter variable.
-> Save -> Activate -> Execute.
Type group is a data dictionary object used to store user-defined data types and constants.
DATA statement is used to declare variables for pre-defined data types.
TYPES statement is used to declare user-defined data types.
TYPE-POOL YMYTY .
TYPES : BEGIN OF YMYTY_STALIN,
NAME(20),
COURSE(10),
AGE TYPE I,
END OF YMYTY_STALIN.
TYPE-POOLS YMYTY.
DATA A TYPE YMYTY_STALIN.
A-NAME = 'JEGAN'.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
A-COURSE = 'ABAP'.
A-AGE = '24'.
WRITE :/ A-NAME, A-COURSE, A-AGE.
Save -> Activate -> Execute.
In the above example, TYPE-POOLS statement is used to access user-
defined data types created in a type group.
User-defined data types can be made globally accessed if saved under a type
group.
SYNTAX:
MESSAGE <type_of_message><message id>(message_class).
TYPES OF MESSAGES:
S - Status message.
I - Information message.
E - Error message.
W - Warning message.
A - Abort message.
T - Terminate message.
You can create up to 1000 messages in a single message class. The message
id ranges from 0 - 999.
15) VARIANTS:
This concept is used to create default values for the input fields. Variants are
helpful for the SAP end users and data entry operators.
EVENTS IN MPP:
PROCESS BEFORE OUTPUT (PBO)
PROCESS AFTER INPUT (PAI)
PROCESS ON VALUE REQUEST- To provide F4 functionality to MPP program
screen i/p fields.
PROCESS ON HELP REQUEST - To provide F1 functionality to MPP program
screen components.
Decomment PAI module -> Double click on PAI module name -> Click on Yes
to create PAI module object -> Opens PAI module -> Specify the following
code within module-endmodule statements:
CASE SY-UCOMM.
WHEN 'DISPLAY'.
LEAVE TO LIST-PROCESSING.
WRITE :/ IO1, IO2.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
-> Save.
Now double click on 'Includes' Folder (TOP INCLUDE FILE) -> Declare
EVENTS IN MPP:
PROCESS BEFORE OUTPUT - This event gets triggered whenever the
program is executed using Tcode. This event is used to assign initial default
values to the screen components.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
PROCESS AFTER INPUT - This event gets triggered after some user's action
in the screen (for eg, after clicking pushbutton, subsequent event
functionalities).
18)Menu Painter
Each menu item may have its own sub menu items.
Eg. code:
AT USER-COMMAND.
CASE SY-UCOMM.
ENDCASE.
Table Control component is used to view the table records and if needed, we can directly modify table
records and update the database table using table control.
Here, the records can be viewed in rows and columns format separated by
horizontal and vertical lines.
SYNTAX:
CONTROLS <table_Control_name> TYPE TABLEVIEW USING SCREEN
<MPP_screen_number>
CONTROLS statement is used to create a memory space area for table control component in AS.
TABLEVIEW is a data type for table control component.
SCREEN NUMBER should be specified to make the system know where the table control was physically
created.
Create a Normal screen (123) -> Drag and drop TABLE CONTROL component
from application toolbar -> Specify its name in attributes box -> Specify title
if necessary -> Select HORIZONTAL and VERTICAL SEPARATORS checkbox
-> If needed, select COLUMN and ROW selection radiobuttons -> Click on
Dictionary/Program Fields from Appn. Toolbar -> Specify internal table name
specified in top include file -> Click on 'GET FROM PROGRAM' pushbutton ->
Choose required fields -> Click on continue -> Place the fields in table
control component -> Add labels for each fields -> Create two pushbuttons
(FETCH, EXIT) -> Save -> Flow Logic.
In PAI module, write following code:
55
CASE SY-UCOMM.
WHEN 'FETCH'.
SELECT * FROM KNA1 INTO TABLE ITAB.
TABCTRL-LINES = SY-DBCNT.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
TABLE CONTROL:
This component is used to view the internal table records in MPP screen.
Table control modification:
LOOP AT ITAB-ENDLOOP statement in PBO is used to fetch the records into
internal table from db table.
LOOP AT ITAB-ENDLOOP statement in PAI is used to view the current data in
internal table through table control.
To make modification, create one more internal table for the same dbtablestructure used in top include
file. To move first internal table records to thenewly created one, create a separate module to specify a
statement for thispurpose b/w LOOP-ENDLOOP in PAI.
eg.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0800.
LOOP AT ITAB.
MODULE ITABTOITAB1.* New module
ENDLOOP.
eg.
ENDIF.
ENDLOOP.
Using normal screen, we can add only 40 components to the screen. To addmore than 40 components,
make use of tabstrip control. You can specify anynumber of tab fields for a tabstrip control and create
subscreen for each tabfield created.
Now create two subscreens (10, 20) for each tab field subscreen areas.
Create required screen components for each subscreen (input fields namely
IO1, IO2, IO3, IO4) -> Save -> Come back to Flow logic editor.
In TOP INCLUDE FILE, specify following code:
DATA : IO1(10), IO2(10), IO3(10), IO4(10).
CONTROLS KARTHIK TYPE TABSTRIP.
DATA SCREEN LIKE SY-DYNNR .
CONTROLS statement is used to create a memory for tabstrip component in AS.
SY-DYNNR is a system variable to hold screen number.
In the FLOW LOGIC EDITOR, Specify following code for PBO and PAI
modules:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
CALL SUBSCREEN SUB2 INCLUDING 'SAPMYONCEMORE' '20'.
CALL SUBSCREEN SUB1 INCLUDING 'SAPMYONCEMORE' '10'.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
CALL SUBSCREEN SUB1.
CALL SUBSCREEN SUB2.
Save -> Activate.
Specify following code in PAI event between module-endmodule statements:
CASE SY-UCOMM.
WHEN 'DISPLAY'.
LEAVE TO LIST-PROCESSING.
WRITE :/ IO1, IO2, IO3, IO4, IO5.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'TAB1'.
SCREEN = '10'.
KARTHIK-ACTIVETAB = 'TAB1'.
WHEN 'TAB2'.
SCREEN = '20'.
KARTHIK-ACTIVETAB = 'TAB2'.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
ENDCASE.
Create Tcode -> Activate all components -> Execute the program.
This concept is used to provide drop-down facility for the input fields createdusing screen painter. Here, a
type group called VRM is used in which we havefollowing structure and internal table:
VRM_VALUE is a structure with following fields,
KEY - Code for the display value
TEXT - Content of the display value
VRM_VALUES is an internal table created for the above structure without
header line.
Declare an internal table (ITAB) of type VRM_VALUES and also declare an
explicit structure (WA) to append values into internal table using LIKE LINE
OF statement.
VRM_SET_VALUES is the function module used to fetch records from internal
table ITAB to input field IO1
Internal table data -> Move this fields into Recording Object fields by clicking
on "Default all" pushbutton from application toolbar -> save the Entries ->
Come back -> come back ->Change mode of the screen into Change mode
-> Select the radiobutton called as Batch Input Recording -> Name the
recording Object ( ZREC1 ) -> Save the Entries -> Come back .
the same way map all Fields of Recording Object with All Fields of Internal
table -> Save the Entries -> Come back.
24) SAPSCRIPTS.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
This is a tool used to redirect SAP data to output devices. SE71 is the Tcode to create SAPScript.
Components of a SAPScript tool are:
1. BASIC SETTINGS.
Paragraph format, character format.
2. ADMINISTRATIVE SETTINGS.
Types of Windows:
1. Main Window - This is a common window for all pages. This is a default window.
2. Constant Window - This window is used to create footer space, header space for a particular page.
3. Variable Window - This is a subwindow.
4. Graphical Window - This is an optional window, which is used to create
logos or some other graphics for the page.
-> Save -> Activate -> Execute -> Opens an interface -> Specify output
device as LP01 -> Click on Print Preview (F8) pushbutton -> Executes the
form.
The FM 'OPEN_FORM' is used to call the sapscript form. Here, we have to
specify the name of the form as an argument.
'WRITE_FORM' is used to specify the name of the text elements and window types.
'CLOSE_FORM' is used to save and close the form attributes.
eg. &KARTHIK&.
To pass a value from the print program to the form, declare the variable as
follows in Print PRogram:
DATA KARTHIK(10) VALUE 'CHENNAI'.
....OPEN_FORM
...
....CLOSE_FORM
Save -> Activate -> Execute.
/E ELEMENT
&KNA1-KUNNR& ,, &KNA1-NAME1& ,, &KNA1-LAND1&
Save -> Activate.
In the Print Program, specify following code:
TABLES KNA1.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM
= 'ZSHABFORM1'
LANGUAGE
= SY-LANGU.
SELECT * FROM KNA1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT
= 'ELEMENT'
WINDOW
= 'MAIN'.
ENDSELECT.
25) SMARTFORMS
ADVANTAGES OF SMARTFORMS:
1. Smartforms does not require paragraph formats as a mandatory one.
2. Smartforms does not duplicate the data.
3. Smartforms are Client-independent and language-independent.
4. We can apply styles for the texts using Smartforms.
5. Print programs does not contain any function modules to call the form.
SMARTFORMS is the Tcode to create smartforms in ABAP.
Smartforms has three components:
Global Settings:
1. Form Attributes - Holds the description about the smartform.
2. Form Interface - Holds the import and export parameters for the
smartforms.
3. Global Definitions - Used to declare variables for the smartform that can
be accessed by any component within the smartform.
Pages and Windows:
This area is used to create new pages, windows (header, footer, constant
window, main window, variable window, graphic window).
Navigations to create Smartforms:
SMARTFORMS -> Specify form name starting with Z or Y -> Click on Create
-> Opens an interface -> Enter short description -> Double click on Form
Interface -> Specify following parameter in IMPORT tab button:
STR TYPE C
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
-> Expand Pages and Windows -> By default, a Main Window is present ->
Right click on Main Window -> Create -> Text -> Opens Form Editor -> To
go to line editor, Click on 'Txt Editor' pushbutton on the upper left corner of
the form editor -> Specify the variable (&STR&) in the first line of line editor
-> Come back -> Save -> Activate -> Execute -> Opens Form Builder with
autogenerated function module for the smartform ('/1BCDWB/SF00000042')
-> Copy the function module generated.
To invoke the smartform from SE38 editor, Call the Function module and
paste the FM copied from smart form function builder screen as follows:
DATA NAME(10) VALUE 'INDIA'.
CALL FUNCTION '/1BCDWB/SF00000042'
EXPORTING
82
STR
= NAME.
-> Save -> Activate -> Execute in the same way as Sapscript.
Navigations to pass internal table as an argument to Smartforms:
Create a smartform -> In the Form interface -> Click on Tables tab
-> Double click on Global Definitions -> Specify the global variable as
follows:
-> Expand Pages and Windows -> Right click on Main Window -> Create ->
Table -> Click on Data tab button -> In the LOOP section, for the operand
fields, specify the following:
ITAB INTO ITAB1.
-> Right click on Main Area -> Create -> Table Line -> In the Line Type input
field, a line type called %LTYPE1 is automatically generated -> Select it.
To create internal table fields, right click on Text cell -> Create -> Text ->
Select General Attributes tab button -> Opens Form Editor -> Goto Line
editor by clicking on 'Txt Editor' pushbutton -> Specify the following in the
first line:
&ITAB1-MATNR&,,&ITAB1-MTART&,,&ITAB1-MBRSH&,,&ITAB1-MEINS&
-> Come back -> Save -> Activate -> Execute -> Copy the autogenerated
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
FM.
26) 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 bundeled in enhancement packages . Neverthiless existing
USEREXITS will be supported by SAP an all the newer versions of SAP.
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 .
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.
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
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.
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.
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
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
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'
e.g.
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
Author: Sumeet .B.Patil
mr.patilsumeet@gmail.com
odigotech
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.
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.
Example:
tables
xvbfa = xvbfa
xvbap = xvbap
xvbup = xvbup.
Display the program where you are searching for and exit and search for CALL CUSTOMER-EXIT
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
Activate the include program. Go back to CMOD and activate the project.
8) place the cursor on the method name desc its parameters to define the interface.
Parameter type refe field desc
I_carrid import spfli-carrid some
I_connid import spefi-connid some
“AAA”
“BBB”
*&---------------------------------------------------------------------*
*& Report ZBADI_TEST *
*&---------------------------------------------------------------------*
REPORT ZBADI_TEST .
tables: spfli.
start-of-selection.
select * from spfli into corresponding fields of table it_spfli
where carrid in s_carr.
end-of-selection.
loop at it_spfli into wa_spfli.
write:/ wa_spfli-carrid,
wa_spfli-connid,
wa_spfli-cityfrom,
wa_spfli-deptime,
wa_spfli-arrtime.
endloop.
at line-selection.
check not wa_spfli-carrid is initial.
create object exit_ref.
exit_ref1 = exit_ref.
clear wa_spfli.