Upload
michelle-shaw
View
216
Download
0
Embed Size (px)
Citation preview
7/29/2019 ABAP for Students
1/84
SAP-ABAP
1
Kiran
SAP System Applications and Products in data processing
Categories of SAP:
TECHNICAL
FUNCTIONAL
NEW DIMENSIONAL PRODUCTS
TECHNICAL:
ABAP: Advance business application programming.
ABAP is a programming language of SAP.
BASIS: Business application software integrated solution.
Their job is concerned in administration.
NETWEAVER:
XI Exchange infrastructure / PI Process integration
Interfaces
EP Enterprise portal
BI Business intelligence
It is a reporting and analysis tool.
FUNCTIONAL:
SD Sales and distribution.
MM Materials and management.
PP Production and planning.
Fi Financial accounting. Modules
CO Controlling.
PS Project Systems
WF Work Flow
NEW DIMENSIONAL PRODUCTS:
CRM Customer Relationship Management.
7/29/2019 ABAP for Students
2/84
SAP-ABAP
2
Kiran
SRM Supply Relationship Management.
SEM Strategy Enterprise Management.
SCM Supply Chain Management.
APO Advanced Planner Optimizer.
**NOTE:SAP is an ERP
ERP means Ready to use
Sap is one of the leading ERP
*Abapers customize the Standard SAP DD, Programmes, Function Modules,.......etc.
based on the CLIENT Requirements.
The Version using SAP isecc6.00
*ecc erp central componenT.
6.00 is the version
SAP Releases TWO systems
1.IDES.
2.PRODUCTION SYSTEMS.
1.IDES:International Demonstration Education System.
This system is for learning.
2.PRODUCTION SYSTEMS:
This system is for Real time server (companies).
*NOTE: Production system contains live data where as IDES contains Dummy data.
**R/3 ARCHITECTURE:
R/3 is an integrated suite of applications designed to handle the data processing for
large corporations.
R Real time.
3 type of the architecture called three tier architecture.
*NOTE: 1.abap code runs on the application server(AS).
2.To overcome the load of the application server(AS), that has been shared with many
application servers(AS1,AS2,AS3,.......,).
7/29/2019 ABAP for Students
3/84
SAP-ABAP
3
Kiran
Fig:R/3 architecture
Types of work processes:
D(Dialog) Dialog requests.
B(Background) Background jobs.
S(Spool) Print spool requests.
V(Update) requests to update data in the database
E(Enqueue) Logical lock requests
Dialog Work Process
Dialog work processes deal with requests from an active user to execute dialog steps.
Update Work Process
Update work processes execute database update requests. Update requests are part of an SAP LUWthat bundle the database operations resulting from the dialog in a database LUW for processing in the
background.
7/29/2019 ABAP for Students
4/84
SAP-ABAP
4
Kiran
Background Work Process
Background work processes process programs that can be executed without user interaction
(background jobs).
Enqueue Work Process
The enqueue work process administers a lock table in the shared memory area. The lock tablecontains the logical database locks for the R/3 System and is an important part of the SAP LUWconcept. In an R/3 System, you may only have one lock table. You may therefore also only have oneapplication server with enqueue work processes.
Spool Work Process
The spool work process passes sequential datasets to a printer or to optical archiving. Eachapplication server may contain only one spool work process.
The services offered by an application server are determined by the types of its work processes. One
application server may, of course, have more than one function. For example, it may be both a dialogserver and the enqueue server, if it has several dialog work processes and an enqueue work process.
You can use the system administration functions to switch a work process between dialog andbackground modes while the system is still running. This allows you, for example, to switch an R/3System between day and night operation, where you have more dialog than background workprocesses during the day, and the other way around during the night.
ABAP WORK BENCH:
Abap work bench is a set of executables to develop ERM(enterprise reportmanagement) and applications that runs on R/3 system.
It is a tool to develop ABAP objects
SE System Engineering: usually indicates some kind of development tool - e.g. ABAP Editor SE38,
Class Browser SE24.
7/29/2019 ABAP for Students
5/84
SAP-ABAP
5
Kiran
Development Tools / Components in ABAP Work Bench:
Development tools of Abap work bench are
ABAP Dictionary.
ABAP Editor.
Function Builder.
Class Builder.
Screen Painter.
Menu Painter.
ABAP Dictionary:
Through ABAP dictionary we can create data base tables, structures, domains, views, data
elements, lock objects, search help, etc....,
Transaction code (T.code) is SE11.
NOTE:SE-system engineering.
ABAP Editor:
It is used to write program.
T.code is SE38.
Function Builder:
Through function builder we can create Function groups and Function Modules.
T.code is SE37.
Class Builder:
Through Class Builder we can create global classes and methods.
T.code is SE24.
Screen Painter:
Through screen painter we can create / customize screens.
T.code is SE51.
7/29/2019 ABAP for Students
6/84
SAP-ABAP
6
Kiran
Menu Painter:
Through the menu painter we can create menus in the reports (or) in the standard
applications.
T.code is SE41.
TYPES OF DATE BASE TABLES:
Transparent table
Cluster table.
Pooled table.
Client:A client is organizational and legal entity in the SAP system. The main objective of the client
is to keep the data isolated. The data in a client can be only visible within that client; it can not be
displayed or changed from another client. In a physical SAP system there can be multiple clients(Ex:
Development, Quality and Production). Each of these clients can have different objective or each
client represents a unique work environment.
Transaction Code (TCode):A Transaction code is command that tells the system location of
Task. Each and every screen is having different Transaction codes.
Transparent table:
Transparent table stores master data as well as transaction data.
master data:-master data is the data which is does not changes frequently.
Ex:-id, bank account no, etc..,
transaction data:-Transaction data is the data which changes frequently
The client (mandt) and the next field should be the primary key of the transparent table.
When we create a transparent table in dictionary system automatically creates table in a data
base after activation.
*These tables have one-to-one relation.
Both tables have same names, same number of fields, same data types, same length and
same field names.
Table pools (pools) and table clusters (clusters) are special table types in the ABAP Dictionary. Thedata from several different tables can be stored together in a table pool or table cluster. Tablesassigned to a table pool or table cluster are referred to as pooled tables or cluster tables.
A table pool or table cluster should be used exclusively for storing internal control information (screensequences, program parameters, temporary data, continuous texts such as documentation). Data ofcommercial relevance is usually stored in transparent tables.
7/29/2019 ABAP for Students
7/84
SAP-ABAP
7
Kiran
Cluster table:
Several logical data records from different cluster tables can be stored together in one physical recordin a table cluster.
Cluster table stores continuous text.
EX: Paragraphs , etc...,
The client(mandt) and the next field should be the primary key of the cluster table.
These are many so, they have many-to-one relation with the data base table .
All the clustered table united together to form a table cluster.
Pooled table:
A table in the database in which all records from the pooled tables assigned to the table pool arestored corresponds to a table pool.
It stores the program parameter, screen numbers and temporary data.
It has also many so they have manyto-one relationship with the database.
All the pool tables united together to form pool table.
The first field may or may not be the primary key.
DATA TYPES IN ABAP DICTIONARY:
CHAR Access Characters, Numeric, Alphanumeric.
NUMC Character String.
FLTP Floating Point.
INT1 1 Byte Integer.
INT2 2 Bytes Integer.
INT4 4Byes Integer.
DATS For Date.
TIMS For Time.
CLNT Client.
LANG Language.
DEC Decimals to Store symbols and negative values.
7/29/2019 ABAP for Students
8/84
SAP-ABAP
8
Kiran
CURR Currency.
Both have to use.
CUKY Currency key.
QUAN Quantity.
Both have to use.
UNIT Unit
DOMAIN:
Domain consists of a technical characteristics of the field.
Technical characteristics are
Data Type of the field.
Length of the field.
Value table and Value range.
** Domains are reusable in the same table as well as in the different table.
DATA ELEMENT:
Data Element consists of
Field labels.
Field documentation.
Parameter id.
***Data elements should not reusable in the Same table.
**Data elements are reusable in Different table.
****NOTE: Table name should start withY(or)Z.
7/29/2019 ABAP for Students
9/84
SAP-ABAP
9
Kiran
EX:
CREATION OF A EMPLOYEE TABLE:
TABLE: ZTHILAK_EMP
Emp_no Emp_name Emp_city
5 15 15
DATA ELEMENT:
DOMAIN: ZDE1 ZDE2 ZDE3
ZDM1 ZDM2
**NOTE: DT-Data type.
LEN-Length
FL-Field label
FIG: CREATION OF EMP TABLE
There are two types to create a Table
1.Bottom-up-approach.
2.Top-down-approach.
BOTTOM-UP-APPROACH:
CREATION OF DOMAIN.
CREATION OF DATA ELEMENT.
CREATION OF A TABLE.
FL:
Emp_no
DT: CHAR
LEN:5
DT:CHAR
LEN:15
FL:
Emp_nam
FL:
Emp_city
7/29/2019 ABAP for Students
10/84
SAP-ABAP
10
Kiran
CREATION OF DOMAIN:
Goto T.code SE11.
Select domain.
Provide domain name. EX:ZDOM_EMPLNO.
Create
Then we will enter into DICTIONARY
MAINTAIN DOMAIN
Provide the information.
save in Local object.(ctrl+s).
Check.(ctrl+f2).
Activate.(ctrl+f3).
**NOTE: The same process will repeat for the other DOMAINS also.
CREATION OF DATA ELEMENT:
Goto T.code SE11.
Select Data type.
Provide Data elemenT. EX:ZDE_EMPLNO.
create
Then we will enter into the DATA ELEMENT
Domain(which we have given previous EX: ZDOM_EMPLNO).
Click on FIELD LABEL. And provide the field label.
Save+local object+check+activate.
7/29/2019 ABAP for Students
11/84
SAP-ABAP
11
Kiran
CREATION OF TABLE :
Goto T.code SE11.
Select database table and provide database table nameEX:ZTHILAK_EMP.
create
Provide the short description of your table.
Provide Delivery class A .
A Application table.
7/29/2019 ABAP for Students
12/84
SAP-ABAP
12
Kiran
DELIVERY CLASS:
Delivery class controls the transport of the table data, when installing or
upgrading in a client copy between the customer systems.
Data browser/table view maintenance allowed.
Save + local object.
Click on technical settings:
Data class APPL0.
DATA CLASS:
Data class defines the physical area of the database in which the table is logically
sorted.
APPL0 Master data only.
APPL1 Transaction data only.
APPL2 organisation and customizing.
Buffering should not allowed.
SIZE CATEGORY:
Size category provides the number of data records that can be stored in table
based on the number of fields.
Mean time give 0.
Save.
Back.
Click on fields tab and provide the field name.
7/29/2019 ABAP for Students
13/84
SAP-ABAP
13
Kiran
After creating table:
go to extras and select enhancement.
Select the category from the list
Save + check + activate.
TO enter data after creating table
Utilities.
Table contents.
7/29/2019 ABAP for Students
14/84
SAP-ABAP
14
Kiran
Create entries.
Save.
Execute.
**NOTE: click on reset to give data to the next record.
To provide the salary to the record first create the salary field and create another
field for the currency key .
To assign the currency key to the salary, double click on the field name
(EMP_SAL).
You will get the another window, provide TABLE NAME and FIELD NAME where
ref.field appears.
7/29/2019 ABAP for Students
15/84
SAP-ABAP
15
Kiran
NOTE: **Normally we will use TOP-DOWN-APPROACH to create Tables.
**LINKING TWO TABLES:
To link two different tables, there should be common field in in both tables.
That common field should be the primary key in one of the table.
Ie in another table that is called foreign key.
Assume that you have two (employee and department) tables.
Go to employee table and provide the primary key of department table (d.no)
And its data element.
Select d.no in the employee table and click on foreign key.
Check table is a table which you are going to link. It is used to check whether the
input values are valid or not.
Click on general proposal.
Click on copy.
Save + check + activate.
Step-1:
7/29/2019 ABAP for Students
16/84
SAP-ABAP
16
Kiran
Step2:
**TABLE MAINTENANCE GENERATOR:
Through table maintenance generator the end usercan enter the data into a table.
When we create a table maintenance generator, the table control, from there the
end user can edit, enter and display the data.
CREATION OF THE TABLE MAINTANANCE GENERATOR:
Utilities + table maintenance generator.
Authorisation group: &NC&.
Function group: Table name (ex:ZTHILAK_EMP).
Maintenance type: select one step.
Screen number: ex:10.
Click on create.
Go to: SE93.
Provide transaction code: give the name for the end user (ex: ZTHILAK).
Select transaction with parameter
Transaction--SM30
Select skip initial screen.
NAME OF THE SCREEN FIELD VALUE
VIEWNAME TABLE NAME (ex:ZTILAK)
7/29/2019 ABAP for Students
17/84
SAP-ABAP
17
Kiran
UPDATE OR SHOW X
STEP-1:
STEP-2:
STEP-3:
7/29/2019 ABAP for Students
18/84
SAP-ABAP
18
Kiran
STEP-4:
OUTPUT:
[**NOTE: End user can access the data by using Transaction code (ex:ZTHILAK).]
7/29/2019 ABAP for Students
19/84
SAP-ABAP
19
Kiran
VIEWS:
View is an imaginary table.
View does not hold data permanently.
It holds data only at run time.
Views fetches data from database tables only.
TYPES OF VIEWS:
Database view.
Projection view.
Maintenance view.
Help view.
Database view:
Through database view, we can retrieve data from one or more tables at a time.
To retrieve data from two different tables, there should be a common field in both
tables(primary key and foreign key).
**If it retrieves data from more than once table, maintenance of data is not possible.
Data base view follows inner join.
Projection view:
Through projection view, we can retrieve data from only one table.
**Maintenance of data is possible ie write, read and change.
Maintenance view:
Through maintenance view, we can retrieve data from two or more tables at a time.
To retrieve data from two different tables there should be a common field in both
Tables(primary key and foreign key).
ie we can
Read only.
Read and change.
Read, change, insert and delete.
*After creating maintenance view we need to create table maintenance generator.
7/29/2019 ABAP for Students
20/84
SAP-ABAP
20
Kiran
*T.code to generate table maintenance SE54.
*Maintenance view follows left outer join.
HELP VIEW:
Through help view we can retrieve data from two or more tables at a time.
It is mainly used in search help.
CREATION OF DATABASE VIEW:
Goto SE11.
Select view and provide view name.
Click on copy.
Give the table names which you gonna to join.
Under table field give the common field.
save
click on view fields tab
click on table fields.
Double click on table(which you have provided).
Select the fields which you want and click on copy.
Double click on another table(which you have provided).
Select the fields which you want and click on copy.
Save+check+activate.
**To see the output click on utilities + contents + execute.
7/29/2019 ABAP for Students
21/84
SAP-ABAP
21
Kiran
7/29/2019 ABAP for Students
22/84
SAP-ABAP
22
Kiran
Projection view:
Go to SE11.
Select view and provide view name.
Click on create.
Select projection view.
Click on copy.
Give the basis table name.
Click on table fields.
Select the fields which you want and click on copy.
Click on maintenance status.
save+check+activate.
**To see the output click on utilities +contents+execute.
NOTE: data gets stored in database table only.
7/29/2019 ABAP for Students
23/84
SAP-ABAP
23
Kiran
CREATION OF MAINTENANACE VIEW:
Go to SE11.
Select view and provide view name.
Click on create.
Select maintenance view.
Click on copy.
provide table name.
Click on symbol.
7/29/2019 ABAP for Students
24/84
SAP-ABAP
24
Kiran
Relationship + save.
Again click on relationship.
Select checkbox and copy.
click on view fields tab.
Click on table fields.
Double click on table name and select the fields which you want.
Double click on the another table and select the fields which you want.
Click on maintenance status.
save+check+activate.
Goto SE54(table maintenance generator).
Provide view name and create
Utilities + table maintenance generator.
Authorisation group: &NC&.
Function group: Table name (ex:ZTHILAK_EMP).
Maintenance type: select one step.
Screen number: ex:10.
Click on create.
Go to: SE93.
Provide transaction code: give the name for the end user (ex: ZTHILAK).
Select transaction with parameter
Transaction--SM30
Select skip initial screen.
NAME OF THE SCREEN FIELD VALUE
VIEWNAME TABLE NAME (ex:ZTILAK)
UPDATE OR SHOW X
7/29/2019 ABAP for Students
25/84
SAP-ABAP
25
Kiran
7/29/2019 ABAP for Students
26/84
SAP-ABAP
26
Kiran
STRUCTURE:
Structure is like a table having fields but the structures do not hold data permanently.
It holds data only at run time (or) it can hold the data once it is linked to a table.
ie when it is independent, it does not hold data.
Structures are of two types.
External structure.
Append(internal) structure.
External structure:
Structure, which is created outside the table is called external structure.
External structures are reusable.
The keyword to add external structure to the table is .include
APPEND STRUCTURE:
Structure, which is created inside the table is called append(internal) structure.
Append structures are not reusable.
The keyword to add append structure to a table using .append
**NOTE:
**we can add append structures to a table only via menu.
**we can create a structure in another structure is called nested structure.
**we can add maximum of9 structures to a table.
Creation of external structure:
Goto SE11.
Select data type and provide structure name (same as creation of table).
Create.
7/29/2019 ABAP for Students
27/84
SAP-ABAP
27
Kiran
Select structure
*component is nothing but the field.
*component type is nothing but the data elemenT.
Double click on data elemenT.
After creating structure save and activate.
Go back to the table and include this structure.
*.include should be placed under the field and provide structure name under
Data Element.
Save+check+activate.
7/29/2019 ABAP for Students
28/84
SAP-ABAP
28
Kiran
CREATION OF APPEND(or)INTERNAL STRUCTURE:
Go to (ex:ZTHILAK_EMP) table.
Go with the menu and go to append structure.
Give the internal (or) append structure name
Give the component and component type.
7/29/2019 ABAP for Students
29/84
SAP-ABAP
29
Kiran
7/29/2019 ABAP for Students
30/84
SAP-ABAP
30
Kiran
NOTE:
**APPEND structures are mainly used to add new fields to a standard table.
INDEX:
Through index, we can search records faster or easier,
When you create a table, the system automatically creates primary index.
ie we cannot create the primary index.
We can only create the secondary index.
We can create maximum of 16-primary keys in a table.
NOTE:
*SAP recommends to give maximum of 16 indexes only, but if we want we can give
more than that.
Index is like a table but having minimized fields of table.
The data in the index always gets sorted.
SAP recommends dont create more indexes because that consumes lots of memory.
CREATION OF INDEX:
Go to table and click on index.
Provide index name.
7/29/2019 ABAP for Students
31/84
SAP-ABAP
31
Kiran
Provide short description.
Click on table fields and select the fields which you want.
Creation of Search Helps:
Two types of Search Helps are available in SAP-ABAP.
1. Elementary Search Help : Elementary search helps 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 behaviour of the search help).
2. Collective Search Help : Collective search helps combine several elementary
search helps. Collective search help thus can offer several alternative search paths.
Elementary Search Help:
Table Name is : ZTEST_03.
Go with create option
7/29/2019 ABAP for Students
32/84
SAP-ABAP
32
Kiran
Select Elementary Search help and Continue
Save and Activate it.
Execute : F8.
7/29/2019 ABAP for Students
33/84
SAP-ABAP
33
Kiran
Now you can select the values from Search Help.
.
7/29/2019 ABAP for Students
34/84
SAP-ABAP
34
Kiran
Description of fields:
Selection method: name of table or view where the data is stored.
Text table: Filled in by system, if a text table is attached to the selection method.
Dialog type: Determines whether the user is presented with a selection screen before the hit list is
displayed.
Possible values:
ADialog depends on set of values. If there are more than 100 hits, a selection screen is displayed.
Otherwise, the hit list is displayed immediately.
D - Display values immediately.
CDialog with value restriction. A selection screen is always displayed.
Hot key: allows user to type a shortcut into the field to bypass selection of elementary search help.
Search help exit: - specify the name of a function module to be called during the search help process
(more later).
Search help parameters: Specify the names of parameters to be passed in / out, or additional fields
to be used as filters for data.
IMP: Check this box to indicate that the field is an input field, that is, to be passed to the search help.
EXP: Check this box to indicate that the field is an output field, that is, to be passed from the searchhelp to the screen.
LPOS: The position of the as it appears in the hit list.
SPOS: The position of the field as it appears in the selection screen.
SDIS: Causes the field to be display only in the selection screen.
Data element: Sets the attributes of the search help parameter. Normally filled in by the system.
MOD: Check this box to assign a different data element than the one supplied by the system.
Default value: Specify the default value in one of 3 ways: a literal(in quotes), a parameter ID(ZRD),
or a system field (SY-UNAME).
7/29/2019 ABAP for Students
35/84
SAP-ABAP
35
Kiran
Assign ZTEST_01 search help to field:
Put the cursor on which you are gonna to assign the Search Help and Go with Srch Help Push button.
Provide the Search Help Name which we created (ZTEST_01).
7/29/2019 ABAP for Students
36/84
SAP-ABAP
36
Kiran
Go with Continue.
And go with Copy option. U can find the below message on Status Bar.
Check and Activate it.
Go with Contents Button (Cntrl+Shift+F10).
7/29/2019 ABAP for Students
37/84
SAP-ABAP
37
Kiran
U can find Search Help Switch now. Just select that using F4 key. U can find the below screen.
.
Create another Elementary Search Help i.e ZTEST_02.
Creation of Collective Search Help:
7/29/2019 ABAP for Students
38/84
SAP-ABAP
38
Kiran
Continue.
Provide the Short Description and Fields with data elements.
Go with the TAB : Included Search Helps.
Provide two Elementary Search Helps which we created now.
7/29/2019 ABAP for Students
39/84
SAP-ABAP
39
Kiran
Save and Activate it. Now go with F8(Execute).
U can find 2 Tabs each one is Elementary Search Help (ZTEST_01, ZTEST_02).
In the same you can assign this Collective Search help to required field as Elementary Search Help(As
above).
Diff Between Elementary search helps & Collective search helps
1) Elementary search helps 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).
2) Collective search helps combine several elementary search helps. Collective search help thus can
offer several alternative search paths.
3) An elementary search help defines the standard flow of an input help.
4) A collective search help combines several elementary search helps. The user can thus choose one
of several alternative search paths with collective search help.
5) A collective search help comprises several elementary search helps. It combines all the search
paths that are meaningful for a field.
6) Both elementary search helps and other search helps can be included in a collective search help. If
other collective search helps are contained in collective search help, they are expanded to the level of
the elementary search helps when the input help is called.
7/29/2019 ABAP for Students
40/84
SAP-ABAP
40
Kiran
PROGRAMMING
We write programs in ABAP Editor.
t.code for ABAP editor is SE38.
ABAP editor is not a case sensitive.
The statement ends with .
*in the extreme left indicates the comment line.
ABAP editor is a line editor and it executes line by line.
The output of ABAP program is called LIST or SCREEN.
TYPES OF PROGRAMS:
Executable program.
Include program.
Sub-routine pool program.
Function group/function module.
Module pool program.
Class pool program.
**NOTE:
WRITE is the output statement.
WRITE statement display the output on the LIST but not on the SCREEN.
CREATION OF A PROGRAM:
Goto SE38.
Provide program name.
Create.
Provide the title of the program.
Type execute program.
Status PSAP standard production program.
Save + localobject
7/29/2019 ABAP for Students
41/84
SAP-ABAP
41
Kiran
USE OF WRITE STATEMENT:
Report ZPRG_WRITE. OUTPUT:
WRITE 'NEERAJ'. Program on write statement
{Standard page heading}
NEERAJ
To remove standard page heading:
REPORT ZPRG_WRITE NO STANDARD PAGE HEADING. OUTPUT:
WRITE 'NEERAJ'. NEERAJ
NOTE:
*To go to the next line provide /.
*When we put , we should put column (:).
EX:
WRITE:/ 'AMIT',/ 'SUBRA PRAKASH'.
OUTPUT:
AMIT
SUBRA PRAKASH
NOTE:
: chain operator.
To get the spaces between two lines SKIPNO (ex-skip3) have to use.
EX:
WRITE / 'TILAK'.
SKIP 3.
WRITE:/ 'AMIT',/ 'SUBRA PRAKASH'.
OUTPUT:
Tilak
AMIT
SUBRA PRAKASH
To provide the spaces in the same line / no(ex:/ 50).
7/29/2019 ABAP for Students
42/84
SAP-ABAP
42
Kiran
EX:
WRITE:/50 'MOHIT'.
OUTPUT:
Mohit
To provide the one name under another name then the keyword UNDER have to use.
EX:
WRITE:/ 'PRAVENDRA' UNDER 'MOHIT'.
OUTPUT :
Mohit
Pravendra
To provide the colour to text.
EX :
WRITE:/30 'SRINIVASAN' COLOR 1.
Output :
WRITE:/30 'SRINIVASAN' COLOR 1 INTENSIFIED OFF.
OUTPUT:
WRITE:/30 'SRINIVASAN' COLOR 1 INVERSE.
OUTPUT:
**HOTSPOT:
HOTSPOT is the keyword is used to change the symbol like hand symbol.
EX:
WRITE:/20 'ANANYA' COLOR 6 HOTSPOT.
7/29/2019 ABAP for Students
43/84
SAP-ABAP
43
Kiran
OUTPUT
NOTE:
When you take your curser to ANANYA that curser symbol will change to HAND symbol.
QUICK INFO:
Quick info is used to give the quotation.
EX:
WRITE:/50 'SWATI' COLOR 7 QUICKINFO 'Hi...How are you'.
OUTPUT:
NOTE:
When you take your cursor to swati that will display the quotation what we have given (ex:hi...how
are you).
*To provide the underline, the keyword ULINE has to use.
EX:
ULINE.
ULINE /20(30).
OUTPUT:
To change the input on the OUTPUT screen:
EX:
WRITE:/ 'YOUR INPUT HERE' INPUT.
OUTPUT:
** here we can give any input here.
When we scroll the page also if we dont want to scroll anything we have to use the
NEW_LINE NO SCROLLING.
EX:
NEW-LINE NO-SCROLLING.
WRITE:/20 'ANANYA' COLOR 6.
NOTE:
*If we scroll the page also ANANYA wont scroll.
To get the SCROLLBAR we have to initialise the screen at the beginning of the program.
7/29/2019 ABAP for Students
44/84
SAP-ABAP
44
Kiran
EX:
LINE-SIZE 255.
To give the check box the command checkbox have to use.
EX:
WRITE:/40 'INDIAN', 'ABC' AS CHECKBOX.
ABC is the name of the checkbox.
OUTPUT:
To disable the checkbox the keyword checkbox INPUT OFF have to use.
WRITE:/40 'INDIAN', 'ABC' AS CHECKBOX INPUT OFF.
OUTPUT:
NOTE:
To see the ICONS available in SAP, go to initial screen and enter the ICON in the COMMAND
FIELD.
To get the icons on the output screen:
INCLUDE .
WRITE:/50 ICON_RED_LIGHT AS ICON.
WRITE: 60 ICON_GREEN_LIGHT AS ICON.WRITE: 70 ICON_CLOSED_FOLDER AS ICON.
WRITE: 80 ICON_SYSTEM_CUT AS ICON.
WRITE: 90 ICON_DELETE AS ICON.
OUTPUT:
7/29/2019 ABAP for Students
45/84
SAP-ABAP
45
Kiran
PROGRAMS on WRITE statement:
1.Program on WRITE
*&---------------------------------------------------------------------*
*& Report ZPRG_WRITE
*&*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZPRG_WRITE NO STANDARD PAGE HEADING
LINE-SIZE 255.
WRITE 'NEERAJ'.
WRITE / 'TILAK'.
SKIP 3.
WRITE:/ 'AMIT',/ 'SUBRA PRAKASH'.
WRITE:/50 'MOHIT'.
WRITE:/ 'PRAVENDRA' UNDER 'MOHIT'.
WRITE:/30 'SRINIVASAN' COLOR 1.
WRITE:/30 'SRINIVASAN' COLOR 1 INTENSIFIED OFF.WRITE:/30 'SRINIVASAN' COLOR 1 INVERSE.
NEW-LINE NO-SCROLLING.
WRITE:/20 'ANANYA' COLOR 6 HOTSPOT.
WRITE:/50 'SWATI' COLOR 7 QUICKINFO 'Hi...How are you'.
ULINE.
ULINE /20(30).
WRITE:/ 'YOUR INPUT HERE' INPUT.
WRITE:/40 'INDIAN', 'ABC' AS CHECKBOX.
WRITE:/40 'INDIAN', 'ABC' AS CHECKBOX INPUT OFF.
INCLUDE .
WRITE:/50 ICON_RED_LIGHT AS ICON.
WRITE: 60 ICON_GREEN_LIGHT AS ICON.
WRITE: 70 ICON_CLOSED_FOLDER AS ICON.
WRITE: 80 ICON_SYSTEM_CUT AS ICON.
WRITE: 90 ICON_DELETE AS ICON.
7/29/2019 ABAP for Students
46/84
SAP-ABAP
46
Kiran
OUTPUT:
DATA TYPES IN PROGRAMING:
CHARECTER data type.
NUMERIC data type.
CHARECTER DATA TYPE:
DATA TYPE DESCRIPTION LENGTH IN BYTES INITIAL VALUE
C character 1 Blank
D date 8 00000000
T time 6 000000
X hexadecimal 1 - - - - - -
7/29/2019 ABAP for Students
47/84
SAP-ABAP
47
Kiran
NUMERIC DATA TYPE:
DATA TYPE DESCRIPTION LENGTH IN BYTES INITIAL VALUE
N Numeric 1 0
I Integer 4 0
P Packed decimal 8 0
F Floating point 8 0.0
The maximum DECIMAL places in the PACKED DECIMAL is 14.
STRING holds for bigger characters.
XSTRING holds for graphics.
We can defined a variables in TWO different ways.
TYPES.
DATA.
** If we define the variable as TYPE, no memory gets allocate to variable.
** If we define the variable as DATA ,the memory gets allocate to variable.
SYNTAX for TYPES :
TYPES TYPE .
EX:
TYPES A TYPE I.
HERE:
A variable name.
I integer type.
NOTE:
Memory doesnt allocate to the variable A.
7/29/2019 ABAP for Students
48/84
SAP-ABAP
48
Kiran
SYNTAX for DATA :
DATA TYPE .
EX:
DATA B TYPE I.
HERE:
B variable name.
I integer type.
NOTE:
Memory gets allocate to the variable B.
To initialise multiple variables with the same data types we can use chain operator(:).
EX:
DATA : A TYPE I,
B TYPE I,
C TYPE I.
EX:
DATA : NAME (30) TYPE C,
CITY LIKE NAME.
NAME(30) indicates that 30 characters gets allocate to NAME.
When we give LIKE that also gets allocate the same size.
PROGRAMS ON DATA and TYPE:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING.
DATA: A TYPEI, OUTPUT
B TYPEI, 160
CTYPEI.
A = 100.
B = 60.
C = A + B.
WRITE / c.
7/29/2019 ABAP for Students
49/84
SAP-ABAP
49
Kiran
To ASSIGNIING the VALUES directly to the VARIABLES:
EX 1:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING.
DATA: A TYPEIVALUE100,
B TYPEIVALUE60, OUTPUT
CTYPEI. 160
C = A + B.
WRITE / c.
EX 2:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING.
DATA: A TYPEIVALUE100,
B TYPEIVALUE60, OUTPUT
CTYPEI. 100 + 60=160
C = A + B.
WRITE/ A + B = c.
EX:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING.
DATA: A TYPEIVALUE100,
B TYPEIVALUE60, OUTPUT
CTYPEI. 100+60=160
C = A + B.
WRITE / A color1'+' B color2'='ccolor3.
7/29/2019 ABAP for Students
50/84
SAP-ABAP
50
Kiran
TO GIVE THE DECIMALS:
EX:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING.
DATA: A TYPEIVALUE25,
B TYPEIVALUE3, OUTPUT
CTYPEP DECIMALS 4. 8.3333
C = A / B.
WRITE /c.
STRING OPERATIONS:
EX1:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING. OUTPUT
THILAK
DATA: name(30) TYPEcVALUE'THILAK'.
WRITE:/ name.
EX2:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING. OUTPUT
THI
DATA: name(30) TYPEcVALUE'THILAK'.
WRITE:/50(3) name.
NOTE:
50 is the spaces and 3 is the characters size.
EX 3:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING. OUTPUT
THILAK
DATA: name(30) TYPEcVALUE'THILAK'.
WRITE:/ name RIGHT-JUSTIFIED.
7/29/2019 ABAP for Students
51/84
SAP-ABAP
51
Kiran
EX 3:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING. OUTPUT
THILAK
DATA: name(30) TYPEcVALUE'THILAK'.
WRITE:/ name CENTERED.
Concatenation:
EX:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING.
DATA: name1(30) TYPEcVALUE'THILAK', OUTPUT
name2(30) TYPEcVALUE'KORLEPARA', THILAKKORLEPARA
name3(60) typec.
CONCATENATE name1(6) name2(9) INTO name3.
WRITE name3.
TRANSLATE:
EX:
REPORT ZPRG_VAR1 NOSTANDARDPAGE HEADING. OUTPUT
DATA: name(10) typecVALUE'THILAK'. thilak
TRANSLATE name toLOWERCASE.
write: / name.
RETRIEVEING DATA FROM DATA BASE:
We retrieve data from data base tables by SELECT statement.
ABAP supports two kinds of statements those are
NATIVE SQL statements.
OPEN SQL statements.
7/29/2019 ABAP for Students
52/84
SAP-ABAP
52
Kiran
**Even if you change the data in the data base, OPEN SQL statements runs without any
problem.
Comparison Operators in Where Condition with Select Statement:
operator Meaning
EQ Equals
= Equals
NE Does not equal
Does not equal
LT less than
= Greater than or equal to
Values in Intervals:
To find out whether the value of a column lies within a particular interval, use:SELECT... WHERE s NOT BETWEEN f1 AND f2...Comparing Strings
To find out whether the value of a column matches a pattern, use:
SELECT... WHERE s NOT LIKE f .The condition is true if the value of the column s matches [does not match] the pattern in the data
object f. You can only use this test for text fields. The data type of the column must be alphanumeric.
f must have data type c.
You can use the following wildcard characters in f:
% for a sequence of any characters (including spaces). _ for a single character.
Checking Lists of Values
To find out whether the value of a column is contained in a list of values, use:
SELECT... WHERE s NOT IN (f1,......, fn)...The condition is true if the value of column s is [not] in the list f1 fn .
Checking Selection Tables
To find out whether the value of a column satisfies the conditions in a selection table, use:
http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/frameset.htmhttp://help.sap.com/saphelp_nw70/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/frameset.htmhttp://help.sap.com/saphelp_nw70/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/frameset.htmhttp://help.sap.com/saphelp_nw70/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/frameset.htm7/29/2019 ABAP for Students
53/84
SAP-ABAP
53
Kiran
SELECT... WHERE s NOT IN seltab...The condition is true if the value ofs [does not] satisfy the conditions stored in seltab. seltab
can be either a real selection table or a RANGES table. You cannot check a selection table in the ON
condition of the FROMclause.
Checking for Null Values
To find out whether the value of a column is null, use:
SELECT... WHERE s IS NOT NULL...The condition is true if the value ofs is [not] null.
Tabular Conditions
TheWHERE clause of the SELECT statement has a special variant that allows you to derive
conditions from the lines and columns of an internal table: This variant is as follows:
SELECT... FOR ALL ENTRIES IN itab WHERE cond...
WORK AREA:
WORK AREA is a small memory created inside the RAM in the APPLICATION SERVER.
The data in the WORK AREA is not permanent.
The data in the WORK AREA gets overwrite.
WORK AREA can hold only one record at a time.
WORK AREA is also called as FIELD STRING.
EX:
Fig: ZEMP (WA) OUTPUT
ENO ENAME ECITY
fig: ZEMPX1
ENO ENAME ECITY
100 ABC Bang
101 CDE HYD
102 DEF CHE
100 ABC BANG
101 CDE HYD
102 DEF CHE
7/29/2019 ABAP for Students
54/84
SAP-ABAP
54
Kiran
EX:
Data:gt_itab type standard table of ZEMPX1,
Gwa_itab type ZEMPX1.
SELECT * from ZEMPX1 into table gt_itab.
Loop at gt_itab into gwa_zemp.
Write: / gt_itab-ENO, gt_itab -ENAME, gt_itab -ECITY.
Endloop.
NOTE: transaction code is nothing but interface.
To see the person from particular city then we can use where condition.
SELECT * from zempx1 into gt_itab where ECITY = bang.
Loop at gt_itab into gwa_zemp.
Write: / gt_itab-ENO, gt_itab -ENAME, gt_itab -ECITY.
Endloop.
OUTPUT:
100 ABC BANG
To see the records between the range:
SELECT * from ZEMPX1 into gt_itab WHERE ENO BETWEEN 100 AND 102.
Loop at gt_itab into gwa_zemp.
Write: / gt_itab-ENO, gt_itab -ENAME, gt_itab -ECITY.
Endloop.
OUTPUT:
100 ABC BANG
101 CDE HYD
102 DEF CHE
CORRESPONDING FIELDS OF:
When the number of fields retrieved by the SELECT statement and the number of fields of
WORK AREA are not same, then we have to use the CORRESPONDING FIELDS OF key word in the
SELECT statement.
When we use CORRESPONDING FIELDS OF key word in the SELECT statement, the table
FIELD NAMES and the WORK AREA FIELD NAMES should be the same.
7/29/2019 ABAP for Students
55/84
SAP-ABAP
55
Kiran
EX :SELECT * FROM ZEMPX1 INTO CORRESPONDING FIELDSOF table gWA_itab.
Loop at gt_itab into gwa_itab.
WRITE:/ gWA-Eno, gWA-ENAME, gWA-ECITY, gWA-PHONE.
Clear:gwa_itab.
Endloop.
PROVIDING THE VALUES AT RUN TIME:
PARAMETERS.
SELECT-OPTIONS.
PARAMETERS:
PARAMETERS allows the user to provide single inputvalue at runtime on a SELECTION
SCREEN.
SYNTAX:
Parameters TYPE .
TO ACCESS THE TABLE FIELDS:
SYNTAX:
Parameters LIKE .
SELECT-OPTIONS:
SELECT-OPTIONS allows the user to provide two inputvalue at runtime on a SELECTION
SCREEN (range of values).
The left value is called LOW value.
The RIGHT value is called HIGH value.
When we use SELECT-OPTIONS in the program, system automatically creates an internal table
with four fields.
LOW.
HIGH.
SIGN.
OPTION.
7/29/2019 ABAP for Students
56/84
SAP-ABAP
56
Kiran
SYNTAX:
SELECT-OPTIONS for .
PARAMETERS: A TYPEI,
B TYPEI,
CTYPEI.
C = A + B.
WRITE / C.
OUTPUT
On the selection screen
A 50
B 50 execute(F8).
On the list
100.
NOTE:
The name of the parameter and select-option should not cross 8-characters.
PARAMETERS EMP_NO TYPE ZEMPX1-ENO.
DATA:gwa_itab type zempx1.
SELECT single * FROM ZEMPX1 INTO CORRESPONDING FIELDSOF WA WHERE ENO =
EMP_NO.
WRITE: / GWA_ITAB-ENO, GWA_ITAB-ENAME, GWA_ITAB-ECITY.
EX-2:
SELECT-OPTIONS EMP_NO FOR ZEMPX1-ENO.
DATA: GT_ITAB TYPE TABLE OF ZEMPX1.
SELECT * FROM ZEMPX1 INTO CORRESPONDING FIELDSOF WA WHERE ENO IN EMP_NO.
LOOP AT GT_ITAB INTO GWA_ITAB.
WRITE: / GWA_ITAB-ENO, GWA_ITAB-ENAME, GWA_ITAB-ECITY.
CLEAR:GWA_ITAB.
ENDLOOP
**INTERNAL TABLE
Internal tables provide a means of taking data from a fixed structure and storing it in working memory
in ABAP. The data is stored line by line in memory, and each line has the same structure. In ABAP,
internal tables fulfill the function of arrays.
Internal tables are advanced than field strings(WA).
It can hold multiple records at a time.
7/29/2019 ABAP for Students
57/84
SAP-ABAP
57
Kiran
*When we use ITAB that indicates that header of the internal table.
*When we use ITAB[ ] indicates that body of the internal table.
Internal table has BODY and HEADER.
Internal table header is also called work area.
Internal table header can hold only one recordat a time.
The data in the internal table header always gets overwrite.
We can pass data to the output from internal table through header only.
We can create internal table without header also.
When the internal table does not have header, we need to create header explicitly (or) assign the field
symbol.
TYPES OF INTERNAL TABLES:
STANDARD.
SORTED.
HASHED.
STANDARD INTERNAL TABLE:
STANDARD INTERNAL TABLE records have index numbers, so index assigning is possible.
This internal table also have key access.
Key access is not unique default.
Standard internal table follows linear-search.
Standard This is the most appropriate type if you are going to address the individual table entries
using the index. Index access is the quickest possible access. You should fill a standard table by
appending lines (ABAPAPPEND statement), and read, modify and delete entries by specifying the
index (INDEX option with the relevant ABAP command). The access time for a standard table
increases in a linear relationship with the number of table entries. If you need key access, standardtables are particularly useful if you can fill and process the table in separate steps. For example, you
could fill the table by appending entries, and then sort it. If you use the binary search option (BINARY)
with key access, the response time is logarithmically proportional to the number of table entries.
SORTED INTERNAL TABLE:
SORTED INTERNAL TABLE records have index numbers, so index assigning is possible.
This internal table also have key access.
Key access is Unique Key or Non-Unique Key.
Sorted internal table follows binary-search.
7/29/2019 ABAP for Students
58/84
SAP-ABAP
58
Kiran
The data in the internal table gets automatically gets sorted in the ascending order based on
the key-field name.
This is faster than standard internal table in searching.
This is the most appropriate type if you need a table which is sorted as you fill it. You fill sorted tables
using the INSERT statement. Entries are inserted according to the sort sequence defined throughthe table key. Any illegal entries are recognized as soon as you try to add them to the table. Theresponse time for key access is logarithmically proportional to the number of table entries, since thesystem always uses a binary search. Sorted tables are particularly useful for partially sequentialprocessing in a LOOP if you specify the beginning of the table key in theWHERE condition.
HASHED INTERNAL TABLE:
HASHED INTERNAL TABLE records does not have index numbers, so index assigning is not
possible.
This internal table also have key access.
Key access is always Unique..
hashed internal table is faster than the sorted internal table.
This is the most appropriate type for any table where the main operation is key access. You cannotaccess a hashed table using its index. The response time for key access remains constant,regardless of the number of table entries. Like database tables, hashed tables always have a uniquekey. Hashed tables are useful if you want to construct and use an internal table which resembles adatabase table or for processing large amounts of data.
SYNTAX TO CREATE STANDARD INTERNAL TABLE:
TYPES: BEGIN OF ,
END OF .
DATA: TYPE STANDARD TABLE OF ,
TYPE .
NOTE:
APPEND is used to fetch the data from header to body.
LOOPAT is used to fetch the data from body to header.
Declaration:
CREATING A STRUCTURE:
TYPES:BEGINOF TP_ITAB , structure
ENO LIKE ZEMPX1-ENO,ENAME LIKE ZEMPX1-ENAME,
7/29/2019 ABAP for Students
59/84
SAP-ABAP
59
Kiran
ECITY LIKE ZEMPX1-ECITY,
ENDOF TP_ITAB.
DATA:ITAB TYPESTANDARDTABLEOF TP_ITAB,
WA_ITAB TYPE TP_ITAB.
SELECT eno ename ecity FROM zempx1 INTOTABLE itab.
LOOPAT itab INTO wa_itab.
WRITE: / wa_itab-eno, wa_itab-ename, wa_itab-ecity.
CLEAR:wa_itab.
ENDLOOP.
TABLE KEYWORD IN THE SELECT STATEMENT:
When we use TABLE keyword in the select statement, all the required data from database will
be retrieved into the ITAB body with the SINGLE hit in the database. By this we can avoid the load in
the database.
SYNTAX TO CREATE SORTED INTERNAL TABLE:
DATA LIKE SORTED TABLE OF WITH UNIQUE/ NON-UNIQUE KEY WITH
HEADERLINE.
SYNTAX TO CREATE HASHED INTERNAL TABLE:
DATA LIKE STANDARD TABLE OF WITH UNIQUE KEY WITH HEADERLINE.
ANOTHERWAY:
TYPES: BEGIN OF TY_ITAB,
INCLUDE STRUCTURE ZEMPX1,
END OF TY_ITAB.
INTERNAL TABLE COMMANDS:
CLEAR.
REFRESH.
FREE.
COLLECT
7/29/2019 ABAP for Students
60/84
SAP-ABAP
60
Kiran
APPEND.
INSERT.
DELETE.
MODIFY
SORT.
READTABLE.
LOOPAT.
CLEAR:
It removes the data present in the internal table header.
REFRESH:
It removes the data present in the internal table body and the memory allocates remains same.
FREE:
It removes the data present in the internal table body and the memory allocated to it gets free.
APPEND:
It is used to copy the data from internal table header to body generically.
COLLECT:
It copies the data from internal table header to the body generically, when the similar record is
processed again it over writes the character values and integer values gets added.
INSERT:
Insert the record from header to body between the existing records based on the index number.
DELETE;
It is used to delete the existing record from internal table body based on the index number.
MODIFY:
It is used to modify the existing record present in the internal table body based on index number.
If there is no record, modify wont work.
SORT:
It is used to sort the internal table in ascending order by default based on the field name.
To change it to descending order just add a keyword descending.
7/29/2019 ABAP for Students
61/84
SAP-ABAP
61
Kiran
SOME STANDARD TABLES:
KNA1 Customer master table.
LFAI vendor master table.
VBAK sales document header table.
VBAP sales document item table.
MARA material master table.
MAKT material description table.
MARC plant data for material.
MARD storage location data for material.
EKKO purchasing document header table.
EKPO purchasing document item table.
VBUP sales document item status.
VBUK sales document header status.
VBEP sales document scheduling data.
BNKA bank master table.
LNBK customer bank details.
LFBK vendor master bank details.
T001 company codes.
T002 language keys.
T005 countrys.
SBOOK single flight booking.
SFLIGHT flight details table.
SPFLI flight schedule table.
TRANSACTION CODES related to END-USERS and FUNCTIONALS:
MM01 Create material.
MM02 Change material.
MM03 Display material.
XD01 Create customer.
XD02 Change customer.
7/29/2019 ABAP for Students
62/84
SAP-ABAP
62
Kiran
XD03 Display customer.
XK01 Create vendor.
XK 02 Change vendor.
XK 03 Display vendor.
MES1N Create purchase requisition.
MES2N Change purchase requisition.
MES3N Display purchase requisition.
ME21N Create purchase order.
ME22N Change purchase order.
ME23N Display purchase order.
VA11 Create enquiry.
VA12 Change enquiry.
VA13Display enquiry.
VA21 Create quotation.
VA22 Change quotation.
VA23 Display quotation.
VA01 Create sales order.
VA02 Change sales order.
VA03 Display sales order.
VF01 Create delivery.
VF02 Change delivery.
VF03 Display delivery.
VL01 Create bill.
VL02 Change bill.
VL03 Display bill.
7/29/2019 ABAP for Students
63/84
SAP-ABAP
63
Kiran
ABAP SYSTEM FIELDS:
These are the pre-defined fields provided by SAP for developer to decrease the complexity of
programs and these fields helps a lot while coding.
ABAP system fields holds data at run time.
All ABAP System field name starts with SY-
SY-MANDT holds CLIENT NUMBER..
SY-UNAME holds CURRENT USER NAME.
SY-LANGU HOLDS LOG-IN LANGUAGE.
SY-DATUM HOLDS SERVER DATE.
SY-UZEIT HOLDS CURRENT SERVER TIME.
SY-PAGNO PAGE NUMBER.
SY-REPID PROGRAM NAME.
SY-TCODE TRANSACTON CODE.
SY-DBCNT NUMBER OF RECORDS RETRIEVED FROM THE DATABASE BY
THESELECT STATEMENT (it automatically RESETS to 1 after the execution of other
events).
SY-DBSYS DATABASE NAME.
SY-TFILL NUMBER OF ROWS OF THE INTERNAL TABLE.
SY-INDEX LOOP INDEX NUMBER.
SY-TABIX CURRENT INTERNAL TABLE INDEX NUMBER.
SY-DYNNR CURRENT SCREEN NUMBER.
SY-CPAGE CURRENT PAGE NUMBER OF THE LIST.
SY-LSIND LIST INDEX NUMBER.
SY-UCOMM USER COMMANDS OR FUNCTIONAL CODES.
SY-SUBRC:
If SY-SUBRC is equal to0, then the condition is TRUE.
If SY-SUBRC is not equal to 0, then the condition is FALSE.
*All the SYSTEM FIELDS are available in the structure called SYST.
7/29/2019 ABAP for Students
64/84
SAP-ABAP
64
Kiran
VARIANTS:
VARIANT is the PRE-DEFINED INPUT value.
VARIANTS plays very important role in the BACKGROUND JOB SCHEDULING.
After creating a variant system creates a button in the APPLICATION TOOL BAR atSELECTION SCREEN called GET VARIENT BUTTON.
NOTE: before creating VARIANT, the program should be in ACTIVE.
CREATION OF VARIANT:
Provide program name.
Create
Click on attributes.
Provide Meaning ex: customers from 1000 to 1500.
Save.
ONLY FOR BACKGROUND PROCESS:
It is used in the BACK GROUND PROCESSING not in the FORE GROUND (this is not
displayed in the VARIANT CATALOGUE ).
ATTRIBUTES:
The ATTRIBUTES of a program provides
PROGRAM TITLE.
ORIGINAL LANGUAGE.
DATE OF CREATION.
CHANGE USER NAME WHO HAS CREATED.
CHANGE PROGRAM STATUS.
PROGRAM TYPE.
AUTHORISATION GROUP.
PACKAGE NAME.
LOGICAL DATABASE NAME,etc....,
EDITOR LOCK ANOTHER USERS CAN NOT EDIT THE PROGRAM.
7/29/2019 ABAP for Students
65/84
SAP-ABAP
65
Kiran
DOCUMENTATION:
Documentation provides the some information about the report.
When we create the documentation for a PROGRAM, system creates the button in the
application toolbar at the SELECTION SCREEN called PROGRAM DOCUMENTATION button.
When user click on the button, the system opens the window called PERFORMANCE
ASSISTANCE WINDOW.
TEXT ELEMENTS:
Text elements provides
TEXT SYMBOLS.
SELECTION TEXTS.
LIST HEADINGS.
COLUMN HEADINGS.
to provide UNDERLINE in the selection screen just provide the UNDERLINE in the SELECTION
SCREEN.
ex: SELECTION-SCREEN ULINE.
JOINS:
Through JOINS we can retrieve data from two or more tables at a time.
To retrieve data from two or more tables, there should be a common field in both tables.
Joins are TWO TYPES:
INNER JOIN.
LEFT OUTER JOIN.
INNER JOIN:
Inner join retrieves data from two different tables when there is a common record in the
common field.
EX:
REPORT ZPROG_JOINS.
TABLES kna1.
SELECT-OPTIONS cust FOR kna1-kunnr DEFAULT1000TO2000.
TYPES: BEGINOF itab ,
kunnr LIKE kna1-kunnr,
land1 LIKE kna1-land1,
name1 LIKE kna1-name1,
7/29/2019 ABAP for Students
66/84
SAP-ABAP
66
Kiran
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
netwr LIKE vbak-netwr,
waerk LIKE vbak-waerk,
ENDOF itab.
DATA:i_itab TYPETABLEOF itab,
wa_itab TYPE itab.
SELECT kna1~kunnr kna1~land1 kna1~name1 vbak~vbeln vbak~erdat vbak~netwr
vbak~waerk
INTOTABLE i_itab
FROM kna1 LEFT OUTER JOIN vbak
ON kna1~kunnr = vbak~kunnr
WHERE kna1~kunnr IN cust
ORDERBY kna1~kunnr.
FORMATCOLOR2.
LOOPAT i_itab INTO wa_itab.
WRITE:/ wa_itab-kunnr COLOR4, wa_itab-land1, wa_itab-name1,
wa_itab-vbeln COLOR7, wa_itab-erdat, wa_itab-netwr, wa_itab-
waerk COLOR3.
CLEAR:wa_itab.
ENDLOOP.
ULINE.
WRITE:/ sy-dbcnt.
LEFT OUTER JOIN:
When there is a common record in the common field and also all the left table records even
though there is no common record in the right table so it put NULL values in the RIGHT SIDE.
CONTROL BREAKS(internal table events):
It controls the flow of execution of program in an internal table loop.
7/29/2019 ABAP for Students
67/84
SAP-ABAP
67
Kiran
STATEMENTS:
AT FIRST.
ENDAT.
AT LAST.
ENDAT.
AT NEW .
ENDAT.
AT END OF .
ENDAT.
ON CHANGE OF .
ENDON.
SUM.
AT FIRST:
AT FIRST event executes before processing the first record from internal table.
AT LAST:
AT LAST event executes after processing last record from the internal table.
AT NEW.
This event executes when ever new record is gonna to process
AT END OF .
This event executes after group of similar group records.
7/29/2019 ABAP for Students
68/84
SAP-ABAP
68
Kiran
ON CHANGE OF
This event executes when ever change occurs.
SUM
This event is used to add integer values inside the internal table.
NOTE:
LOOP executes based on the number of RECORDS.
REPORT zss_test LINE-SIZE255NOSTANDARDPAGE HEADING.
TABLES kna1.
SELECT-OPTIONS cust FOR kna1-kunnr DEFAULT1000TO1003.
TYPES: BEGINOF itab ,
kunnr LIKE kna1-kunnr,
land1 LIKE kna1-land1,
name1 LIKE kna1-name1,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
netwr LIKE vbak-netwr,
waerk LIKE vbak-waerk,
ENDOF itab.
DATA: i_itab TYPETABLEOF itab,
wa_itab TYPE itab.
SELECT kna1~kunnr kna1~land1 kna1~name1 vbak~vbeln vbak~erdat vbak~netwr
vbak~waerk
INTOTABLE i_itab
FROM kna1 JOIN vbak
ON kna1~kunnr = vbak~kunnr
WHERE kna1~kunnr IN cust
ORDERBY kna1~kunnr.
LOOPAT i_itab INTO wa_itab.
ATFIRST.
FORMATCOLOR1.
WRITE:/ 'Customer and their Sales Report'.
ENDAT.
ATNEW kunnr.
WRITE:/ wa_itab-kunnr COLOR2.
ENDAT.
FORMATCOLOR4.
WRITE:/15 wa_itab-land1, wa_itab-name1, wa_itab-vbeln, wa_itab-
7/29/2019 ABAP for Students
69/84
SAP-ABAP
69
Kiran
erdat, wa_itab-netwr, wa_itab-waerk COLOR3.
ATENDOF kunnr.
ULINE.
SKIP.
SUM.
FORMATCOLOR5.
WRITE:/55 'Net Value of Customer', wa_itab-netwr.
ENDAT.
ATLAST.
FORMATCOLOR6.
SUM.
WRITE:/55 'Grand Total of Customer', wa_itab-netwr.
ENDAT.
CLEAR:wa_itab.
ENDLOOP.
MESSAGE CLASS:
Message class is a dictionary of messages.
Message class can store 1000 messages and it starts from ooo to 999.
We can give messages in different languages also.
Messages are REUSABLE.
We call message class is the program by using a keyword
MESSAGE-ID .
TYPES OF MESSAGES:
I INFORMATION MESSAGE.
E ERROR MESSAGE.
W WARNING MESSAGE.
S STATUS MESSAGE.
A ABEND MESSAGE.
7/29/2019 ABAP for Students
70/84
SAP-ABAP
70
Kiran
X EXIT MESSAGE.
INFORMATION MESSAGE:
Information message displays in dialogue box.
When this message is active, the program stops execution by pressing ENTER key,
program starts execution.
ERROR MESSAGE
Error message displays in status bar in the RED color.
When this message is active, the program stops execution by pressing ENTER key ,
program will not continue its execution.
WARNING MESSAGE:
Warning message also displays in status bar in YELLOW color.
When this message is active, the program stops execution by pressing ENTER key , program
continue its execution.
STATUS MESSAGE:
Statusmessage also displays in status bar in GREEN color.
When this message is active, the program will not stops execution .
ABEND MESSAGE:
Abend message displays in DIALOGUE BOX.
When this message is active, the user have only one option to EXIT (un saved data will be lost).
EXIT MESSAGE:
Exit message is for error analysis, when it is active program control goes to ABAP run time
error also called dump analysis.
T.CODE is ST22 for ABAP run time errors, we can go to debugging also.
This message provides information lines
WHAT HAPPENED.
WHAT CAN WE DO.
MESSAGE.
MESSAGE CLASS NAME.
MESSAGE NUMBER.
PROGRAM NAME.
TRANSACTION CODE.
7/29/2019 ABAP for Students
71/84
SAP-ABAP
71
Kiran
CLIENT NUMBER.
USER NAME.
LANGUAGE.
OPERATING SYSTEMS NAME.
DATABASE NAME.
IP ADDRESS.
WORK PROCESS NAME etc...,
CREATION OF MESSAGE CLASS (SE91)
Goto SE91.
Provide the message class name.
Provide short text.
Save+local object.
Click on message tab.
EX:
Program on message classes
REPORT ZPRG_MESS_CLASS NO STANDARD PAGE HEADINGMESSAGE-ID ZMSCL1.
TABLES kna1.
SELECT-OPTIONS cust FOR kna1-kunnr.
TYPES: BEGINOF itab ,
kunnr LIKE kna1-kunnr,
land1 LIKE kna1-land1,
name1 LIKE kna1-name1,
ENDOF itab.
7/29/2019 ABAP for Students
72/84
SAP-ABAP
72
Kiran
DATA: i_itab TYPETABLEOF itab,
wa_itab TYPE itab.
AT SELECTION-SCREEN.
IF cust-low ISINITIALAND cust-high ISINITIAL.
MESSAGE e000.
ELSEIF cust-low ISINITIALOR cust-high ISINITIAL.
MESSAGE w001.
ELSEIF cust-low < 1000OR cust-high > 2000.
MESSAGE x002.
ENDIF.
START-OF-SELECTION.
SELECT kunnr land1 name1 FROM kna1 INTOTABLE i_itab WHERE kunnr IN cus
t.
IF sy-subrc = 0.
MESSAGE i003 WITH sy-dbcnt.
ELSE.
MESSAGE s004.
ENDIF.
FORMATCOLOR3INTENSIFIED OFF.
LOOPAT i_itab INTO wa_itab.
WRITE:/ wa_itab-kunnr COLOR3INTENSIFIEDON, wa_itab-land1, wa_itab-
name1.CLEAR:wa_itab.
ENDLOOP.
7/29/2019 ABAP for Students
73/84
SAP-ABAP
73
Kiran
Modularization:
Dividing the complexity of the program into number of sub-units is called Modularization.
Advantages of Modularization:
Easy error handling .
Reusability of code.
Performance of the program increases.
Modularization Techniques:
Include Program.
Sub-routine pool Program.
Functional Group/Module.
Classes & Methods.
Include Program:
Include program is the one of the programming type.
Include programs do not execute, when they are independent.
To execute the include program, we need to call it from the MAIN PROGRAM.
Include programs are REUSABLE.
We can call one include program into another include program.
SYNTAX to call one include program into another include program is
INCLUDE .
CREATION OF INCLUDE PROGRAM:
Goto SE38.
Provide name
Select INCLUDE PROGRAM.
Ex:
TABLES lfa1.
SELECT-OPTIONS vendor FOR lfa1-lifnr.
TYPES: BEGINOF itab ,
lifnr LIKE lfa1-lifnr,
land1 LIKE lfa1-land1,
name1 LIKE lfa1-name1,ENDOF itab.
7/29/2019 ABAP for Students
74/84
SAP-ABAP
74
Kiran
DATA: i_itab TYPETABLEOF itab,
wa_itab TYPE itab.
SELECT lifnr land1 name1 FROM lfa1 INTOTABLE i_itab WHERE lifnr IN ven
dor.
Sub Routine pool:
Sub Routine pool is also one of the program type.
Sub routine pool programs do not execute when they are independent.
Sub routine pool program is a mini program which we define at the end of the main
program.
A subroutine is an internal modularization unit within a program, to which you can pass data using an
interface. You use subroutines to encapsulate parts of your program, either to make the program
easier to understand, or because a particular section of coding is used at several points in theprogram.
Your program thus becomes more function-oriented, with its task split into different constituent
functions, and a different subroutine responsible for each one.
SYNTAX to CREATE SUB ROUTINE:
FORM.
ENDFORM.
PERFORM is the KEYWORD to call the SUB ROUTINE from MAIN PROGRAM.
SYNTAX to call the SUB ROUTINE from MAIN program:
PERFORM .
The variables defined in the sub routines are local variables, their visibility exists only with
subroutine.
These VARIABLES can not access out side the Subroutine.
Hence, sub routines are LOCAL UNITS.
NOTE:
The name of the subroutine should not cross 30 characters.
We can not create a sub routine in another sub routines, but we can call sub routine from another
sub routine.
The statements after the sub routines can not be accessible.
7/29/2019 ABAP for Students
75/84
SAP-ABAP
75
Kiran
If we want to still access those statements then we need to use an event called
START-OFSELECTION.
TYPES OF SUB ROUTINES:
SUB ROUTINES are of TWO TYPES.
INTERNAL SUBROUTINES.
EXTERNAL SUBROUTINES.
INTERNAL SUB ROUTINES.
Sub routines and its perform statements are in the same program, then the sub routines are
called INTERNAL SUBROUTINES.
EXTERNAL SUB ROUTINES:
Sub routines and its perform statements are in the different program, then the sub routines
are called EXTERNAL SUBROUTINES.
SYNTAX:
PERFORM (PROGRAM NAME).
EXECUTION SEQUENCE:
1
2
3 PERFORM SUB1.
4
5
6 FORM SUB1.
7
8
9 END FORM.
THE EXECUTION WILL BE 1 2 3 6 7 8 9 4 5
Ex: program on subroutine.
WRITE / 'PEPSI'.
PERFORM sub1.
WRITE / 'SPRITE'.
*&---------------------------------------------------------------------* *& Form SUB1
7/29/2019 ABAP for Students
76/84
SAP-ABAP
76
Kiran
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM sub1.
PERFORM sub2.
WRITE:/ 'MAAZA'.
ENDFORM. "SUB1
*&---------------------------------------------------------------------*
*& Form SUB2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM sub2.
WRITE:/ 'SLICE'.
ENDFORM. "SUB2
START-OF-SELECTION.
WRITE / 'THUMS UP'.
Ex-2:
Program on nested sub routine.
REPORT ZPRG_SUB2.
WRITE / 'NIMBOOZ'.
PERFORM SUB1(ZPRG_SUB1).
PERFORM SUB2 INPROGRAM ZPRG_SUB1.
WRITE / 'TRIPICANA LEECHI'.
7/29/2019 ABAP for Students
77/84
SAP-ABAP
77
Kiran
NOTE:
We can terminate the sub routine by using
CHECK.
EXIT.
PASSING VARIABLES THROUGH SUBROUTINE:
USING is the keyword to pass variables through subroutine.
SYNTAX:
PERFORM USING< ACTUAL PARAMETERS>.
FORM USING .
ENDFORM.
Parameters with PERFORM statement are called ACTUAL PARAMETERS.
Parameters with SUBROUTINE are called FORMAL PARAMETERS.(OR)
Parameters with FORM statement are called FORMAL PARAMETERS.
ACTUAL PARAMETERS have DEFAULT MEMORY and also ACTION.
Where as FORMAL PARAMETERS do not have MEMORY BY DEFAULT.
The number of actual parameters should be same as the number of formal parameters.
CALL BY VALUE:
Calling by value: During a subroutine call, the formal parameters are created as copies of the
actual parameters. The formal parameters have memory of their own. Changes to the formal
parameters have no effect on the actual parameters.
REPORT ZPRG_SUB3.
DATA: a TYPEiVALUE100,
b TYPEiVALUE200,
c TYPEi.
PERFORM sub1 USING a b.
c = a + b.
WRITE / c.
*&---------------------------------------------------------------------*
*& Form SUB1
*&---------------------------------------------------------------------*
7/29/2019 ABAP for Students
78/84
SAP-ABAP
78
Kiran
FORM sub1 USINGvalue(e) TYPEivalue(f) TYPEi.
DATA g TYPEi.
e = e / 2.
f = f / 2.
g = e + f.
WRITE / g.
ENDFORM. "SUB1
CALL BY REFERENCE:
Calling by reference: During a subroutine call, only the address of the actual parameter is
transferred to the formal parameters. The formal parameter has no memory of its own, and we
work with the field of the calling program within the subroutine. If we change the formal parameter,
the field contents in the calling program also changes.
EX: program on call by reference.
REPORT ZPRG_SUB3TIL.
DATA: a TYPEiVALUE100,
b TYPEiVALUE200,
cTYPEi.
PERFORM sub1 USING a b.
c = a + b.
WRITE / c.
*&---------------------------------------------------------------------*
*& Form SUB1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->E text
* -->F text
*----------------------------------------------------------------------*
FORM sub1 USING e f.
DATA g TYPEi.
e = e / 2.
f = f / 2.
g = e + f.
WRITE / g.
ENDFORM. "SUB1
7/29/2019 ABAP for Students
79/84
SAP-ABAP
79
Kiran
CALL- BY-VALUE-RESULT:
Calling by value and result: During a subroutine call, the formal parameters are created as copies
of the actual parameters. The formal parameters have their own memory space. Changes to the
formal parameters are copied to the actual parameters at the end of the subroutine.
CHANGING is the keyword to return the values for the subroutine to the main program.
SYNTAX:
PERFORM CHANGING< ACTUAL PARAMETERS>.
FORM CHANGING.
ENDFORM.
EX:
REPORT ZPRG_SUB4.
DATA a TYPEiVALUE100.
PERFORM sub1 CHANGING a.
WRITE / a.
*&---------------------------------------------------------------------*
*& Form SUB1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->VALUE(B) text
*----------------------------------------------------------------------*
FORM sub1 CHANGINGvalue(b).
b = b / 2.
WRITE / b.
ENDFORM. "SUB1
NOTE:
CALL-BY-VALUE RESULT will not gets change until the system finishes the execution of the
subroutine.
HOW TO TERMINATE:
DATA: a TYPEi,
b TYPEi.
a = 25. b = 3.
PERFORM sub1 USING a b.
a = 45. b = 0.
7/29/2019 ABAP for Students
80/84
SAP-ABAP
80
Kiran
PERFORM sub1 USING a b.
a = 33. b = 6.
PERFORM sub1 USING a b.
*&---------------------------------------------------------------------*
*& Form SUB1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->E text
* -->F text
*----------------------------------------------------------------------*
FORM sub1 USING e f.
IF f = 0.
EXIT.
ENDIF.
DATAcTYPE p DECIMALS2.c = e / f.
WRITE / c.
ENDFORM.
PASSING INTERNAL TABLES THROUGH SUBROUTINE:
We can pass internal tables to subroutines through call by reference only.
SYNTAX:
PERFORM TABLES .
FORM TABLES
7/29/2019 ABAP for Students
81/84
SAP-ABAP
81
Kiran
All the related function modules will stores in a functional group.
Function module name is reserved for SAP.
All the function modules of functional groups can access the data.
Function module is a block of code can import data from main program, Process that importeddata and can export the result back to the main program.
Function Modules have:
IMPORT.
EXPORT.
CHANGING.
TABLES.
EXCEPTION.
PARAMETERS.
EXCEPTION HANDLING is possible through FUNCTION MODULE.
**RAISE is the key word to handle EXCEPTIONS through the FUNCTION MODULE.
Function modules are 3 Types:
NORMAL Function Module.
REMOTE ENABLED Function Module.
UPDATE Function Module.
Normal function module works with in the system.
Remote enabled function module works across the system(Land Scape).
Update Function Module: The system performs the module processing asynchronously. Instead of
carrying out the call immediately, the system waits until the next database update is triggered with
the COMMIT WORK command.
There is a difference between a Subroutine and Function Module.
1. Subroutines have no Exceptions Parameters.
FM have Exceptions parameters to catch the exceptions.
2. Subroutines can be accessed locally i.e. local Modularization Unit.
FM have Global Access i.e. they are Global Modularization Unit.
3. Subroutines can not be tested independently.
FM can be tested independently.
4. Subroutines Explicitly wont return any values.
FM explicitly returns values.
7/29/2019 ABAP for Students
82/84
SAP-ABAP
82
Kiran
5. Subroutines is not remote Enables.
FM can be made Remote Enables and can be called from non-SAP systems.
6. Optional parameters cannot be in Subroutines.
FM can be defined with optional Parameters.
they can both return values.
FMs are mainly used when a routine is to be performed by many programs.
Subroutines (forms) are generally only executed within one program.
You can perform routines from other programs, but it's not often done.
both forms and FMs are reusable modularization units.
To distinguish we generally say that forms are used for internal modularization and
FMs are used for external modularization.
To decide on which to implement, consider whether you need the content to be used just for a
limited program
or whether it can be called from many independent programs.
For the first purpose it is better to implement a form whereas for the second we implement an FM.
However, ABAP does not isolate the usage context.
That is; you can call a form from another program within whose code the form is not actually
implemented.
However, this requires attention since the form may utilize global variables.
The same issue holds for FMs.
FMs are encapsulated in function groups and function groups may have global variables that can
be globallyused by all FMs inside it.
Types of Reports in ABAP:
1. Classical Reports
2. Interactive Reports
3. ALV Reports(Noraml/Interactive)
4. Logical Database Reports(LDB Reports)
5. ABAP Query Reports (For Functionals)
6. Report Painter/Writer(For FI Functionals)
Events in an ABAP/4 Report Program
Events are actually used to organize the statements and control the flow of the program. If theprogram contains no explicitly defined event blocks, all the statements in the program form the entireevent block START-OF-SELECTION. ABAP runtime environment automatically introduces a START-OF-SELECTION at the first execution line.
ABAP/4 report programs are event driven programs. Following events are triggered in a report.
7/29/2019 ABAP for Students
83/84
SAP-ABAP
83
Kiran
LOAD OF PROGRAM. - If propgram is of type Executable, M, F, or S; then LOAD-OF-PROGRAM istrigerred first and then INITIALIZATION. The purpose of load of program is to load the program intosystem memory so that the program can be executed.
INITIALIZATION. - just once.
AT SELECTION-SCREEN OUTPUT. - when there is selection-screen
AT SELECTION-SCREEN. - when user interacts.
START-OF-SELECTION. - when F8.This is the default event in ABAP.
END-OF-SELECTION. - At the end
EVENTS IN A CLASSICAL REPORT:
1. INITIALIZATION: This is triggered when the report is loaded in memory.
2. AT SELECTION-SCREEN OUTPUT: This is triggered when the selection screen is loaded inmemory before being displayed.
3. AT SELECTION-SCREEN/ : This event is triggered before leaving the selection screen.
4. START-OF-SELECTION: This is the the first and default event for displaying the report. Data
retrieval logic is written under this event.
OUTPUT EVENT(5, 6):5. TOP-OF-PAGE: This event is triggered every time a new page is started in the list.
6. END-OF-PAGE : This event is triggered every time the list data reaches the footer region of thepage.
7. END-OF-SELECTION: This event is triggered after the START-OF-SELECTION is completed.
This event is used when there is use of logical data base in the report. It is triggered in typeExecutable programs once the logical database completes reading all data i.e. all the selection isfinished and before the list processor is started. This statement tells the server that all the databasereading is completed and no more data reading is going to take place. END-OF-SELECTION isgenerally used for the summary/results of reports. In an executable program without logical database, there is no need to implement the event block END-OF-SELECTION.
After a program is executed by the user, the database is locked when it encounters a START-OF-SELECTION statement and the lock is released when an END-OF-SELECTION statement isencountered (to maintain the consistency). Data selection is done between START-OF-SELECTIONand END-OF-SELECTION. Now if we dont write the END-OF-SELECTION statement, the databasewill remain locked till the programs get terminated. Hence, the performance will be reduced. So it isalways good practice to write END-OF-SELECTION statement after finishing the data selection fromdatabase.
EVENTS IN AN INTERACTIVE REPORT:
In addition of the above, the following events are possible in case of Interactive Reports.
1. Top of page during line selection : top of page event for secondary list.
2. At line-selection : every time user dbl-clicks(F2) on the list data.
7/29/2019 ABAP for Students
84/84
SAP-ABAP
3. At pF : function key from F5 to F12 to perform interactive action on the list.
4. At user-command.
==================================================
If you debug your report program from the ABAP editor screen then it triggers from
1. Initialization,2.At Selection-screen,3.Start-of Selection,4.End-of Selection,5.Top-of-page,6.End-of-page.
But if you debug from the selection-screen then it triggers from
1.At Selection-Screen,2.Start-of-selection,3.Top-of-page,4.End-of-page.
TYPES------------- USER DEFINED DATATYPES ARE DECLARED WITH TYPES STATEMENT
TYPE-POOL-------------- IT IS A PROGRAM WITH A COLLECTION OF TYPES STATEMENTS. CANBE CREATED IN DICTIONARY
TYPE-POOLS-----------IT IS A COLLECTION OF TYPE-POOL s.
I_SAVE = SPACE Layouts cannot be saved.I_SAVE = 'U' Only user-defined layouts can be saved.I_SAVE = 'X' Only global layouts can be saved.I_SAVE = 'A' Both user-defined and global layouts can be saved.