Professional Documents
Culture Documents
Abap PDF For Beginners
Abap PDF For Beginners
VINAYAKA
SAP: - (System Applications and Products in data Processing).
ABAP: - (Advance Business Application Programming)
Programming Languages: - C, C++, Java, .Net.
Packages: - Word, Excel, Tally, Focus, Wings
Operating System: - Dos, Windows, Unix, Linux..
Database: - Oracle, Sql Server, Mysql.
ERP Products: - SAP, Oracle Applications, Siebel, CRM..
Package: - Package is a set of rebuild instructions. Readymade built in functions.
Database: - Database is stored the data permanently.
Enterprise: - Organization or Company.
Resource: - Money
Man power
Material
Machinery
Marketing
Finance,
HR,
Material Management,
Production,
Sales.
1|Page
Santosh P
YES BLILLING
WAREHOUSE
DEPARTMENT
CUSTOMER
ENQUIRER
MARKETING
QUOTATION
PLACE ORDER
METERIAL
SALES
PURCHASE
ORDER
SALES ORDER
DELIVERY
NO
ROW
PRODUCTION
MATERIAL
MANAGEMENT
RAW MATERIAL
NOT AVLIABLE
VENDOR 1
CHECK FOR STOCK VENDOR 2
VENDOR 3
PURCHASE
FUNDS
FINANCE
Function consultant
Technical consultant
Techno functional consultant
Basis consultant
FUNCTION
1)
2)
3)
4)
5)
6)
SAP FICO
SAP HR
SAP MM
SAP SD
SAP CRM
SAP PM
....N
:
:
:
Modules
2|Page
TECHNICAL
1) ABAP
2) HR ABAP
3) WEB DYNPRO
4) CRM TECHNICAL
5) WORK FLOW
6) BI/BW
7) TF
8) EP (Enterprise portal)
Santosh P
3|Page
Santosh P
4|Page
Santosh P
Field n,
End of <Structure name>.
Syntax2: Data: <Structure> like <existing structure>.
NOTE: - Existing structure can be a local structure or it can be a dictionary structure
created in the database.
The above syntax only copies the fields from one structure to another structure.
MOVE: - Statement is used for copying the data between two similar structures. Only
checks for the corresponding fields for data types between two structures. It does not check
for no of fields and fields name.
5|Page
Santosh P
6|Page
Santosh P
DICTIONARY OBJECTS: 1)
2)
3)
4)
5)
6)
7)
Database Tables
Views
Data Type
Type Group
Domain
Search Help
Lock Object
Transparent
Pooled
Cluster
Transparent: It is used to store application data such as master data transactional data. We
always create transparent table only.
There is one-to-one relationship i.e. for the table DDIC another table with the
same structure and the same name and the same fields will be created in the
original data base.
Pooled: It is used for exclusively for storing internal control information.
The data from several different pooled tables can be stored together in a table
pool.
This is many-to-one relationship.
Cluster: Cluster tables are logical tables that must be assigned to a table cluster when they
are defined.
Cluster tables can be used to store control data. They can also be used to store
temporary data or texts, such as documentation.
2) Views: It is a data dictionary object. It is considered as a pseudo table, A view never occupy any
physical space in the database server.
i.
ii.
iii.
iv.
Database View
Projection View
Maintenance View
Help View
7|Page
Santosh P
Database View: Database views are implemented with an equivalent view on the database.
Database views are defined in the ABAP dictionary. A database view is
automatically created in the underlying database when it is activated.
Projection View: Projection views are used to hide fields of a table. This can minimize interface.
A projection view contains exactly one table. You cannot define selection
conditions for projection views.
Maintenance View: Permit you to maintain the data distributed on several tables for one application
object at one time.
Help View: Help views can be used as selection method in search helps.
3) Data Type: i.
ii.
iii.
Data Element
Structure
Table Type
Data Element: A data element is a reusable dictionary object. Which provides the short
description for the field? This description appears automatically on the
transaction.
A data element created at once can be used across many places.
Data element can be created either by referring a direct data type or by referring to
a domain.
Structure: - It is a user defined data type which is a collection of different types of fields.
Structure is used for storing record kind of information. At any point of time the
structure can store only single record.
Table Type: Table type is an internal table create at a data base level it can be associated with a
line type. A line type can be a data element or a structure.
A table type is a global internal existing at the database level.
The table type determines how ABAP will access individual table entries. Internal
tables can be divided into three types.
i.
Standard Table
ii.
Sorted Table
iii.
Hashed Table
8|Page
Santosh P
Standard Table: - Standard tables have an internal linear index. From a particular size
upwards, the indexes of internal tables are administered as trees. In this case, the index
administration overhead increases in logarithmic and not linear relation to the number of
lines. The system can access records either by using the table index or the key. The response
time for key access is proportional to the number of entries in the table. The key of a
standard table is always non-unique. You cannot specify a unique key. This means that
standard tables can always be filled very quickly, since the system does not have to check
whether there are already existing entries.
Sorted Table: - Sorted tables are always saved sorted by the key. They also have an
internal index. The system can access records either by using the table index or the key. The
response time for key access is logarithmically proportional to the number of table entries,
since the system uses a binary search. The key of a sorted table can be either unique or nonunique. When you define the table, you must specify whether the key is to be unique or not.
Standard tables and sorted tables are known generically as index tables.
Hashed Table: - Hashed tables have no linear index. You can only access a hashed table
using its key. The response time is independent of the number of table entries, and is
constant, since the system accesses the table entries using a hash algorithm. The key of a
hashed table must be unique. When you define the table, you must specify the key as
UNIQUE.
4) Type Group: -They define data types in a type group in the ABAP/4 Dictionary instead
of defining them within an ABAP/4 program.
The type group name in the ABAP/4 Dictionary has a maximum of 5 characters.
Type names within type group <typepool> must begin with <typepool> followed
by an underscore.
The types in a type group must be declared in ABAP/4 programs with the TYPEPOOLS command.
Syntax: - types-pools <type poolname>/<type groupname>.
5) Domain: A domain is a reusable dictionary object which stores technical properties of the
field. The technical properties include data type, size, value range, value table.
6) Search Help: - Search help are two Types.
i.
Elementary Search Help
ii.
Collective Search Help
Elementary Search Help: - describe a search path. The elementary search help must define
where the data of the hit list should be read from (selection method), how the exchange of
values between the screen template and selection method is implemented (interface of the
search help) and how the online input help should be defined (online behavior of the search
help).
9|Page
Santosh P
Collective Search Help: - combine several elementary search helps. A collective search
help thus can offer several alternative search paths.
7) Lock Object: The R/3 system synchronizes access of several users to the same data records with
a lock mechanism. When interactive transaction is programmed, locks are set and
released by calling modules. These function modules are automatically generated
from the definition of lock object in the ABAP dictionary.
.Include: .Include is a keyword used at the field level to include a dictionary structure in
another dictionary structure.
Corresponding Fields: As part of select query when the no of fields or sequence of fields retrieved from
database table is not matching with the target internal table or structure then we need to use
corresponding fields statements in the select query.
Describe: - Describe table statement counts the no of records in the internal table and stores
the count value in the system field SY-TFILL.
Select-Options: - It is the internal table provided by sap which is associated with 4 fiedls.
1) LOW
2) HIGH
3) OPTION
4) SIGN
LOW: - It will stores lower limit.
HIGH: - It stores upper limit.
OPTION: - Possible values are <, >, <=, >=, bt (between, default)
SIGN: - I (inclusive, default) or E (exclusive).
Selection-options are used for reading the range of values.
INITIALIZATION: - It is the event triggered by sap before displaying the selection
screen. It is used for initializing the selection screen fields. It is triggered only once in the
life time of a selection screen.
10 | P a g e
Santosh P
Insert: - Insert statement always inserts a new record and ignores records if it already
exists. It only checks for primary key field values.
While inserting the data into database table from an internal table it is always
recommended to use modify statement instead of insert statement. Because incase
of insert if the duplicate record is found it results in runtime error.
To avoid the runtime errors use accepting duplicate keys. Without accepting
duplicate key we have a runtime error. But this is not recommended.
Modify: - modify statement it insets a new record or update the existing records.
Clear: - Each & every time we will write clear statement. It clears the local structure
clearing from work area.
Syntax for inserting data into database table from an structure: Insert/modify <dbtable> from table <workarea>.
Syntax for inserting data into database table from an internal table: Inset/modify <dbtable> from table <internal dbtable>
Read Statement: - It is used for reading a specific record from the internal table. Read
always reads the single record even if there are multiple records satisfying the conditions.
Read statement can be used either based on an index or based on a condition.
By default read follows linear search first to last.
The index of the internal table starts form 1.
It is always recommended to use the read statement to sort the internal table
before using binary search.
Transporting: - By default read statement transports all the fields between body to work
area.
To transport only specific fields use transporting keyword as part of read
statement. This improves the performance.
SELECT ENDSELECT: - Select end select is considered as database loop and it retrieves
single record per request.
Select-endselect it always retrieves single record per request.
The no of select queries depends upon the no of records satisfying the criteria.
It there are more no of select queries it increases the network traffic there by
decreases the performance. This is the reason it is recommended not to use select endselect.
11 | P a g e
Santosh P
Standard SQL: - It is a set of SQL statement to interact with database systems from the
front end applications like Java, .net etc..
From ABAP we can use two type of SQL statement.
1. Open SQL
2. Native SQL
Open SQL: Native SQL: - Every database vendor provides a set of SQL statements to interact with
their own database systems. This statements are specific to database.
Note: For native SQL the variables are preferred (:) bind variables.
It should not end the statement with (.) period & separate the variable by comma
(,) to select query.
Note: Native SQL statements always embedded between execute SQL and end execute.
Cursors in open SQL: - A cursor is a special data structure it can be use for storing
multiple records by using cursors we can avoid the usage of internal tables.
Step1: - Declare the cursor.
Syntax: - data : <cursor name> type cursor.
Step2: - Open the cursor.
Syntax: - Open cursor <cursor name> for <select query>.
Note: Only select statement can be associated with cursors.
Whenever a cursor is opened a select statement associated with the cursor will be
processed and the output of the select query is called as active set.
Step3: - Read the cursor contents.
Syntax: - Fetch next cursor <cursor name> into <target variable>.
Step4: - Close cursor <cursor name>.
Cursors in native SQL: Step1: - Open the cursor.
Syntax: - Open <cursor name> for <select query>.
Step2: - Read the cursor contents.
Syntax: - Fetch next <cursor name> into <target bind variables>.
12 | P a g e
Santosh P
MESSAGE
000
001
002
003
004
005
006
007
RECORD INSERTED
RECORD NOT INSERTED
RECORD MODIFIED
RECORD NOT MODIFIED
RECORD DELETED
RECORD NOT DELETED
RECORD FOUND
RECORD NOT FOUND
Join - Joins is used to extract the data from several tables by joining them together with
s
a common field. If the field is replaced in several tables we need to identify that field along
with table name, hence ~ (tilt symbol) is used along with the table allies name in order to
uniquely identify a field from specified table. Joins are two types.
1) Inner join
2) Outer join
1) Inner join: - This type of join will retrieve the data from multiple tables if the data is
found commonly in all the tables, if any one of the table doesnt contain for the given
condition no data is extracted from any of a table, only transparent tables can be used
within the joins.
13 | P a g e
Santosh P
TABLE A
A
a1
a2
a3
a4
a5
B
b1
b2
b3
b4
b5
C
c1
c2
c3
c4
c5
TABLE B
D
d1
d2
d1
d4
d5
D
d1
d2
d3
d2
d5
E
e1
e2
e3
e4
e5
F
f1
f2
f3
f4
f5
F
f1
f2
f4
f1
f5
G
g1
g2
g4
g1
g5
H
h1
h2
h4
h1
h5
G
g1
g2
g3
g4
g5
H
h1
h2
h3
h4
h5
B
b1
b2
b2
b3
b5
C
c1
c2
c2
c3
c5
D
d1
d2
d2
d1
d5
D
d1
d2
d2
d1
d5
E
e1
e2
e4
e1
e5
2) Outer join: - Whenever you used the right side table record with left side table, if the
common record found in both table then the system will extract the data from both
tables. It for the specified field, the record does not exist in right side table, then system
will extract left side record into consideration.
TABLE A
A
a1
a2
a3
a4
a5
B
b1
b2
b3
b4
b5
C
c1
c2
c3
c4
c5
14 | P a g e
D
d1
d2
d1
d4
d5
TABLE B
D
d1
d2
d3
d2
d5
E
e1
e2
e3
e4
e5
F
f1
f2
f3
f4
f5
G
g1
g2
g3
g4
g5
H
h1
h2
h3
h4
h5
Santosh P
B
b1
b2
b2
b3
b4
C
c1
c2
c2
c3
c4
D
d1
d2
d2
d1
d4
D
d1
d2
d2
d1
0
E
e1
e2
e4
e1
0
F
f1
f2
f4
f1
null
G
g1
g2
g4
g1
0
H
h1
h2
h4
h1
null
a5
b5
c5
d5
d5
e5
f5
g5
h5
Increases reusability
Better maintenance
Performance improvement
Readability
Controlling the flow of the program
Santosh P
Pass by value: - In pass by value the values of actual parameters are copied to formal
parameters. Any changes made to formal parameters will not reflect actual parameters value
is a keyword used to pass the parameters by value.
Function Module: - Function module is a set of statements it is defined only once and it
can be called any no of times. It is developed by using function builder tool. Function
module is stored inside function group.
Function group: - A function group is a repository object with can contain different type of
repository object like function modules, Classes, subroutines, etc.
Function group can be created by using SE80/SE37. Whenever a function group is
created two include programs will be created.
1) In clu d e en d in g wit h TOP : - It is called as top include file and it can contain
global declarations, subroutine definitions and module definitions.
2) In clu d e en d in g wit h UXX : - It is include generated for sap
purpose.
In this sub include will be generated. Whenever a new function module is created.
Each sub include is reference to a function.
Sections in function builder tool: 1)
2)
3)
4)
16 | P a g e
Santosh P
Exceptions in function modules: An exception is a runtime error which is raised during the execution of a program.
Exception handling is a process of handling the runtime errors and continues the
program execution without termination.
In function modules we can handle the standard exception by using try & catch.
Example: - O/P: - 66/0 It is runtime error exception occurs.
We can handle the standard exceptions by using try & catch blocks.
Inside the try block we need to keep these statements where the possible error
might occur.
Inside the catch block we need to handle the exception. The catch block is placed
immediately after the try block.
Whenever an exception is raised in the try block SAP creates the appropriate
exception class objects and the control is transferred to catch block.
Catch CX_ROOT is parent class of catch we cant sure able to the choose class
we can use CX_ROOT.
User defined exception in function modules: In case of system defied exceptions the standard exception is declared & raised by
Sap itself & it is handled by the developer.
In case of user defined exceptions it is declared raised and handled by the
developers.
Step 1: - Declare the user defined exceptions in the exception tab of the function module.
Step2: - Raise the exception in the source code at the appropriate place by using raise
statement.
Step3: - Handle the exception I the calling program by checking the SY-SUBRC status.
Note: - If no exception is raised SY_SUBRC set to ZERO.
Macro: - If you want to reuse the same set of statements more than once in a program, you
can include them in a macro.
It is used in HR-ABAP
Macro is a predefined constant which can hold 9 different placeholders. (parameters).
Syntax for defining macro: Define <macro name>.
Statements with place holders.
End-of-definition.
17 | P a g e
Santosh P
Santosh P
Note: - Screen is a structure provided by SAP this structure will act as internal table in the
run time. This structure holds the information of the screen-elements.
3) At selection-screen: - This event is triggered in the following cases.
When the user presses enter key in the I/O field.
When the user clicks on selection-screen push buttons.
In this case the function code of the push button is captured in the system field
SY-UCOMM.
Note: - If a data element is associated with a search help then by default f4 help available
provided for the field whenever it is used on selection screen or dialogue screen.
It the search help is not attached with the data element level then manually we
need to attach f4 help. For a selection screen field or a dialogue screen field.
4) At selection-screen on value-request: This event is triggered when the user presses f4 key on a selection-screen I/O field.
F.M:- F4IF_INT_TABLE_VALUE_REQUEST
Is a function module used for displaying the internal table contents as a list of values.
Whenever k4 key is pressed on a field.
Selection-screen tabbed blocks: A tabbed block is a collection of tabbed button.
Each tab button is associated with a sub screen a sub screen is a part of a screen.
Syntax: slection-screen begin of tabbed block <tab.blockname> for <n> lines.
Declaration of tab buttons.
Selection-screen end of block <tab.blockname>.
Note: - If the tabbed block does not have any tab buttons then it results to runtime error.
Dynpro does not exist.
Syntax for declaring tab buttons: Selection-screen tab (<width>) <name> user-command <function code>.
Selection-screen begin of screen 100 as subscreen.
Selection-screen begin of lines.
Selection-screen end of line.
19 | P a g e
Santosh P
Syntax for sub screens: Selection-screen begin of screen <screen no> as subscreen.
Properties of tabbed block: 1) Active tab: - It holds the function code of the tab button which needs to be activated.
2) Program: - It holds the name of the program where the sub screen is existing.
3) Dynnr: - It holds the sub screen no, which needs to be associated with the active tab.
Adding push buttons on selection-screen application toolbar: Syntax: Selection-screen function key <n>.
Where <n> can be 1,2,3,4,5..
Menu painter (se41): It is used for defining the custom GUI status for a dialogue screen (Or) for a LPS
(list processing screen) as part of this new GUI status we can add additional menus. Enable
or disable the standard tool bar push buttons and we can add 35 push buttons o n the LPS
application tool bar.
We can enable the menu painter by using the statement set pf-status
<GUI STATUS>
Syntax: - The GUI status must always be in upper case.
Set pf-status <GUI STATUS>.
When for the custom GUI status SAP loses the standard GUI status.
As part of the custom GUI status on LPS if we associate the standard function code for the
standard tool bar buttons. Then standard function code for the standard tool bar buttons.
Then both the buttons as well as the functionality will be enabled.
It we associate the user defined function codes then only then buttons are enabled without
the functionality in this case we need to enable the functionality. By handling the event at
user command.
Dialog programming (module pool programming): It is used for developing user defined transaction. A transaction cannot executed of its
own. It must be associated with a T-code.
As part of this they are 4 events associate.
1) PBO (process before output)
2) PAI (process after input)
3) POV (process on value-request)
4) POH (process on help-request)
20 | P a g e
Santosh P
Santosh P
1) Attributes: - In this its specifies the type of screens, normal screens, sub screen, model
dialog box.
2) Element list: - It contains the information of the elements along wit h the coordinates
based on the screen.
3) Layout: - In this we design the screen.
4) Flow Logic: - In this we declare & implement the events along with the corresponding
modules.
Note: - The events are implemented in the form of module definitions.
Procedure for creating module pool programs: Procedure1: Step1: - Create a module pool program in SE80 (with/without top include file).
Step2: - Design the screen (Layout).
Step3: - Declare and implement the events and the corresponding modules (Flow Logic).
Step4: - Activate all the related objects.
Step5: - Associate the T-code with the starting screen.
Procedure2: Step1: - Create an empty program of type module pool (se38).
Step2: In screen painter tool (SE51), design the screen (Layout) and the corresponding
events (Flow Logic) for the corresponding module pool program.
Step3: - Associate the T-code (Se93) with the starting screen.
Field validation in module pool transaction: We can validate a module pool transaction by using 3 different types of validataion.
1) Automatic field validations.
2) Flow logic validations.
3) Module pool validations.
1) Automatic field validations: These validations are triggered by SAP itself based on the properties maintained
for the field at the dictionary level or at the screen-level.
As part of this validations. The error messages are provide by SAP itself.
22 | P a g e
Santosh P
Note: - Whenever the validations are failed on a transaction. SAP doesnt allow performing
any action by default. In most of the times the user wants to exit the screen without
submitting the fields values of the transaction. This can be achieved to the cancel button.
But if the transaction fails at least one validation. The user cannot exit the button. So in
these cases explicitly we need to create a button which acts as a cancel button.
2) Flow logic validations: - These validations are designed by developer in the flow logic.
On a transaction if any field is failing the flow logic or module pool validation the
other fields on the transaction are disabled not allowing the user to input the values.
This can be avoided by using chain end chain.
Chain-endchain is used for grouping the logically related fields.
3) Module pool validations: - In automatic field validation and flow logic validation.
Whenever a field fails a validation. The error messages are provide by SAP.
As part of module pool validations we need to declare the module in flow logic
and implement in the module pool program.
As part of this implementation the developer can provide the user defined the
message.
Table control: - Table control is a component in module pool transaction used for
representing a data in table or format. (in the form of rows & columns).
Whenever a functions contains table control component it must be declared explicitly by
using controls keyword.
Syntax for declaring table control: Controls <table control name> type table view using screen <screen no>.
By default table control supports only horizontal scrolling properties. I.e. it does
not support vertical scrolling.
Vertical scrolling properties should be enabling explicitly by using settings lines
properties of the table control.
File handling on application server: Opening the file: Syntax: Open dataset <path> for <file opening mode> in <text mode/binary mode> [encoding
default] [message <string>].
File opening mode: - input for reading.
Output for writing.
Appending for appending contents to end of file.
Update for reading/ writing.
Perform the operation [Read/Write].
23 | P a g e
Santosh P
Legacy
System
24 | P a g e
Internal
Table
BDC data
Transaction
Internal Table
(Screen)
Call Transaction Method
R/3
Santosh P
As part of call transaction and session method we need to map the legacy system data on to
a transaction for this we need to use the structure BDC data provided by SAP. It contains
following fields.
PROGRAM: - It holds the name of the module pool program.
DYNPRO: - It holds the module pool screen no.
DYNBEGIN: - It is a flag indicator for the occurrence of a new record.
FNAM: - It holds the module pool screen field name.
FVAL: - It holds the field value retrieve name from the legacy system and which needs to
mapped to the transaction fields.
For data migration using BDC migration using BDC techniques the ABAP consultants
needs to understand the format of the legacy system. This includes the information like.
1)
2)
3)
4)
5)
Legacy
System
Internal
Table
25 | P a g e
BDC data
Internal Table
Session
Object
Transaction
(Screen)
R/3
Santosh P
Santosh P
Recording Method: In recording technique we need to record a transaction with same input values.
Based upon this recording SAP itself generates a source code.
This source code needs to be edited manual to map it to the legacy system for data
migration.
Transaction: - Z147/SHDB is the T-code for Recording.
Error Handling in call transaction: Note: - BDCMSGCOLL is a structure used for collections the messages which are
captured during data migration using call transaction.
Syntax: Call transaction <tcode> using <bdcdata>
Mode <processing mode>
Update<update mode>
Message into <bdcmsgcoll>
Types of processing mode: 1) A (Default): It displays all screen one after the other in this mode the error records is
validate.
2) E (Error): Display error screens in this mode the error record is validated as an when
it is encountered (as soon as it is displayed on the transaction) ( i.e. if does not required
any user interaction).
3) N (No display): It indicates background processing.
Types of update modes: 1) S (Default) (Synchronous): In this for every record sy-subrc status is returned, only
after receiving the sy-subrc status the next record is processed.
2) A (Asynchronous): In this no status is returned after processing the record.
3) L (Local Update): It uses the memory of the local system to process the record.
Direct input method: -
Legacy System
27 | P a g e
Internal Table
R/3 Database
Santosh P
No error log is generated so we cant understand how many records and which
records are processed or not processed.
2) There is a possibility of migrating the during migration the records are not passed
to a transaction so no validations are performed on the migrated data.
SAP Scripts: - It is the word processing tool. Used for designing the business documents
such as quotation document enquiry document. Purchase order document, sales order
document invoice etc.
Once these documents are designed they can send to a printer, mail server etc.
As part of ABAP, SAP has provided by SAP are available in the table TNAPR.
SAP script templates are designed by use form-painter tool (SE71)
A script cannot be executed directly. It requires a driver program which is also
called as a print program.
A driver program is an executable program as part of the driver program which is
also called as a print program/executable program.
A driver program is an executable program as part of the driver program, we use
the following function modules.
1) Open _Form.
2) Write_Form.
3) Close_Form.
Sap script form is a collection of windows. And window is used for displaying the
data.
Every form should contain minimum one window. This window is called as main
window.
A main window can fit to single page it can extend to multiple pages depending
on the data.
Procedure for designing sap script form: 1) Design the form using form painter tool (SE71). With appropriate windows.
2) Create a drier program to execute the form.
28 | P a g e
Santosh P
Note: - The data in the window can contain different paragraph format. Each paragraph
format is associated with different form and style settings.
SAP script form is client dependent and language dependent.
Types of symbols in SAP scripts: - Symbols are used for representing a value in sap
scripts there are 4 types of symbols.
1)
2)
3)
4)
System symbols
Standard symbols
Program symbols
Text symbols
1) System Symbols: - These symbols and their values are provided by SAP and the exists
as the part of the TABLE-TTXSY.
2) Standard Symbols: - These symbols and their values are provided by SAP. And there
are stored in the TABLE-TTDTG.
3) Program Symbols: - These symbols and their values are provided by developer. These
symbols are declared in form level and the values are supplied from driver program.
4) Text Symbols: - These symbols are exists in the form of control commands.
Note: - Whenever a form is displayed by using START_FORM we must end the form by
using END_FORM before opening the next form otherwise it results is ABORT ERROR.
Standard Texts: - It is an object which holds the common information which needs to be
appearing in all the business documents standard text is created on using the T-code (SO10).
We can include the standard text in any no of forms by using the control
command includes.
Standard text does not generate any change request it needs to be assign to a
request manually.
Modifying Standard text dynamically: Note: - For modifying the standard text dynamically based on a condition we need to read
the existing standard text by using the function module READ_TEXT.
Once the text is read we can modifying the text accordingly and update the changes to
standard text by using the function module SAVE_TEXT.
Transporting standard text: - By default standard text does not generate any change
request. It needs o be attached to a change request manually by executing the program
RSTXTRAN.
29 | P a g e
Santosh P
Smart forms: - A smart form is also a word processing tool where the development &
maintenance cost is minimum smart form is client-independent because smart form is a
function module generated dynamically whenever a smart form is activated.
TFDIR is a table which stores the smart forms.
A smart form does not require any driver programs it can be executed directly.
Even though a smart form can be executed directly we need to create a driver
program for calling the smart form function module because in the production
system the across to smart form T-code may be decide.
As part of the driver program we need to call the smart form related function
module. But this procedure is not recommended.
The reasons for this are when the smart form is transported to production client.
And when activated it generates a new function module when naming conventions
specific to the production client.
So to avoid this we need to follow the below procedure.
As part of the driver program call the function module
SSF_FUNCTION_MODULE_NAME
Function modules take the smart forms name is input and returns the associated function
module name which is received in a appropriate variable type.
Pass data to smart forms: - To pass the data to smart forms from a driver program we
need to use the parameter sections of the smart form function module.
Text Modules: - Text module is a set of statements which is defined once and which can be
included in any no of smart forms.
Smart Styles: - It is used for designing user defined style format which can be included in
any no of smart forms.
30 | P a g e
Santosh P
Control Break Events in Smart forms: - These events must be used only between loop
and endloop.
1)
2)
3)
4)
AT FIRST
AT NEW
AT END OF
AT LAST
1) AT FIRST: - This event is trigger whenever the first record of the internal table is read;
this event is triggered only once.
Syntax: AT FIRST.
STATEMENTS.
ENDAT.
2) AT NEW: - At new event is triggered whenever a new value is encountered the
specified field.
Syntax: AT NEW <FIELD NAME>
STATEMENTS.
ENDAT.
3) AT END OF: - This event is triggered at end of the last row for specified last field.
Syntax: AT END OF <FIELD NAME>
STATEMENTS.
ENDAT.
4) AT LAST: - This event is triggered at end of the last row the internal table.
Syntax: AT LAST.
STATEMENTS.
ENDAT.
Secondary Index: You should only create secondary indexes, for database tables from which you mainly read,
since indexes have to be updated each time the database table is changed. Secondary
indexes should contain columns that you use frequently in a selection, and that are as highly
selective as possible to improve performance.
31 | P a g e
Santosh P
Subroutine: Subroutines are procedures that you can define in any ABAP program and also call from
any program. Subroutines are normally called internally, that is, they contain sections of
code or algorithms that are used frequently locally. If you want a function to be reusable
throughout the system, use a function module.
Difference between select option and ranges: -
SELECT-OPTIONS
RANGES
declarations.
keyword.
By default it contains default values for option Ranges explicitly we need to assign the values
and sign.
FUNCTION MODULE
SUBROUTINES
They cannot.
They cannot.
32 | P a g e
Santosh P
MACRO
The definition of the macro as well as calling
of the macro in the same program.
SUBROUTINE
SAP SCRIPTS
SMART FORMS
33 | P a g e
Santosh P
MAIN WINDOW
We can split the main window into smaller
windows.
Without a main window we cannot design
SAP-SCRIPT.
Data is displayed continuously.
We can place the same main window up to 99
times per page. (00 to 99 times)
In the main window text element is
compulsory.
Top Endtop Bottom Endbottom works with in
the main window only.
VARIABLE WINDOW
We cannot split the variable window.
Without a variable window we can design
SAP-SCRIPT.
Based on the window size data is printed.
We can place the variable window only once in
a page.
In the variable window text element is
optional.
These commands are not work in variable
window.
CALL TRANSCATION
We can process only one transaction at a time.
SESSION METHOD
We can process N no of transactions at a time.
We can manually handle the errors in the call The session method generates an error log that
transaction.
will handle the errors.
Call transaction is faster than session method.
Session method is little bit slower than call
transaction.
Call transaction is suitable for less amount of Session method is suitable for large amount of
data in the flat file.
data in the flat file.
Call transaction is the immediate database After processing the session by using session
updating.
method the data will be up to in the database.
It returns sy-subrc.
It never returns sy-subrc.
We cant schedule the call transaction in back We can schedule the session method in back
ground.
ground.
34 | P a g e
Santosh P
Call By Value
Call By Reference
List display
Grid display
Santosh P
BAPI
It is directly updating data to the
database.
BAPI is faster than BDC
BAPI never cause to terminate the
program, whenever an error occurred it
simply return that error through return
parameter.
The flat file data is varying.
It performs its own authorization checks.
Whenever the version is changed we no
need to change the existing code of the
BAPI that is taking care of BOR.
BDC
It is updating the data to the database is
always through screens.
BDC is slower than BAPI
Some times BDC cause to terminate the
program i.e. BDC_GROUP BDC_INSERT
BDC_CLOSE_GROUP function modules
fails.
The flat file is constant.
We implement the authorization object in
the BDC program.
Whenever the version is changed
sometimes we need to change the BDC
code.
LSMW
It is purely designed for functional people
who do not do much coding.
In the LSMW, mapping is done by SAP.
LSMW offers 4 methods
1) Direct method
2) Batch input recording
3) BAPI
4) IDOC
We can develop the LSMW only for the
stand and transaction codes.
The input for the LSMW is always text
file.
36 | P a g e
BDC
BDC is designed for technical people
who know much coding.
In the BDC mapping is done by
ABAPER.
BDC offers 2 techniques
1) Call transaction
2) Session method
Santosh P
BADI
USER-EXIT
User Exits Are Forms And Are Called By
Sap Standard Programs Using Perform
Customer-Exit W e H a v e
Function-Module Exit, Screen
Exit, Menu Exit.
Whereas in Customer-Exit No
Access Key Is Needed
Needed
While Changing
Is Required
37 | P a g e
User-Exit, Access
Key
Santosh P
BAPI
RFC
CUSTOMER-EXIT
38 | P a g e
Santosh P
OOABAP
VINAYAKA
Features Of OOPS: 1) Encapsulation
2) Data Abstraction
3) Inheritance
4) Polymorphism
Application Of OOPS: 1) BAPIS
2) BADIS
3) Enhancement Frame Work
4) Webdynpro
5) HR-ABAP
6) CRM-Technical
7) SRM
8) EP
9) BSP
Class: - A class is a user defined data type which is the collection of different type of components.
A class only provides a template its doesnt allocate a memory.
Object: - An instance of a class is called as an object.
Whenever we instance a class memory will be allocated.
Access Specifies (Visibility Section): Types Of Class: 1) Local Class Local class to program (SE38-ABAP Editor).
2) Global Class Class Builder Tool (SE24).
Syntax for creating local classes: 1) Definition of class Declaration of components.
2) Implementation of class Implementation of method.
1|Pa g e
Santosh P
Definition of class
Class <class name> definition.
Declaration of components.
Endclass.
Implementation class
Class <class name> implementation.
Implementation of methods.
Endclass.
Object Creation: 1) Create reference for the class
Syntax: Data <ref.name> type ref to <class name>
Note: - Whenever an Object is created memory will be allocated for the attributes of the class and
attribute gets initialized to default values.
Access specifiers in ABAP: 1) Public Section
2) Protected Section
3) Private Section
Components of ABAP classes: Attributes
Types
Constants
Instance
2|Pa g e
Methods
Data
Special
Events
Normal
Instance
Constructor
Instance
Static
Constructor
Static
Instance
Interface
aliases
Static
Static
Santosh P
1) OOPS Concepts
2) ALV Reporting Using Class
3) ALV Reporting Using Function Modules
Procedure for creating global classes: 1) Define and implement the class in class builder tool (SE24).
2) Access the components of the global class in the repository objects (Executable Programs,
Include Program, and Subroutine Pool). By instantiating the class.
At any point of time they object store one set of values.
Note: - Only public component can be accessed outside of the class.
Interacting with methods in local classes: 1) Declare the method prototype in the class definition.
Syntax: Method/Class-Method <method name> [parameters].
2) Implement the method in the class implementation.
Syntax: Method <method name>.
Statements.
Endmethod.
3) Call the method.
Syntax: Call method <method name> [parameters]
Instance method methods
Static method class-methods
It is recommend to use in the SAP attributes/data members/Instance variables protected/private.
Methods/member function public.
Note: - Whenever a report program contains class implementation and explicitly we need handle
the event start-of-selection to indicate the starting point of program.
Method with parameters: Methods: m1 importing X type i,
Y(20) type c.
3|Pa g e
Santosh P
Methods returning values: Returning Keyword: In case of other object oriented language a method can return exactly one value which
done by using return keyword.
In case of ABAP a method can return any number of values by declaring those many
numbers of exporting (or) importing (or) changing parameters.
To receive the method and return exactly one value we use returning parameters.
If the method contains returning parameters it cannot contains exporting (or) changing
parameters.
A method can contains only one returning parameter.
Returning parameter is always passed by value.
Exception handling in methods: An exception is runtime error which is raised during the program execution if the
exception is not handling the program will be terminated.
Exception handling is process of handling in runtime error and containing program
execution.
The exceptions are provided by SAP as part of standard exceptions class these exceptions
are triggered by SAP itself as a developer we need to handle these exceptions by using try
and catch block.
Inside try block we need to declare this statement where the possible exception occurs.
It the exception is raised in try blocked SAP creates the appropriate exception class object
and the control is transfer to catch block.
Inside the catch block we need to handle the exception by writing the appropriate
exception handling statements.
All the exception classes provided by SAP start with the naming standard
CX_SY_...........
Note: - As part of catch block declaration we need to specify the exception class which is
reasonable for rising exception if the developer is not sure of the exception class we can use the
exception class CX_ROOT.
CX_ROOT is a super class for all the exception classes and it can handle any kind of
exception.
4|Pa g e
Santosh P
Capturing system defined exception message: Procedure for handling standing exception: These exception are declared and raised SAP as a developer we need to handle try and catch.
User defines exception: These exceptions are declaring and handle are raised developers itself.
Procedure for handling user-define exception in local classes: 1) Declare the user define exception as part of method declaration.
Syntax: Exception <exception name>
2) Raise the exception at appropriate place in the method implementation
Raise <exception name>
3) Handle the exception while calling the method by checking sy-subrc status.
Instance attribute: These attribute are specific to an object and they are declared by using the keyword
DATA in local classes.
For each instance attribute separate memory will be allocated they can be an accessed
only by using the object of the class.
Static attribute: They are not specific to any object and they are declared by using the keyword
CLASS-DATA in local classes.
For the static attribute memory will be allocated only when the first object is created the
remaining objects points to be the same memory location they are also called as class
variables.
They can be accessed either by using the object are by using the class name.
Instance methods: In local classes they are declared by using the keyword METHODS they can be accessed
only by using the object. They can access both instance and static attributes.
Static methods: In local class they are declaring the keyword CLASS-METHODS and they can be
accessed either by using object are by using class name. They can access only static attributes.
5|Pa g e
Santosh P
Constructors: A constructor is a special method used for initialized for attributes of class it special because
it cannot be called explicitly it will be called implicitly.
It is always declare in public section.
It never returns any values.
1) Instance
2) Static
Instance Constructors: - It is declared by using keyword CONSTRUCTORS it is executed
automatically whenever we create new instance of a class. It is specific to object.
It can contain only importing parameters and exceptions.
Static Constructors: - It is declared by using the keyword CLASS_CONSTRUCTORS it is
executed automatically whenever a class is loaded a class will be loaded in cases.
1) When we accesses the static components of the class using the class name before creating any
objects.
2) When we create the first object of the class.
3) It is not specific to any object it cannot contains any parameters and exception.
Note: Instance constructor is executed only once in the life time of object.
Static constructor is executed only once in a life time of class.
Note: - If a class contains both instance and static constructor and when we create the first object.
1st the static constructor is executed and next instance constructor for rest of the objects only
instance constructor get executed.
NORMAL METHOD
It called implicitly.
It can be called any know of times in the Instance constructor will be called only once
lifetime of an object.
in the lifetime of every object where as static
constructor will be called only once in the
lifetime of class.
6|Pa g e
Santosh P
User defined exception: Rising: - If a method is a capable of raising the exception that enable to handle the exception then
we need to use the keyword RAISING as part of method declaration in this case the caller of the
method as to take the responsibility of handling the exception.
Friend classes: - By default outside the class of an object can access only public components of the
class directly.
By using friend classes to enable the object to access any components of the class
directly irresponsibility of the visibility for this consider the following session.
Consider two independent classes A and B.
If class A considers class B as friend by inside class B methods we can instantiate class A
and use the instance we can access all the component of class A directly irrespective of
the visibility.
In the above case the class B should be forward declared by using the keyword
DEFERRED.
Deferred keyword indicates to SAP that the class definition has been delayed and it has
been declared same where else in the program.
7|Pa g e
Santosh P
Inheritance: It is the process of acquiring the properties of other entity (class). The advantage of
inheritance is reusability. They are three types of inheritance.
1) Single
2) Multiple
3) Multilevel
The class which gives the properties is called as super class, and the base class which
takes the properties is called as subclass (or) derived class.
Only public and protected components can be inherited.
In local classes we need to use the keyword INHERITING FROM for achieving
inheritance.
1) Single inheritance: A class derived from single super class.
2) Multiple inheritance: A class derived from more than one super class.
Note: - In ABAP we cannot implement multiple inheritances directly we can implement indirectly
through the concept of INTERFACE.
3) Multilevel inheritance: A class derived from another derived class.
CLASS A
CLASS A
CLASS A
CLASS B
CLASS B
CLASS C
CLASS B
CLASS C
Single inheritance
Multilevel inheritance
8|Pa g e
Multiple inheritance
Santosh P
9|Pa g e
Santosh P
Note: - If the super class and sub class contains respective instance constructor it must for subclass
instance constructor to call the super class instance constructor this is done by using SUPER
keyword.
This is the only place where the constructor can be are must be called explicitly.
Note: - If the super class and sub class contains respective static and instance constructor and if
instantiate the sub class first the static constructor are executed to super class to subclass and when
the instantiate constructor will executed subclass to super class.
Me keyword: - Me keyword refer to current object execution it is used to differentiate both
attribute and method parameters whenever attribute and parameter names are same.
Visibility of component level: 1) Public section
2) Protected section
3) Private section
Visibility of class level: 1)
2)
3)
4)
Public
Protected
Private
Abstract
10 | P a g e
Santosh P
Abstract class: It is a class which contains at least one abstract method. Abstract method is a method
which is just declared but not implemented in local class they are declared by using the
keyword abstract.
If a class contains at least one abstract method then the entity class should be declared as
abstract.
Abstract methods are always declared in public (or) protected section.
We cannot instantiate the abstract classes because they are not fully implemented.
The class which ever inheritance the abstract class can implement the abstract method of
the abstract class otherwise the subclass will declared as abstract.
Abstract methods are also called as non-concerted methods.
We declared method as abstract when we are not sure about the implementation but we
are sure that the other classes as to use the same methods.
Interfaces: - It is pure abstract class i.e. by default all methods of interface are abstract. By using
interfaces we can implement multiple inheritances.
By default the visibility of the interface components are public.
Interface methods contain only declaration but not implementation the implementation
must be provided in the corresponding class. The class whichever implements the
interface is called as implementation class and this class should implement all the
methods of the interface otherwise this class should be declaration as abstract.
A local class whichever wants to implement the interface must declared the interface in
the class definition by using interface keyword.
Syntax: - interface <interface name>.
A class can implement any number of interfaces which is nothing but multiple inheritances
whenever the interface component is referred the outside of the interface they must be prefixed with
the name of the interface.
Interface is always implemented in public section.
We cannot the instantiate the interfaces because it is not implemented.
Syntax for local interfaces: Interface <interface name>.
Declaration of components
End interface.
Aliases: - aliases are the alternative names provided to the interface components i.e. whenever the
interface components is referred outside the interface declaration it must be prefixed with the name
of interface we can avoid the lengthy naming standard by declaring the aliases by the interface
components these aliases must be declared in the definition of a class whichever the implementing
the interface. By using aliases we can also change the visibility of the interface components.
11 | P a g e
Santosh P
ABSTRACT CLASSES
INTERFACES
Can contain both abstract and non-abstract Can contain only abstract methods.
methods.
Explicitly we need to use abstract keyword.
Abstract methods can be declared in public or All components of interface by default are
protected section.
public.
A class can inherit only one abstract class.
Abstract class components are directly referred Interface components must be prefixed with the
in subclass.
name of the interface.
Persistence service: - It is used for storing the state of an object formality it is similarly to
serialization java and .net. This service is implemented by using persistence classes. This service is
implemented in two ways.
1) By using business key identity.
2) By using GUID (global unique identifier)
Storing the state of object permanently in the database is called as persistence.
By default the lifetime of the scope of an object is within the program where it is created.
Persistence class is always global and the naming standard is ZCL_ (or) YCL.
Persistence class is always created as protected class.
Whenever a persistence class is created SAP automatically create to class.
1) Base agent class naming standard is ZCB_ (or) YCB_.
2) Agent class or actor class ZCA_ (or) YCA_.
Base agent class is always created as abstract the class and it is the friend of persistence
class.
Actor class is always created as private class and it is a sub class of base agent class.
Once the persistence class is created it needs to mapped with the corresponding database
table.
Persistence class using business key identity: In this we consider the primary key fields of the database table as business key identity
which is used for identity the object uniquely.
In this case when the persistence class is mapped with the database tables SAP adds the
fields of the database as the attributes of the persistence class.
Also it creates the following methods as part of the base agent class.
12 | P a g e
Santosh P
1) Create_persistence.
2) Delete_persistence.
3) Get_persistence.
The above three method are public instance methods which gets inherited to actor class.
We need to use the above methods to interact with the persistence service.
A part from this SAP also generates getter and setter methods as part of persistence class.
Getter method is generated for all the fields of the database and setter methods are
generated for non-primary key fields of the table.
To access the above three methods we require the object of base agent class. But the base
agent class is always created as abstract class and therefore cannot be instated.
Since the above three method are inherited to actor class we need to instantiate the actor
class and access these methods. But actor class is created as private class and therefore
cannot be instated.
We use the following mechanize to access these methods.
Actor class is created as singleton class.
As part of the actor class SAP as provided a public static attribute agent.
We need to access this public static attribute agent using the actor class name. When
accessed internal it execute the static constructor of actor class it is reasonable for
creating the object. This object is return back using which we access the above three
methods.
Singleton class: Creating a class in such way so that we can create exactly one object is called as
singleton.
Persistence service using GUID: - In this we need to consider database table which contains
GUID as the first field. The data element of this field can be GUID/OS-GUID.
The data type of this field raw data type.
This field is used for unique identification of the object.
The value for this field is generated dynamically by SAP.
Note: - when a persistence class is mapped with the database table containing GUID also the field
expects the GUID are added as attribute of class and also getter and setter method are generated for
the entire field except GUID.
Transact
13 | P a g e
Santosh P
ion service: - It is use for managing the object oriented transaction involving database operations.
As part of this we need to use the following class and interfaces.
1) CL_OS_SYSTEM CLASS
2) IF_OS_TRANSCATION_MANGAER INTERFACE
3) IT_OS_TRANSACTION INTERFACE
Procedure for interacting with transaction service: 1) Start the object oriented transaction by calling the start method of the interface.
IT_OS_TRANSACTION
Start method is an instance method of interface IT_OS_TRANSACTION so we need to instantiate.
The interface IF_OS_TRANSACTION which cannot be done directly. So we need to access the
instance method Create_Transaction of the interface IF_OS_TRANSACTION_MANAGER to
access this method we required the object of transaction manger interface. To get these object of
transaction manger interface. To get this object we need to access the static method
GET_TRANSCATION_MANAGER of the class CL_OS_SYSTEM.
2) Perform the required operation: End the transaction by calling the end method of the interface IF_OS_TRASACTION.
When the transaction is successfully completed SAP issues commit work statement
internally for saving the transaction permanently.
If the transaction fails SAP raise the exception as part of this exception handling we need
to cancel the transaction by calling the undo method of the interface
IF_OS_TRANSCATION.
Implementing persistence service using transaction service: Note: Transaction service is always implemented globally.
Since transaction service is implemented in global classes we need to attach a T-code for a
transaction class method so that everything will be executed as single process. If we access the
transaction class method form local program it executed the different process which are assuming
as two different translations.
Casting: - It is the process of converting a variable from one data type to another data types they
are two types.
1) Wide casting
2) Narrow casting
Wide casting: - It is the process of converting an object from a less detailed view to more detailed
view.
Narrow casting: - It is a process of converting an object from a more details view to be less
detailed view.
14 | P a g e
Santosh P
Procedure for deleting the persistent object using GUID: Check the existent persistent object using the method gets persistent OID. If the persistent object is
available it returns the object of object class which needs to be type casted to the corresponding
persistent class object. Pass the persistent class object as an input to the method.
DELETE_PERSISTENT.
Event handling in object oriented: - As part of ABAP objects SAP as provided many events as
part of standard classes. These events are used in ALV reporting work flow customization CRM
technical DSP and webdynpro programming.
As part of custom classes we can declare user defined events. These events are declared are raised
and handle by the developer itself.
Procedure for interactive with user defined events in local class:
15 | P a g e
Santosh P
For executing the event handler methods we need to register the handlers. By using this
register handlers SAP will execute all the event handler methods. One after the other.
Accordingly to sequence of register.
Events can contains only exporting parameters which are imported by event handler
method these parameters are always passed by values. The parameter name in the event
as well as in event handler method must be same.
Note: - if the handler is not register events can be triggered but no actions can be performed
because the event handler methods will not be executed.
For all instance: - while register the handler for register events as part of set handler statement we
need to specify the object name after for keyword. This is reasonable for raising the event. This as
to be done for every object separately which is raising the event instead of this we can use FOR
ALL INSTANCE keyword.
As part of handler such that the event handler method will executed irrespective of object
used for raising the event.
Static event: - While registering the handlers for static even we should not specify the object which
is reasonable raising the static event. Because static event is not specific to on object i.e. for
keyword is not allowed for the static event part of set handler this similarly for all instances in case
of instance event.
Static event handler method: Instance event can be raised only in instance methods.
Static event can be raised either in instance are static method.
16 | P a g e
Santosh P
OOALV
VINAYAKA
ALV (Advanced List Viewer / ABAP List Viewer): 1) Using classes
2) Using function module
ALV Reporting using classes: ALV reports are used for displaying data in the form of the table as part of the we use the
following classes.
1)
2)
3)
4)
5)
6)
7)
8)
CL_GUI_ALV_GRID
CL_GUI_CUSTOM_CONTAINER
CL_GUI_CONTAINER
CL_GUI_SIMPLE_TREE
CL_GUI_PICTURE
CL_GUI_DOCKING_CONTAINER
CL_DD_DOCUMENT
CL_GUI_SPLITTER_CONTAINER
As part of the ALV reporting we need to develop the ALV grid which is display on top of a custom
control.
A custom control is a physical control which is available as part of dialog screen.
ALV grid cannot recognize custom control on its own it required an interface. These interfaces are
provided in the form of a standard class.
This class can be either.
1) CL_GUI_CUSTOM_CONTAINER
2) CL_GUI_CONTAINER
CL_GUI_CUSTOM_CONTAINER /
CL_GUI_CONTAINER
ALV GRID
CUSTOM CONTROL
MODULE POOL SCREEN
1|Pa g e
Santosh P
CUSTOM CONTROL
CONTAINER
ALV GRID
PHYSICAL CONTAL
CL_GUI_CUSTOM_CONTAINER /
CL_GUI_CONTAINER
CL_GUI_CONTAINER
ERZET
VBELN POSNR
MATNR
4970
4972
10
M1
4971
4972
20
M2
4972
4972
30
M3
Material Data
MATNR
MTART
NETWR
M2
To display an internal table data in the grid we need to use the instance method
'SET_TABLE_FOR_FIRST_DISPLAY of the class CL_GUI_ALV_GRID. This method
contains only one mandatory parameter IT_OUTTAB which expects internal table of output.
2|Pa g e
Santosh P
While displaying the internal table data in the ALV grid we need to generate the field catalog
for the field, if the field catalog is not specified if result in ABORT error field catalog is not
found.
A field catalog can generate in two waves by using.
1) Function modules
2) Manually
Field catalog is an object which stores the information of the fields like field name, field position,
field label, etc. once the field catalog is generated we need to pass the field catalog object as on
input to the parameter IT_FIELDCATALOG of the method
SET_TABLE_FOR_TABLE_DISPLAY.
LVC_T_FCAT is a table type used for generating the field catalog this table type is associated
with the structure LVC_S_FCAT.
Note: - To display an ALV column and hotspot we need to set the field hotspot as part of field
catalog generation.
HOTSPOT_CLICK: It is the event of the class CL_GUI_ALV_GRID which triggered by SAP, whenever a
hotspot column is clicked.
REFRESH_TABLE_DISPLAY: Is an instance method of the class CL_GUI_ALV_GRID used for refresh the ALV grid with
the latest internal table data.
DOUDLE_CLICK: It is the instance event of the class CL_GUI_ALV_GRID which is triggered whenever an
ALV column cell value is double click.
CL_GUI_SPLITTER_CONTAINER: -
CUSTOM CONTROL
CUSTOM
CONTAINER
SPLITTER
CONTAINE
CONTAINER1
CONTAINER2
CONTAINER3
PHYSICAL
CONTROL
3|Pa g e
CL_GUI_CUSTOM_
CONTAINER
CL_GUI_SPLITTER_
CONTAINER
CONTAINER4
CL_GUI_CONTAINER
Santosh P
ERDAT
ERZET
VBELN
POSNR
MATNR
4972
10
M1
4972
20
M2
ERNAM
NETWR
4970
4971
4972
After splitting the container into different of panes each pane should be assigned with height and
column width for setting the row height we need to use the instance method SET_ROW_HEIGHT
and column width SET_COLUMN_WIDTH of the class CL_GUI_SPLITTER_CONTAINER
after this we need to associated each pane of a container with container object.
By using the method GET_METHOD of the class CL_GUI_SPLITTER_CONTAINER this
method takes the row and column as input and return the container object of type
CL_GUI_CONTAINER.
To display an ALV column as a button we need to set the field STYLE as part of field catalog
generation. The value of these type fields are represented by the constant attribute of class
CL_GUI_ALV_GRID these constant attribute can we access by using the class name and the
starts with the naming conversion MC_STYLE.
BUTTON_CLICK: BUTTON_CLICK is the instance of event of the class CL_GUI_ALV_GRID which is
triggered whenever the user click on the ALV cell value display on top of a button.
TOP-OF-PAGE: TOP-OF-PAGE is the instance of event of the class CL_GUI_ALV_GRID which is
triggered whenever an ALV grid is displayed. This event can be used for generating the heading for
an ALV GRID.
TOP-OF-PAGE event is not triggered by default it must be register explicitly by calling the
instance method LIST_PROCESSING_EVENT.
4|Pa g e
Santosh P
Purchase Order
o Create Purchase Order
o Change Purchase Order
COMPANY LOGO
ALV GRID
(FIELD CATALOG WITH FUNCTION MODULE)
UPLOADING PICTURE TO DISPLAY IN DIALOG SCREENS: SMWO is the T-code for uploading the pictures.
PROCEDURE FOR DISPLAYING IMAGES IN DIALOG SCREENS: 1) Call the function module DP_PUBLISH_WWW_URL.
This function module take object ID and return URL of the picture this URL is of type
CNDP_URL which is type declaration declared in the type group CNDP.
2) Call the instance method LOAD_PICTURE for URL of the class CL_GUI_PICTURE of this
method takes the URL as input and displays the picture in the container.
PROCEDURE FOR DESIGNING TREE STRUCTURE: 1) To add the nodes to a tree structure it use the instance method ADD_NODES of the class
CL_GUI_SIMPLE_TREE this method takes the following parameters.
TABLE_STRUCTURE_NAME
1) It holds the structure name representing the node structure of a simple tree this structure is
ABDEMONODE.
2) NODE_TABLE it holds the internal table representing the ABDEMONODESTRUCTURE.
Every node in a tree is associated with a node key it used for indentifying the node which
selected on a tree.
Icon is a type group it is provided by sap itself.
CNTL is a type group it is provided by SAP itself.
5|Pa g e
Santosh P
6|Pa g e
Santosh P
7|Pa g e
Santosh P
Whenever an ALV reports uses custom control in the screen the reports cannot scheduled in the
background process because the background processor cannot recognized custom control, so if the
custom control is not used we cannot use custom container in this case we need to use docking
container.
Docking container cannot recognize custom control docking container is represented by the class
CL_GUI_CONTAINER.
To recognize whether the ALV report is in background error in foreground executed we need to use
the static method offline of the CL_GUI_ALV_GRID, this method returns ZERO if it is
foreground execution otherwise NON-ZERO value if it background execution.
DIPLAYING TRAFFIC LIGHTS IN ALV GRID: Traffic light in the ALV grid represents the significant of the row this column is always
assed in first column in ALV grid.
We need not explicitly generate the field catalog for the traffic light column.
Declare an additional column of type character in the finial internal table.
Before displaying the ALV grid loop final internal table and the value of traffic light
column based on a condition.
8|Pa g e
Santosh P
As part of layout generation we need to the field EXCP_FNAME, the value of this field
should be the name of the additional column.
COLORING ALV ROWS: PROCEDURE: Taken additional column in the final internal table it should be a char size 4.
Before displaying the ALV grid to the final internal table and the appropriate column
coding form the additional column.
As part of layout generation the set the field INFO_FNAME the value of this field
should be the name of the additional column.
DISPLAYING ALV CELLS AS DROP DOWN: Taken an additional column which is supposed to display as dropdown.
Generate the field catalog for the additional column ad part of field catalog generation
assign a numeric value to the field DRDN_HNDL.
To prepare and associate the list of value to the drop down column calls the instance
method SET_DROP_DOWN_TABLE of the class CL_GUI_ALV_GRID.
F1 HELP: To provide custom F1 help for an ALV column we can specify into two waves.
By attaching the custom help to the field at the data element level.
By handling on F1 event of the class CL_GUI_ALV_GRID.
To attach standard F1 help for an ALV column we need to set the fields
REF_TABLE REF_FIELD as part of field catalog generation.
ONF4 EVENT: We can associate the standard F4 help for an ALV column for setting the fields REF_FIELD
REF_TABLE as part of field catalog generation, to associate the custom F4 help we need to
handle the event ONF4 of the class CL_GUI_ALV_GRID.
By default ONF4 event is not triggered it must be register explicitly by calling the instance
method REGISTER_F4_FOR_FIELDS of the class CL_GUI_ALV_GRID.
9|Pa g e
Santosh P
ALV USING FUNCTION MOUDLES: As part of this we use the following function module to display the ALV grid.
1) REUSE_ALV_GRID_DISPLAY
2) REUSE_ALV_LIST_DISPLAY
i.
ii.
iii.
iv.
SIMPLE ALV
INTERACTIVE ALV
BLOCKED ALV
HIERARCHICAL ALV
While calling the function module REUSE_ALV_GRID_DISPLAY we need to call field catalog
otherwise it need to abort error.
Instead of passing the field catalog we can pass the dictionary structure as input if the format of
dictionary structure does not match with format of internal table it need to runtime error.
In ALV using function module we can generate the field catalog in two waves.
1) By using the function module REUSE_ALV_FIELDCATALOG_MERGE this function
module takes dictionary structure as input and return the field catalog of type
SLIS_I_FIELDCAT_ALV.
2) Manually by using the internal table SLIS_T_FIELDCAT_ALV.
As part of ALV using function module to handle the events we need to use the parameter
IT_EVENTS as part of the function call REUSE_ALV_GRID_DISPLAY this parameter is a
internal table of type SLIS_T_EVENT this event is of SLIS_ALV_EVENTS and this type
contains two fields.
1) Name
2) Form
Name will hold the name of event and form will hold the subroutines.
To display the information and picture in the TOP-OF-PAGE event we need to use the function
module REUSE_ALV_COMMENTARY_WRITE.
PROCEDURE FOR DISPLAYING IMAGES IN ALV GRID DEVELOPED USING F M S:1) Upload the picture using OAER with object id.
2) Pass the object ID in the function module call REUSE_ALV_COMMENTARY_WRITE
10 | P a g e
Santosh P
OAER
|
NAME-> PICTURES
TYPE-> OT
KEY-> Z915FMALV (ANY NAME)
|
EXCUTE
|
EXPAND THE STANDARD DOCUMENT
|
DOUBLE CLICK ON SCREEN
|
GET PATH AND CONTINUE
ALV BLOCKED LIST: It is used for display the data in the form of blocks as part of this we use the following function
module.
1) REUSE_ALV_BLOCK_LIST_INIT
2) REUSE_ALV_BLOCK_LIST_APPEND
3) REUSE_ALV_BLOCK_LIST_DISPALY
1) Initialize the ALV block by using the function module
REUSE_ALV_BLOCK_LIST_INTI
2) Append the internal table data to the ALV block using the function module
REUSE_ALV_BLOCK_LIST_APPEND.
Repeat the second step to each internal table.
3) Display the function module using function module
RESUE_ALV_BLOCK_LIST_DISPLAY.
HIERARCHICAL ALV: It is used for displaying the data in the form of parent and child nodes as part of this we use the
following module REUSE_ALV_HIERSEQ_LIST_DISPLAY.
INTERACTIVE ALV: USER COMMAND: - Is user triggered whenever the user double click on ALV cell value
developed using function module.
11 | P a g e
Santosh P
ORDER
T-CODE
TABLES
ENQUIRY
VA11
VBAK, VBAP
QUOTATION
VA21
VBAK, VBAP
VA01
VBAK, VBAP
DELIVERY
VL01
LIKP, LIPS
BILLING
VF01
VBRK, VBRP
ORDER
T-CODE
TABLES
PURCHASE REQUISITION
ME51
EBAN, EBKN
ME41
EKKO, EKPO
QUOTATION FROM
DIFFERENT VENDORS
ME47
PRICE COMPARISON
ME49
MSEG, MKPF
GOODS RECEIPTS
MIGO
MSEG, MKPF
INVOICE VERIFICATION
MIRO
RBKP, RSEG
ASAP METHODOLOGY:
1)
2)
3)
4)
5)
Project Preparation
Business Blueprint
Realization
Final Preparation
Go-Live and support
Santosh P