You are on page 1of 111

SAP ABAP Certification Notes - prepared by A.V.

Krishna,SAP Certified Consultant & Trainer

Day1 - IT -> ERP ->SAP ->ABAP

Day2 - Pre-requisites, SAP Project, SAP Architecture, Logon procedure, Logoff procedure,

Instance, Client, User concept.

SAP Screen Navigation

Note : SolMan = Solution Manager

is a tool, which is used for SAP Project implementation

ASAP Roadmap is a part of SolMan

is a SAP proprietary tool, which is recommended by SAP

it consist of admin activities ( transport management , tracking project status )

of testing activities

*******************************************************************************

- SAP Business One :

- is a solution for Small scale company , having 100 employees

- was developed with the integration of Microsoft

- is affordable by small companies, which provides drag and drop features

- deployed at customer site / otherwise Cloud solution also available

- it support sales, purchase, finance operations as integrated solutions

- SAP Business ByDesign :

- is cloud solution, available on demand

- suitable application for 100 to 500 employees

- is provided as SaaS( software as service ) to customer

- it fulfills company specific , country specific, regional specific legal and statutory requirements

- SAP All-in-one :

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- is a solution for SMEs , to provide country specific , industry specific requirements

- it provides best practices also

- consist of SAP ERP + SAP CRM + SAP SRM + BI + 25 industry solutions

- suitable for companies having 500 to 2500 employees

- powered by NetWeaver

- SAP Business Suite :

- Powered by NetWeaver

- also Powered by HANA

- solution for large size companies

- consist of Core Applications , Industry specific applications, Enhancement Packages , and Support
Packages

- (SOA is a foundation for NetWeaver,

Business suite built on NetWeaver)

*************************************************************************************

- Presentation Server :

- is connected to application server

- is used for data input / data output

- is used to access SAP system

- is also called as SAP GUI.exe (or) SAP Front End (or) SAP Logon

- SAP GUI is available as 3 types :

- SAP GUI support Windows

- SAP GUI support Java

- SAP GUI support HTML

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Application Server : is data process area,

is connected to Presentation Server and Database Server

- Database Server : is part of database layer

is used to store large amount of data

database is managed by RDBMS

it stores SAP permanent data

Repository is a special area in the database

Repository is a large size system table available in the database

Repository table name is TADIR

Repository table consist of all Repository Objects information

Repository Object : in SAP Database Table

View

Program

Function Module

Screen

Menus

Global Classes

Forms

- Classification

Built-in Repository Object :

- are developed by SAP developer

- belongs to SAP namespace (SAP objects begins with A....X)

- open in display mode only

- names are in German language, but descriptions are in English

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- objects belongs to SAP defined packages

- status : Active

Custom Repository Object :

- are developed by User (or) Customer

- belongs to Customer namespace (User defined object names begins with Y or Z)

- open in change / display mode also

- names & descriptions both are in english only

- objects belongs to User defined packages

- status : New -> inactive -> active

- Application Server : is a part of Application Layer

is also called as Kernel

it provides BASIS and kernel services

Application Layer consist of Runtime Environment and Development Environment

- Runtime Environment :

- consist of multiple application servers

- message server is connected to all application servers

- message server is used to for internal communication purpose, it communicates from


one application server to another application server

Application Server :

- Every application server consist of one dispatcher

- Dispatcher accepts request from presentation servers and maintain all request under
dispatcher queue

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Dispatcher is interface between presentation server and work process

- Dispatcher assigns task to work process

- Dispatcher works on FIFO based

- Work Process : accepts the request from Dispatcher

work process is assigned two memory areas

- user context area and roll area

All work processes are using common memory area called Shared
memory

User context consist of user master record (or) user profile

work process checks with user context , if the user authorized to perform current
operation , then Roll area allocates memory to work process (Roll-in) , after operation
memory gets rolled out

- Work Process components :

- Task handler : accepts the request from dispatcher and assigns task to respective areas

- Screen Processor : is also called as Screen Interpreter (or) Dynpro Processor

it executes dialog screen behind flow logic editor code

- ABAP Processor : is also called as ABAP Interpreter

it executes ABAP Editor code

- Database Interface : it performs 2 activities

it establish connection to underlying database and perform SQL


operations

it converts open SQL statements to Native SQL

- Dialog work process : executes dialog steps

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

it handles user actions on dialog screen

- Update work process : it updates screen information to database

- Enqueue work process : it handles lock mechanism

- Background work process : it handles background jobs

- Spool work process : it performs printing activity

- Difference between Open and Native SQL :

Open SQL :

- statements subset of standard SQL

- are mostly used in ABAP

- are database independent commands

- are converted into native SQL by database interface

- result is loaded into buffer

Native SQL :

- are powerful commands, written with respect to database

- are rarely used in ABAP

- are database dependent commands

- are not converted by database interface

- result is not loaded into buffer (by pass buffer)

- syntax : native SQL statements must be written between

EXEC <SQL>.

------------------.

------------------.

ENDEXEC.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Screen Processor (or) Dynpro Processor (or) Screen Interpreter :

it executes dialog screen behind flow logic editor code

- ABAP Processor (or) ABAP Interpreter :

executes ABAP Editor code

- Database Interface performs :

- it establish connection to database

- it convert Open SQL statements to Native SQL

- it executes SQL statements

- Buffers : Every application server behind local buffers are available.

buffer data is volatile

buffers stores the database table data temporary

- application layer consist of one gateway server,

all application servers concern dispatchers are connected to gateway server

gateway server mainly used for external communication purpose

- application layer consist of one enqueue server,

it maintains all logical locks temporary

- Application layer consist of Development Environment as ABAP Workbench.

ABAP workbench is a tool used by ABAP consultants

it is closely integrated with many development tools like ABAP Dictionary, ABAP Editor, Screen
Painter, Menu Painter, Class Builder, Function Builder...etc.,

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- 5 types of Work Process :

D - Dialog WP

V - Update WP

E - Enqueue WP

S - Spool WP

B - Background WP

- Login Procedure :

- Start Server

- Logon using Presentation Server ( provide valid client number, username, password )

- open 6 sessions

-Logoff Procedure :

- Save and Close all sessions

- Logout Presentation Server

- Stop Server

- In SAP R/3 (or) SAP ERP system , we can create Instances

- Instance provides some set of services

- can be classified as Central Instance ( installed at application layer,

provides development + runtime environment)

and Database Instance ( installed at database layer,

it stores only large amount of data )

- Instance is a collection of Clients

- Instance is also called as Application Server

- Instance can be represented as 3 letters ( alphanumeric ), unique name

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Ex :

DEV

QAS

PRD

ZME

- Instance can also represented by unique 2 digit number

- valid number range is 00 to 99

- maximum 100 instances are possible for each SAP system

Client :

- Clients are created under Instance

- Client is a collection of Similar authorization users

- Client is represented by 3 digit number

- valid client number range 000 to 999

- maximum 1000 clients are possible for each instance

- built-in client numbers are 000, 001, 066

000 - standard client (or) reserved client

001 - copy of 000 client

066 - SAP Early Watch client (used by BASIS consultants)

these clients are reserved clients

800,801,810,811,812 - IDES clients - used for training purpose

100, 200, 300 - Non-IDES clients - used for real time development purpose

Client is a collection of data as a unit

Client is a top level organization unit in the functional configuration hierarchy

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- User : are created under client

every user is identified by unique profile

user profile also called as user master record

user profile consist of roles, authorization, profiles...etc.,

*- SAP Screen Navigation :

SAP Easy Access is the initial screen of SAP

- SAP Screen Header :

menu bar

standard tool bar

title bar

application tool bar

SAP Screen Body : main screen

status bar

System menu and Help menu are default menus for every screen

System menu -> Status : provides

- logon data - presentation server details

- SAP data ( Repository data + System data ) - application server details

- data base data + host data - database layer details

- Short cuts used while working with SAP Screens :

F1 - System help

F2 - detail display

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

F3 - back( previous screen )

F4 - search help

F5 - create mode

F6 - change mode

F7 - display mode

F8 - test / direct processing

F9 - technical information

F10 - select first menu item

F11 - save ( Ctrl + S )

F12 - cancel

Ctrl + F1 : switch between display and change mode

Ctrl + F2 : syntax check

Ctrl + F3 : activate

Ctrl + F8 : execute

Shift + F3 : exit (log off)

- Command Field : is available in standard tool bar

is a combo box(user choose a tcode from list, and enter new tcode)

is also called as ok field

is used to enter transaction code

- Transaction code : is also called as Tcode

is a command , which is used to call business operation concern initial


screen

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

is a short cut, used to access particular transaction screen

can be alphanumeric

ABAP Tcodes :

SE01 - Transport Organizer ( Extended view )

SE09 - Transport Organizer - used by ABAP consultant

SE10 - Transport Organizer - used by Functional consultant

SE11 - ABAP Dictionary

SE14 - Database Utility

SE16 - Data Browser

SE16n - New Data Browser

SE18 - BAdI builder - to define BAdI

SE19 - BAdI builder - to implement BAdI

SE21 - Package Builder

SE24 - Class Builder

SE37 - Function Builder

SE38 - ABAP Editor

SE41 - Menu Painter

SE51 - Screen painter

SE71 - Script Form

SE80 - Object Navigator (or) ABAP Workbench

SE81 - Application Hierarchy

SE84 - Repository Information System

SE91 - Message Class

SE93 - Custom tcode creation

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

BASIS Tcodes :

SU01 - User creation

SM04 - Users List

SM01 - Tcode List

SM36 - to schedule Background Job

SM37 - to monitor Background Job

SCC4 - clients list

SM50 – Work process overview

SM51 - System Overview

Command Field Navigation :

<tcode> - to call particular tcode directly from Easy Access

/n<tcode> - open a new tcode with in the same session

/o<tcode> - open a new tcode as parallel session

/i - delete current session

/h - switch to debug mode

/n - switch to Easy Access from any screen

/o - overview of opened sessions

/nex - logoff without dialog prompt(with out save)

/nend - logoff with dialog prompt

Ctrl + / : move cursor to Command field

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Functional Tcodes :

SD tcodes :

XD01 - create customer

XD02 - change customer

XD03 - display customer

VA01 - create sales order

VA02 - change sales order

VA03 - display sales order

MM tcodes :

MM01 - create material

XK01 - create vendor

ME21 - create purchase order

ME21n - create purchase order ( new screen ) - Enjoy tcode

- SAP Menu : consist of Tools like

- ABAP Workbench is a tool used by ABAP Consultants

- Customizing tool used by Functional Consultants

- Administration tool used by Basis Consultants

- All Tcodes are stored in TSTC database table

- SDMO tcode, is used to search for any tcode, based on text

- Search_sap_menu , tcode provides path in sap menu, for entered text

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Search_user_menu, tcode provides path in user menu, for entered text

*******************************************************************************

Versions : is a term applicable to business functionality

SAP R/3 -> EE -> ECC

product -> SAP R/3 -> SAP R/3 -> SAP ERP (product name)

versions->3.0 to 4.6c -> 4.7EE -> ECC 5.0 -> ECC 6.0

(1992-2002) -> (2003-04) -> 2005 2006 to till date

(EhP1.........7)

Release : is a term applicable to basis functionality

SAP BASIS -> SAP WAS -> SAP NWAS

3.0 to 4.6c 6.10 6.40

6.20 7.00

6.30 7.01......7.40

(Latest Product : SAP ERP

Latest Version : ECC

Latest Enhancement : EhP7

Latest Release : SAP NW7.40)

*************************************************************************************
*****

Dialog Work process : it executes dialog steps

it handles the user actions on screen

Update Work Process : it performs update to database

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Lock Management :

- Lock object is required to restrict simultaneous access of table record by several users at a time.

- SAP supports row level (or) record level lock

- Way to work with locks :

- first lock table entry

- perform operation on table record( modify / update / delete )

- finally unlock table entry ( release lock )

- steps to work with lock object :

- step1 : define lock object in ABAP Dictionary

user defined lock object name should begins with EZ (or) EY

specify primary table name

specify lock mode

save, check, activate

lock argument is defined on key fields table

upon activation of lock object, system generates 2 function modules

ENQUEUE_<lock object> : is used to perform lock

DEQUEUE_<lock object> : is used to perform unlock

- step2 : create ABAP executable program

call enqueue function module

pass values

test program

- step3 : perform operation on table entry

- step4 : SM12 - tcode is used to view all logical locks

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- step5 : create abap executable program

call dequeue function module

pass values

test program

Note : physical lock happens on underlying table record

logical lock happen by enqueue work process at application layer

lock server (or) Enqueue sever holds all logical lock entries

Lock mode : specifies type of lock

Type 'E' - Exclusive Lock

the user who sets the lock, he can perform all operations

others users lock request is rejected

it is cumulative ( multiple times allowed )

Type 'S' - Shared Lock

All users can only read the locked data

modification is not allowed by any user

Type 'X' - Extensive Lock

is also exclusive lock

it is not cumulative ( it is allowed only for one time )

***********************************************************************

Unit 8 : ABAP Workbench

- Repository is Client Independent (or) Cross-client

- Application data and Customizing data is client specific (or) client dependent

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Working with Repository Objects :

- Work with built-in objects : predefined, SAP defined objects

- Create custom objects with customer namespace

- Repository is a collection of Applications

Application is a collection of Components

Components is a collection of Package

Package is a collection of Repository objects

- SAP -> Repository -> Applications -> Components -> Package -> Repository Object

Ex :

SAP -> Repository -> SD -> SLS -> VA ->VBAK table

SAP -> Repository -> MM -> PUR -> ME ->EKKO table

- Search criteria for repository objects :

- execute tcode SE11

- search for custom tables : z* press F4 - system displays all the table names begins with z

- searching for any object using Repository Information System :

RIS - tcode - SE84

it provides application independent search

it provides search criteria based on object name (or) short description (or)
package (or) application component

- SAP is a collection of Applications (or) functional modules (or) functional areas

Application is a collection of Components

Component is a collection of Package

Package is a collection of similar functionality of objects

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- searching using Application Hierarchy

tcode : SE81

it provides application dependent search

- SE80 tcode for Object Navigator (or) ABAP Development Workbench

it is useful to freely navigate between repository objects

it is integrated with - Repository browser,

Repository Information System,

Tag Browser,

MIME Repository,

Transport Organizer

it is used to develop BSP and WebDynpro applications

it is mainly used by ABAP consultant, to develop / change / display objects

All activities can be done using right click ( context menu )

- SE81,SE80,SE84 - are overview tools , integrated with ABAP Workbench

***************************************************************

- Custom Package creation :

- Package can be created directly using SE21 tcode (or) SE80 tcode also

- specify package name begins with Y or Z

- click on create

- specify short description

- specify software component (HOME)

- specify transport layer(transport root)

- package type(development)

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- continue

- click on create request

- specify short description

- save

- notice that system generated a new workbench request number

- continue

- While creating objects, we can save object in custom package

then system automatically proposes transportable workbench request number

- Request number is a recording mechanism of Development Activity

it consist of object name, short description, owner, source client, target client, project, date,
status.

Request number is represent as below

<INSTANCE>k<9xxxxx>.

EX :

ZMEK900021

ZME - instance

k - is constant

request number always begins with 9, maximum 6 digit number

Request is a collection of Task

- system automatically assigns next immediate number as Task number

- Transport Organizer : SE09

It is used to organizes all transport

ABAP consultant is responsible to develop + test + release object

Released objects transported by BASIS consultants using TMS

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- As a rule, all task must be released first, before releasing request

- Project lead creates and releases Request number

- Project member creates and releases Task

- CR : create request / change request

TR : transport request

*************************************************************************************
*****************

ABAP Programming :

ABAP Features :

- Advanced Business Application Programming

- it is 4th generation language

- it is having similarities of COBOL

- it is SAP proprietary programming language

- it is development environment(IDE) of SAP

- using 40% of Assembly language and 60% C,C++ initially ABAP was developed

- it is used to develop SAP in-house applications

- it is High level language

- it is Application programming language

- it is Procedure oriented language

- it is Event driven programming language

- it is Object oriented programming language

- ABAP -> ABAP/4 -> ABAP Objects

- it is not case sensitive

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

WRITE

write

Write

- is typed language

- is interpreter based language

- is upward compatible ( lower version syntax allowed in higher version )

- ABAP Editor Standards :

- ABAP Editor is used to write ABAP program source code

- ABAP programs are executed by ABAP processor (or) ABAP interpreter

- ABAP Editor tcode : SE38

- ABAP Editor is a development tool , which is closely integrated with ABAP Workbench

- ABAP Editor is used to display built-in program and

to create and change custom programs

- ABAP program is also Repository Object

- SAP defined program names begins with A.....X

- User defined program name begins with Y / Z

- Steps to create program :

- execute tcode SE38

- specify program name begins with Y or Z

- click on create

- specify meaningful title

- specify program type as (1 - Executable program)

- save as local object

- enter the program source code

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- save, check, activate

- test / F8

- Note : every program have unique name

every program must belongs to any one of the below program type

Type 1 - Executable program

Type M - Module pool program

Type I - Include program

Type S - Subroutine pool

Type F - Function Group

Type T - Type pool

Type K - Class Pool

Type J - Interface Pool

Type X - XSLT program

Type Q - Database procedure Proxy

Type 1 program is self executable, other programs are not self executable

XSLT : program is used to convert ABAP program to XML and vice versa

- Package : is also called as Development Class(old versions 4.6c)

is a collection of similar functionality objects

Package is also Repository Object

SAP defined package name begins with A...X

User defined package name begins with Y / Z

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

SAP defined objects belongs to SAP package

User defined objects belongs to User defined package (or) $tmp

$tmp is default , built-in package, which stores all local objects

local objects can't transported to other systems

Custom package objects can be transportable

Packages can be created by BASIS consultants,

using Package Builder (SE21 tcode) or

Object Navigator (SE80 tcode)

- while saving program, it writes Repository table(TADIR) as Repository object

while checking program, program code is verified by ABAP interpreter

while activation : program runtime object gets generated

status changed to Active

program is ready to display output

program can be used in other programs

for every change, we have to activate explicitly

*- Basic Rules of ABAP programming :

- First statement must be Report statement

- Every statement begins with keyword ends with period

- Statement can be written in single line (or) several lines

- write is used as output statement

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- string must be placed with in single quotes

- ABAP supports 7 color ids

- we can apply 7 background colors of text

- NEW-LINE. statement provides output in new line

- / provides output in new line

- /<col_pos> provides output at specified column position in new line

- ULINE statement provides underline in the output

- ULINE /<col_pos>(offset length).

provides under line for the specified length

- SKIP provides one blank line in the output

- SKIP <n> provides <n> blank lines in the output

- SKIP TO LINE <line number>.

this statement skips the specified line numbers

- WRITE AT /<col_pos>. this statement displays the output at specified column position

- Every operator and operand must contain before and after space

c = a + b.

- Increment notation

i = i + 1.

add 1 to i.

- Decrement notation

i = i - 1.

subtract 1 from i.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- pre-increment is not support by ABAP

- Comments : are used for documentation

improves the program readability

comment lines ignored by interpreter

- Single line comment : place * symbol at first column position, then entire line treated as
comment line

- Multiple lines comment : select multiple lines

press Ctrl + < for comment (or) Ctrl + , for comment

press Ctrl + > for uncomment (or) Ctrl + . for uncomment

- In line comment : partial comment

place double quotes in a line

rest of the statement after double quotes is act like comment

* must be at first column position

" can be at any column position

- Operators List :

Every operator identified by unique symbol

Every operator have unique purpose

Arithmetic Operators : are used for Arithmetic (or) Mathematical operations

+ addition operator

- subtraction operator

* multiplication operator

/ general division operator

DIV integer division (quotient is rounded to nearest integer)

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

MOD modulus (remainder based calculation)

** power (or) exponentiation

Logical Operators : used to combine multiple condition statements

AND - both condition matching

OR - any condition matching

NOT - is used for negative matching

Relational Operators : are used for Comparison purpose

= EQ

<> >< NE

> GT

>= GE

< LT

<= LE

LIKE

IS INITIAL

BETWEEN <field1> AND <field2>.

*- Separators : are used to separate two things, do not require space before and after

- hyphen

~ tilde

-> single arrow

=> double arrow

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

/ slash

*- Keywords : are reserved words

every keyword have unique purpose

DATA : keyword is used to declare data objects ( variable, structure, internal table )

TYPES : keyword is used to declare local data types ( elementary, complex data types )

CONSTANTS : keyword is used to declare constant variable

PARAMETERS : keyword is used to accept single value from user

SELECT-OPTIONS : keyword is used to accept range of values from user

SELECT : keyword is used to retrieve data from database

WRITE : keyword is used to display program output

*- Typical Structure of ABAP program :

Declarations

Operations

Output

*- DATA TYPES : describes data object

do not occupy memory

- can be classified as

- Dictionary Data types (or) Integrated types

- Predefined data types

- local data types

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- ABAP Dictionary data types : have global scope

are valid for all programs, all function modules, all global
classes ..and so on.

- Predefined data types : only used in editor ( programs )

ABAP interpreter determines automatically

valid for all programs

- Mapping between predefine and dictionary types

dictionary type predefined type

Char <- c

Numc <- n

Dats <- d

Tims <- t

Int4 <- i

Fltp <- f

Dec <- p

- local data types : are defined based on required

are not predefined

scope is local (valid for that program only)

*- classification of predefined data types :

- Elementary data types

- fixed length

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- character data types

c character

n numeric character

d date

t time

- numeric data types

i integer

f float

p packed decimal

- hexadecimal data type - X

- variable length

- string ( character sequence )

- Xstring ( byte sequence )

- Complex data types

- structure types

- table types

- Reference data types

- data references

- object reference

- classes

- interfaces

Data Object : is a instance of data type, which occupy memory

- Literals : are unnamed data objects

can be classified as

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Character Literals :

- must be place with in single quotes

- it may have alphanumeric characters

- Ex : 'Ravi'

'WB24 1234'

'SAP R/3'

- Numeric Literals :

- sequence of numbers

- single quotes is optional

- Ex : 123

-456

'789'

- Strings : are sequence of characters

must be places with in single quotes

Write 'Welcome to ABAP/4'.

- Variables : are place holders , which are declared by DATA keyword

are created at program runtime in the memory(RAM)

holds the value dynamically

- Constants : are constant variables , having fixed value in entire program

- Interface Work Areas : Tables and Nodes

- System Fields : also called as System Variables

are SYST structure components

are predefined data objects

can be used in programs, along with write statements

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

SY-DATUM : display current application server date

SY-UZEIT : display current application server time

- Text Symbols : are part of Text pool

are part of Text elements

are used to avoid hard coded text

are used for to display reusable text

supports to write language independent programs

are program dependent

DATA <data object> TYPE <data type>.

*-Syntax to declare variable with out specifying length

DATA <variable> TYPE <data type>.

Ex :

DATA n1 TYPE i.

*- Syntax to declare variable by specifying length

DATA <variable>(length) TYPE <data type>.

DATA <variable> TYPE <data type> LENGTH <length>. "alternative syntax

Ex :

DATA name(5) type c.

DATA name type c length 5.

- data type describes - initial value for data object

initial length in memory for data object

expected values for data object

- Chain statement : is written using colon

: is chain operator

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

it concatenates many statements with comma and finally ends with period

- Static values can be assigned to variables in several ways :

- using VALUE keyword

is used to declared and assign value immediately

DATA <variable> TYPE <data type> VALUE '<val>'.

- using = operator

<field> = '<value>'.

- using MOVE keyword

MOVE '<value>' TO <field>.

= Move are used to assign after declaration

- Assigning common value to several variables in single statement also possible

n1 = n2 = n3 = 10.

- Declaring several variables in single statement

data : n1,n2,n3 type i.

- default data type in ABAP is type C

- n1 and n2 belongs to data type c

- n3 belongs to data type i

- Parameters statement generates selection screen, to accept single value from user,

also creates data object in the memory.

- Initial value for character data type is space (or) blank

and other data type is zero

- CLEAR statement resets assigned value back to initial value

syntax :

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

CLEAR <data object>.

- IS INITIAL is used as a logical query , to check data object status

IS NOT INITIAL

- TYPE followed by data type

LIKE followed by data object

LIKE is used to create new data object , with ref to existing data object

As a result, technical properties(data type, length) of existing data object, copied to current data
object

but Value will not be copied

- Constant variables are declared by CONSTANTS keyword

- have fixed value throughout program

- must be assigned with value using VALUE keyword

- we can't assign value using = (or) MOVE keyword

- its value can't be changed later

- CLEAR statement is not allowed on constant variables

- Working with local data types is 2 step procedure

- step1 : declare local data type using TYPES keyword

syntax

TYPES <t> TYPE <predefined type>.

TYPES <t>(length) TYPE <predefined type>.

TYPES <t> TYPE <predefined type> LENGTH <length>.

Ex :

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

TYPES t_hello type c.

TYPES t_hello(5) type c.

TYPES t_hello type c length 5.

- step2 : declare data object using local data type

DATA <variable> TYPE <local data type>.

Ex :

DATA name type t_hello.

- TYPES keyword creates data type

DATA keyword creates data object

- Note : if the variable is declared by making use of predefined type, length specification is allowed

if the variable is declared by making use of local data type, then length specification is not allowed

- Exploring elementary data types :

Integer : it is converted to INT4 dictionary data type

accepts only whole numbers with leading sign (+ / -)

doesn't print decimal value

it rounds to nearest integer

length specification not allowed

it occupies 10 places internally with sign

Note :

Internal memory allocation depends on operating system and processor

SAP follows Unicode character set

Unicode point of view, one character occupies either 2 bytes (or) 4 bytes

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Float : supports decimal value

values are displayed in special scientific format (<mantissa>E<exponentiation>)

doesn't support to perform arithmetic operations

it occupies 8 bytes ( internal maximum length16 places )

Accurate values can't be displayed

Float values can't be accepted from user (doesn't supported by PARAMETERS )

length specification is not allowed

Packed : supports decimal values

supports DECIMALS keyword also

is recommended for Arithmetic operation

length specification is allowed

we can accept packed values from the user

it occupies 8 bytes

exact values are displayed thru packed data type

Character : is default data type

default length is 1 place(left justified)

length specification is allowed

it accepts alphanumeric values

Numeric Character : is special data type, which is used to display zip code (or) postal codes

length specification is allowed

default length is 1 place (right justified)

accepting only numbers

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

it converts characters into numbers

Date : is fixed length data type

maximum length 8 places

length specification is not allowed

SAP standard date format YYYYMMDD

program format YYYYMMDD = output format DDMMYYYY

Time : is fixed length data type

maximum length 6 places

length specification is not allowed

SAP standard time format is HHMMSS

X - Hexadecimal : (0123456789abcdef)

are used in SAP graphics

*- variable length elementary data types

String : is variable length data type

length specification is not allowed

dynamically system allocates length

Xstring : is used in bitwise operations

String Operations :

- Shift : shifting character of string

- Translate : translating string to upper case / lower case

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Streln( ) : function to calculate length of a string

- Condense : removing redundant gap with in the string

- Concatenate : joining two strings into target string

- Split : splitting large string into small sub strings

- Replace : replacing existing string with new string

- Find (or) Search : finding a character in string

- String Comparison Operators :

CO - contains only

CN - contains not only

CA - contains any

NA - not contain any

- this comparison is case sensitive

CS - contain string

NS - not contain string

CP - contain pattern

NP - not contain pattern

- this comparison is not case sensitive

*---Condition based programming : using IF and CASE

using branching statements (or) constructs

- Simple IF : is used to execute if condition is true

is used to test single condition

syntax : IF <condition>.

---<st block>---.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

ELSE.

---<st block>---.

ENDIF.

- Nested IF : is used to check with multiple conditions

syntax : IF <condition1>.

---<st block1>--.

ELSEIF <condition2>.

---<st block2>--.

ELSEIF <condition3>.

---<st block3>--.

ELSE.

---<statement>--.

ENDIF.

*- CASE : is alternative for Nested IF statement,

easy to compare values

comparison is case sensitive

syntax :

CASE <field>.

WHEN 'val1'.

----<statment1>---.

WHEN 'val2'.

----<statement2>---.

WHEN 'val3'.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

----<statement3>---.

---------------------------.

---------------------------.

WHEN others.

---<statement>---.

ENDCASE.

*---Loops : also called as Iterative (or) Repetitive statements

4 types of loops available in ABAP

- Do loop : unconditional loop ( exit checking )

- While loop : conditional loop ( entry checking )

- Select...Endselect : is a loop used to fetch data from database table

- Loop...Endloop : is a loop used to read data from internal table

- Do Loop :

syntax :

DO <n> TIMES.

-----<statement block>---.

ENDDO.

this loop repeats for <n> times

sy-index is a system field, which displays index of current loop pass

sy-index default value is zero, when it comes first iteration sy-index value increments 1, in further
subsequent iterations sy-index value automatically incremented

- Terminating Loops :

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- in general <n> times is used to terminate loop

- <n> times is not specified, it leads to infinite loop

- Loop can be terminated explicitly - conditionally using CHECK statement

- unconditionally using CONTINUE and EXIT statement

CONTINUE is used to skip one particular loop pass

- While LOOP :

syntax :

WHILE <condition>.

-----<statement block>---.

ENDWHILE.

- SA38 - tcode is used by end users (or) functional consultants, only to view output of any ABAP
program

- SE38 - tcode to create / change / display program, which is used by ABAP consultant

- ABAP Editor :

- ECC version onwards Front-End new editor is introduced

- Pretty printer is used to standardized the code, and indentation

- Pattern provides all insert statements

- ABAPHELP tcode provides keyword documentation (or)

type any keyword in editor , press F1

- ABAPDOCU tcode provides ABAP demo examples for learners

- SE39 tcode for Split screen editor

- Version Management :

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

while activation of the object , system generates one active version at development database

path : Utilities menu -> versions -> version management

we can generate several versions for each modification and keep it into native version database

path : Utilities menu -> versions -> generate version

we can compare both versions at any time

we can retrieve old version back

- Attributes screen -> Fixed point Arithmetic : is activated by system default for all programs.

so that packed decimal values displayed with appropriate decimals

*************************************************************************************
- variables can be declared using predefined type (or) local type

- variables can also be declared using global dictionary types(data element,

structure component

table field)

- syntax :

DATA <var> TYPE <DB Table>-<field>.

<var> is created by making use of dictionary table field

<var> get the technical properties( datatype,length ) from dictionary field

- we can fill the target variable by using select statement

SELECT statement read the data from database table and fills in target variable

SELECT single statement is used to read single field value from database table

whenever select single is used , it is good practice to specify where condition

so that system reads condition matching field value

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

SY-SUBRC is a system field, and SYST structure component

- is used to know any ABAP operation result

- after execution of ABAP statement , system automatically fills the sy-subrc value

- if the operation result is success then sy-subrc value becomes zero,

otherwise non zero.

- if SELECT statement executed successfully, then sy-subrc becomes zero, otherwise 4

- provides return value of ABAP statement

SELECT SINGLE statement also used to read several field values from database table record

target fields must be specified with in bracket as field list , separated by comma

*************************************************************************************
************

Variables have limitation : variable holds single value at a time

variables are created at different memory address(random)

variables doesn't support to display record

Working with Complex Data types :

Structures : is a collection of fields belong to different data types,

is also called as Field String

is nothing but arranging several variables in a structured order

Syntax :

DATA : BEGIN OF <structure>,

<field1> TYPE <data type>,

<field2> TYPE <data type>,

----------------------------------,

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

----------------------------------,

END OF <structure>.

DATA keyword creates data object with the name <structure> in memory

structure fields can be created with data type ( predefined type / local type / global types )

BEGIN OF keyword begins the structure

END OF keyword ends the structure

Addressing structure field :

<structure>-<field>.

we can assign value to structure field

- using VALUE keyword (declare + assign)

- using = operator

- using MOVE keyword

Structure have limitation : it can only display one record at a time.

New structure creation with ref to existing structure

DATA <new structure> LIKE <existing structure>.

MOVE keyword is used to move source structure field value to target structure

MOVE-CORRESPONDING statement is used to move source structure to target structure for


identical field names

- IS INITIAL is used to check status of structure

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

IS NOT INITIAL

- clear statement is used to reset structure field values back to initial values

- Note : declare structure fields as per database table field order

specify select statement as per database table field order(sequence)

if target fields order and select statement fields order differs from database table fields
order, then we have to SELECT ...into corresponding fields addition

Corresponding fields : only read and move the values for identical field names

which is not recommended by SAP (system needs to compare for every field name, leads to load on
the system)

*- declaring structure with required database table fields

DATA : begin of <structure>,

<field1> TYPE <DB Table>-<field1>,

<field2> TYPE <DB Table>-<field2>,

---------------------------------------------,

end of <structure>.

*- declaring structure with complete database table

DATA <structure> TYPE <DB Table>.

SELECT SINGLE * is used to read single record from database table

to hold single record target must be declared as work area

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

*- Working with Structure types :

- structure type is a complex data type

- structure type doesn't occupy memory

- structure type is used while creation complex data objects ( structure and internal tables )

- structure type can be created as 2 ways :

- local structure type : declared and used with in the program

scope is local

- global structure type : is defined in ABAP Dictionary, valid for all programs

scope is global

- syntax to declare local structure type :

TYPES : BEGIN OF <st_type>,

<component1> TYPE <data type>,

<component2> TYPE <data type>,

-------------------------------------------,

END OF <st_type>.

*- Internal Tables :

- are intermediate tables ,which will be created at application layer

- are temporary tables, which are created on RAM

- are data objects , declared by DATA keyword

- are complex data objects, extinction to structure

- are dynamic objects, which are created at program runtime

- holds the data at run time,

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- it maintains data as line by line (or) row by row

- working with internal table is 3 step procedure :

- declare internal table

- populate internal table

- display internal table (or) perform operations on internal table

- SAP doesn't recommend direct interaction on database tables for number of times.

that is why SAP recommends that create internal table on database table

fetch database table data and populate into internal table

we can perform below operations on internal tables :

- to fill internal table

-1 select statement is used to fill internal table with database table data

-2 append statement is used to fill internal table with our own record at the bottom

-3 insert statement is used to fill internal table with our own record at specified index
position

- to read records from internal table

-4 read

-5 loop...endloop

- other operations

-6 sort

-7 modify

-8 collect

-9 delete

- deleting data

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

-10 clear

-11 refersh

-12 free

- Usage of Internal tables :

- are used to perform SQL operations(SELECT / INSERT / UPDATE / DELETE) on database tables

- internal table data can be displayed on dialog screen

- internal table data can be displayed on report (or) forms

- internal table data can be downloaded into files / uploaded from files

- internal table have special feature as dynamic expansion

- by default it is created with 8kb memory, if 8kb is filled then system allocates 12kb
memory, and so on... up to 2GB

- Internal Tables can be declared as 3 ways as per requirement

- with required database table fields

- with database table

- with two database table fields

- Syntax based Internal Tables can be classified as 2 types :

- Internal Table with header line

- is old syntax

- it consist of 2 components

- header line : is implicit work area, which holds only one record at a time

in general it holds last operation record

is used to perform read / write operations on body

- body : is a storage area, which is extension to header line

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

can hold many records at a time as line by line (or) row by row

- Limitations :

- header line is created automatically by the system

- header and body name is same

if internal table name is itab, header can be address using name itab, but in order to
address body we have to use body operator itab[ ]

- header and body structure is same and memory address also same

- this syntax not support nested internal tables

- this syntax not supported by OOABAP programming

- Internal Table without header line

- is new syntax

- it consist of 2 components

- explicit work area : is created explicitly, which holds only one record at a time

in general it holds last operation record

is used to perform read / write operations on internal table

- internal table : is a storage area

can hold many records at a time as line by line (or) row by row

Advantages :

- work area can be created based on requirement ( not mandatory in all cases )

- work area and internal table names are different

internal table and work area can be addressed directly by its name

- work area and internal table structure is same and memory is different

- this syntax support nested internal tables

- this syntax supported by OOABAP programming

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Attributes of Internal Tables :

- Table Type : specifies classification of Internal tables

- Index

- Standard Index

- Sorted Index

- Hashed

- Line Type : specifies structure of internal table each line

in genral Internal table rows are created by making use structure type

- Key Type : specifies whether internal table uses key (or) non-key of database tables

can be Unique key (or) Non-Unique key

if the Internal table uses key field of Database table , then it is called as Unique
key, As a result internal table is populated delayed and can't contain duplicate records

if the Internal table uses non-key field of Database table, then it is called as Non-
unique key, As a result internal table is populated quickly, and can contain duplicate records

Standard Index Internal table :

- it maintains records with linear index

- are default internal tables and mostly used in ABAP

- it always uses Non key field of database table

- system uses linear (or) sequential search to find a record

- response time depends on number of entries of internal table

- no limitations

- Index based operations possible

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Sorted Index Internal table :

- it maintains records with sorted linear index

- are rarely used and recommended If the internal table to be created in a sorted order by
default

- it uses either key (or) non-key field of database table

- system uses binary search to find a record

- response time depends on number of entries of internal table

- limitation : sort command is not allowed

- Index (or) key based operations possible

Hashed Internal table :

- it does not contain index , only hashed key ( is a combination of several lines )

- are rarely used and recommended to store large amount of data in internal table

- it always uses Key field of database table

- system uses hash procedure (or) hash algorithm to find a record

- response time is constant regardless of number of entries of internal table

- limitation : index based operation not possible

- only key based operations possible

*- Working with internal tables :

- declaring internal table with required fields of database table :

step1 : declare structure type ( as line type )

step2 : declare internal table using above line type

step3 : declare work area using above line type

TYPES : begin of ty_kna1,

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

kunnr type kna1-kunnr,

land1 type kna1-land1,

name1 type kna1-name1,

end of ty_kna1.

DATA : it_kna1 type table of ty_kna1,

wa_kna1 type ty_kna1.

- Internal table is created by making use above line type

- components of structure type, becomes columns of internal table and work area

- TABLE OF keyword creates internal table

- with out table of keyword it creates work area with one row

- Note : declare internal table fields as per database table fields order(sequence)

specify select statement fields order as per database table fields sequence ,

to avoid usage of INTO CORRESPONDING FIELDS addition

*- SELECT statement is used to fetch (or) retrieve (or) read data from database table and populate
into internal table

*- LOOP...Endloop : is used to read several records from internal table

for each iteration it reads single record into work area

loop statement always start reading from internal table first record to till
last record

syntax : LOOP AT <itab> INTO <wa>.

-----<display wa content>----.

ENDLOOP. this loop reads all the records of internal table

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

finally it terminates

syntax : LOOP AT <itab> INTO <wa> FROM <indx> TO <indx>.

this syntax only reads index matching records from internal table

syntax : LOOP AT <itab> INTO <wa> WHERE <condition>.

this syntax only reads condition matching records from internal table

*- READ : statement is used to read single record from internal table

statement result is always single record

it is good practice to check SY-SUBRC for READ statement

Syntax of READ using index :

READ TABLE <itab> INTO <wa> INDEX <indxno>.

this syntax only reads index matching record

Syntax of READ statement with key :

READ TABLE <itab> INTO <wa> WITH KEY <field> = 'value'.

this syntax reads the first condition matching record

Whenever WITH key is used , it is recommended to use Binary Search addition for quick search.

Sort internal table before using binary search addition

Syntax of READ statement with table key :

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

READ TABLE <itab> INTO <wa> WITH TABLE KEY <k1> = 'val'... <kn> = 'val'.

this syntax only useful to read only key fields matching record

*- Append : statement is used to add additional records at the bottom of internal table

operation can be done thru work area to internal table

first new entry must be filled in work area, then perform append operation

syntax :

APPEND <wa> TO <itab>.

*- Insert : statement is used to insert new record at specified index position of internal table

this operation can be performed thru work area only

new entry must be filled into work area first, later use insert statement

syntax :

INSERT <wa> INTO <itab> INDEX <indx>. "with index addition

INSERT <wa> INTO TABLE <itab>. "without index addition

*- SORT : statement is used to sort internal table entries

operation can be performed directly on internal table

default sort mode is ascending

explicitly we can sort in descending , by specifying descending keyword

syntax :

SORT <itab>.

SORT <itab> [BY <field>].

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

SORT <itab> BY <field> [<mode>].

SORT <itab> BY <field1> <field2>.

*- MODIFY : statement is used to modify records at internal table level

operation also can be performed thru work area

- first read record from internal table

- change the value at work area level

- finally use modify statement

Syntax of Modify statement without index :

MODIFY <itab> FROM <wa>.

Syntax of Modify statement with Index :

MODIFY <itab> FROM <wa> INDEX <indx>.

Syntax of Modify statement using TRANSPORTING addition

MODIFY <itab> FROM <wa> TRANSPORTING <field1> <field2> WHERE <condition>.

this statement modifies all condition matching records with new values

*- COLLECT : statement is to summarize duplicate recods

this operation also performed thru work area

Syntax :

COLLECT <wa> INTO <itab>.

this statement compares work area record with existing internal table records, if it
finds any duplicate records ( character data type must match), then it performs sum of data i,f,p
values

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

it is useful while accumulating records and deletes duplicate records

*- DELETE : statement is used to delete internal table entries

this operation can be performed directly on internal table

syntax :

DELETE <itab> INDEX <indx>.

DELETE <itab> FROM <indx> TO <indx>.

DELETE <itab> WHERE <condition>.

syntax to delete duplicate records :

SORT <itab> BY <field>.

DELETE ADJACENT DUPLICATES FROM <itab>.

*- CLEAR : statement is used to reset values to initial values

statement can be used on work area (or) Internal Table

syntax :

CLEAR <wa>.

CLEAR <itab>.

Note : it is always good practice to clear work area explicitly

*- REFRESH : statement is used to remove internal table entries

but it doesn't remove memory ( retain internal table memory )

syntax :

REFRESH <itab>.

*- FREE : statement is used to remove internal table entries and allocated memory also

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

syntax :

FREE <itab>.

Note : REFRESH and FREE statements can only used on internal tables

*- IS INTIAL (or) IS NOT initial is used as logical query to check internal table status (whether
it contain entries or not )

*- DESCRIBE TABLE statement is used to find out attributes of internal table

syntax :

DESCRIBE TABLE <itab> LINES <line>

OCCURS <memory>

KIND <type>.

Lines parameter specify total number of lines

Occurs parameter specify initial allocated memory

KIND parameter specifies the type of internal table

T - standard index internal table

S - sorted index internal table

H - hashed internal table

*- working with two internal tables

- creating new internal table with ref to existing internal table

DATA : <new itab> LIKE <existing itab>.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- moving entries from source internal table to target internal table

MOVE <source itab> TO <target itab>.

<target itab> = <source itab>.

*- appending many records from source internal table to target internal table

APPEND LINES OF <itab1> FROM <indx> TO <indx> TO <itab2>.

*- inserting several records from source internal table into target internal table

INSERT LINES OF <itab1> FROM <indx > TO <indx INTO <itab2> INDEX <indx>.

*- Syntax to declare internal table with database table

DATA : <itab> TYPE TABLE OF <DB table>,

<wa> TYPE <DB table>.

*- sy-dbcnt is a system field, which provides number of records effected after open SQL
operation(INSERT / UPDATE / DELETE / SELECT)

Internal Table Types : is a data type , which do not occupy memory

can be created as local (or) global

local internal table types are declared with TYPES keyword with in the
program, scope is local, valid for same program

global internal table types are created in ABAP Dictionary , scope is global
, valid for all programs

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

internal tables types are used while creating complex data object internal
table in the program

- Syntax to declare local internal table type

TYPES:<t> TYPE <table type> TABLE OF <line type> WITH <key type> <f> INITIAL
SIZE<m>.

Ex :

Types t_kna1 type Standard table of kna1 with non-unique key land1 initial size 0.

Types t_kna1 type Sorted table of kna1 with non-unique key land1 initial size 0.

Types t_kna1 type Sorted table of kna1 with unique key kunnr initial size 0.

Types t_kna1 type Hashed table of kna1 with unique key kunnr initial size 0.

*- with header line syntax :

DATA : BEGIN OF itab occurs 0,

kunnr like kna1-kunnr,

land1 like kna1-land1,

name1 like kna1-name1,

END OF itab.

DATA keyword creates data object internal table ITAB

BEGIN OF ..END of creates header line

occurs creates body with the same structure

0 allocates initial memory 8 kb

*- DATA : Itab type table of kna1 occurs 0 with header line.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

itab is created by making use of entire KNA1 structure

occurs keyword creates body

0 allocates memory

WITH HEADER LINE creates header line

*************************************************************************************
*************************

Modularization Techniques :

- Modularity is a programming technique, where large size program is divided into small modules (or)
blocks and dealing with individual modules

- Advantages :

- reusability of source code

- avoiding code redundancy

- improves program transparency

- increases program readability

- can be divided into

- Source code modules ( mainly code reusability )

- macros

- includes

- Procedures (called by passing values)

- subroutines

- function modules

- methods ( object oriented procedure )

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Includes :

Include program belongs to program type 'i'

Include program is a global Repository Object

User defined Include program name should begins with Y or Z

Include program consist of set of statements

Include program is not self executable

Include program can be use in other include (or) executable program

One Include program can be used in several programs ( reusability )

Syntax to use include :

INCLUDE <include prog>.

Parameter passing between include program and executable program is not possible

- Includes are useful to organize program in structured manner

it is mainly useful for program type 'M' and program type 'F'.

- Include classification

INCLUDE <program>top "global data declarations

INCLUDE <program>o01 "PBO modules logic

INCLUDE <program>i01 "PAI modules logic

INCLUDE <program>f01 "Subroutines

INCLUDE <program>e01 "Events

INCLUDE <program>u01 "User-Exit

- refer to program : SAPMSRD0

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Procedures :

- Subroutine : is also called as routine (or) form

is procedure, mainly used for local modularization

is a set of statements which begins with FORM keyword and ends with
ENDFORM keyword

syntax to declare subroutine

FORM <subroutine>.

----<statements>---.

ENDFORM.

is called by PERFORM statement

syntax of calling statement

PERFORM <subroutine>.

As a rule, Calling statement must exist before subroutine declaration

Nested subroutines not allowed

but one subroutine can call another subroutine

recursive calling leads to runtime error

Subroutines can also created thru forward navigation(double click)

- system prompt for include selection

- if we choose f01 include , then form...endform template generated


in include

- if we choose main program, then form..endform template is generated in


the same program only

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

After subroutine definition, another subroutine definitions are allowed, but general
statements are not accessible

As a standard approach, all Perform statements exist at the top of the program,
and subroutine definitions exist at the end of the program

Every subroutine must have unique name and it performs unique operation

- Terminate subroutine

in general subroutine is terminated endform statement

we can explicitly terminate subroutine conditionally using CHECK statement, and


unconditionally using EXIT statement

#include <stdio.h>

main()

int a, b, c;

a=10;

b=20;

c=add(a,b);

printf("%d",c);

add(x,y)

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

int z;

z=x+y;

return(z);

- We can also perform operations thru subroutines

possible types of operations :

- Pass by reference

- Pass by value

- Pass by value and result

Inorder to perform operations subroutine must be declared with parameters

The parameters which are defined along with PERFORM statement is called as Actual Parameters

The parameters which are defined along with Subroutine is called as Formal Parameters

As a Rule, Number and data type of actual and formal parameters should be same

USING and CHANGING keywords are used to define parameter interface

*- Pass by Reference : while subroutine call perform statement sends (export) address of
actual parameters to subroutine.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

formal parameter doesn't have separate memory, but in turn they point
to the address of actual parameters

so changes done formal parameters have immediate effect on actual


parameters

USING and CHANGING keywords are same in case of pass by ref.

*- Pass by Value : while subroutine call perform statement sends(export) value of actual
parameters to subroutine.

Formal parameters are declared with VALUE keyword.

VALUE keyword creates separate memory to formal parameters

it receives (import) the values and perform the operation

operation result remains local only

changes done to formal parameters doesn't effect on actual.

formal parameters are created with USING and VALUE keyword

*- Pass by Value and Result : this is also pass by value only

but it is used to return the operation result back to calling


program

result only returns at the end of the subroutine

formal parameters are created with CHANGING and VALUE


keyword

Note : PERFORM statement never contain VALUE keyword

USING followed by parameters are sending/exporting address (or) value

CHANGING followed by parameters are receiving/importing value

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

FORM statement

declared formal parameters with out VALUE keyword are pass by ref(receive
address of actual parameters)

formal parameters USING with VALUE keyword are pass by value (receive value
of actual parameters)

formal parameters CHANGING with VALUE keyword are pass by value and
result

*- Internal Tables can also pass to subroutine

Internal tables can always pass by reference

TABLES keyword is used to pass internal tables

*- Local variables can be defined with in subroutine using DATA (or) STATICS keyword

if the local variable is defined with DATA keyword, then its scope is local, valid with in the program.

if the local variable is defined with STATICS keyword, then it scope is extended to next subroutine
call also.

*- Subroutines can be classified as :

- Internal Subroutines : are created in executable program

are used for local modularization

subroutine and perform statement exist in the same program

- External Subroutines : are created under program type 'S' - subroutine pool

can be called by any program

perform statement exist in executable program(type 1)

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

syntax to call external subroutine :

PERFORM <ex_sub>(program).

*************************************************************************************
***

Function Modules :

- implemented as external subroutines

- created in function builder

Tcode for Function Builder : SE37

Function Builder is used to create to create / change / delete function


group

and create / change / display /test function module

Function Group : is also called as Function Pool (or) Function Library

belongs to program type 'F' - not self executable

can be created using SE37 (or) SE80

is a Repository Object

is a group is a collection of similar functionality of function modules

SAP function group consist of SAP defined function modules

is also collection of dialog screens, status, subroutines, includes..etc.,

after creation function group , system automatically creates function pool


program, sap generated function pool name begins with SAPLz......

steps to create function group :

execute tcode : SE37

goto menu -> function groups -> create group

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

specify group name starting with Y or Z

specify short description

continue

save as local object

Activate function group :

goto menu -> function groups -> display

specify our group

click on master program

activate 2 includes and activate main program, back

Function Module : is procedure, which supports global modularization

every function module belongs to one function group

every function module have unique name and unique functionality

function module also Repository Object

Custom function module name should begins with Y_ (or) Z_

nested function modules not possible

one function module can call another function module

recursive calling leads to runtime error

function module can be created / activated / tested / released

can be called in executable program using below syntax :

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

CALL FUNCTION '<FMODULE>'

one function module can be called in many programs ( reusability )

*- we can perform operations using function modules

- pass by value(import and export tabs)

- pass by value and result(changing tab)

- pass by ref(tables tab)

- exception handling(exceptions tab)

In order to perform operations function module must be declared with formal parameters

calling program must be declared with actual parameters

As a Rule, Formal and Actual parameters number and datatype should be same.

*- working with function module : import and export tabs

scenario1 :

- pass by ref :

- declare import parameters as reference( n1 type i, n2 type i )

- declare export parameter as reference(res type i)

- implement logic in source code with the help of import and export parameters

scenario2 :

- pass by value :

- declare import parameters with default values, check pass value checkbox

- declare export parameters check pass value checkbox

- implement logic with the help of import , export parameters

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Import tab :

is used to declare import parameters

import formal parameters import (accept) the values send by calling programs

can begin i_ import variable

is_ import structure

it_ import table

can be declared with associate type as - predefined type

- dictionary type (SE11)

- global class / global interface(SE24)

can be defined with default values also

if optional check box is checked, then it act optional import parameter, when function module is
called it is displayed as commented

if pass value check box is activated, then it is pass by value otherwise it is pass by ref

if default values are provided for import parameters, then it is act like optional

- can be defined with short / long description

Export Tab : is used to declare formal export parameters with in the function module

it exports the operation result back to calling program

it can be defined e_ export parameter

es_ export structure

et_ export table

- are by default optional

- they can be pass as reference (or) pass by value

- default values not possible

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Note : SAP recommends that use Import and Export tabs as Pass by value

Scenairo3 :

Working with Changing Tab :

- declare import parameters with default values, check pass by value check box

- declare changing parameters with pass by value

- specify logic in source code

changing tab is used to return the changed value back to calling program

values are return at the end of function module

it must return the value

Scenario4 :

Working with Tables tab :

Tables tab is used to pass internal tables to function module

Tables tab is used to declare formal internal tables

begins with t_

internal tables are declared with like addition

by default it is created as old syntax internal table ( with header line )

associate type can be global dictionary type

Internal tables always pass by reference

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- create function module

- declare formal internal table in tables tab

- populate it thru select statement in the source code

- activate , test

- while calling in the program

we have to declare actual internal table and pass to function module

values can be passed as bi-directional

Scenario 5 : working with Exceptions :

- while processing function module, if system come across typical statements, it triggers runtime
error

- runtime errors are handled by exceptions

- we can plan in advance and implement exceptions ,in order to avoid runtime error

- exceptions are handled by messages

- working with exceptions is 2 step procedure :

step1 : declare exceptions in exceptions tab

step2 : raise exceptions under some conditions in the source code

syntax to raise exception :

RAISE <exception>.

- while calling function module in executable program, system automatically fills and assigns sy-
subrc value to exceptions

sy-subrc is zero if function module executed successfully,

its value is 1 for exception1 and so on...

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Notes :

- source code tab is used to specify main logic of function module

souce code can be implemented with the help of local interface

logic must be written between function...endfuntion

requirement based we can declare local data objects

- Attributes tab :

- based on processing type function modules are 3 types

- Normal function module : by default function module type

can be called by any program with in the server

calling syntax :

call function 'FMODUE'

- Remote-Enabled function module : are RFC function module

can be called from any server , any program

is used to exchange data between cross servers

calling syntax :

call function 'FMODULE' destination 'RFC DESTINATION'.

- Update function modules :

- are used to update vb* tables asynchronous

- screen changes are immediately updated to temporary vb* tables

- calling syntax :

call function 'FMODULE' in update task

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Searching for Function module :

- table TFDIR consist of all function modules

- most of the ALV related function modules begins with REUSE_ALV

- all BAPI function module names begins with BAPI_

- Application hierarchy : is used application wise function modules

- Repository Info sys : provides search based on

- function module name

- short description

- function group

- package

- application component

- Repository ->Application Component ->Package ->Function Group ->Function Module

*************************************************************************************
***********

*- BAPI : Business Application Programming Interface

is a standard interface , which is used for SAP to NON-SAP communication

are implemented as remote enabled function modules

BAPIs are widely used in SAP

BAPIs are implemented using ABAP Objects

BFA : Business Framework Architecture

- is a collection of business components

- business components are implemented as application component

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- business component is a collection of business objects

- business object is a collection of bapi methods

- each bapi method uses bapi function module

- bapi function module uses bapi struture

BOR : business object repository

all business objects are stored in BOR

BOR is a collection of business objects

BAPIs are widely used in SAP

- mass data migration ( Non-sap to sap data migration )

- data distribution using ALE( SAP to SAP )

- BAPIs are used in LSMW

- BAPIs are used in Workflow ( user to user communication )

- are used to display output in WebDynpro

- are used in Reporting

BAPI tcode provides list of Business Objects

BAPI tcode displays Business Object Repository

BAPI explorer provides list of Business objects in Hierarchical view and Alphabetical
view

Hierarchical view displays all business objects and Application component wise

Alphabetical view displays all business objects as A....Z order

application component - sd-sls

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

mm-pur

in hierarchical tab : ->expand sales and distribution -> expand sales

->sales order ( business object ) BUS2032(business object type)

-> business object is a collection of

->interfaces

-> key fields

-> attributes

-> methods(describes functionality of business object)

-> events

BAPI methods : are two types

-> instance dependent and instance independent

-> bapi method can be defined with signature(importing, exporting


parameters)

->get_list : provides list of object

->get_status : provides status of object

-> each BAPI method behind BAPI function module is available

BAPI function module :

-> All SAP defined BAPI function module names begins with BAPI_

-> User defined BAPI function module names should begins with Ybapi (or) zbapi

-> processing type : remote-enabled, can be called from any server

-> import and export parameters are created by making use of bapi structures

-> all import , export parameters must be pass by value

-> do not have exceptions

-> special export structure are BAPIRETURN (or) BAPIRET2

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

-> BAPI function group doesn't have dialog screens

Path from Easy Access : SAP menu -> Tools -> Business Framework -> BAPI Explorer

to develop business object ,we use business object builder (tcode : swo1)

Path for Business object builder : SAP menu -> Tools -> ABAP Workbench -> Development ->

Business object builder

********************************

RFC : Remote Function Call

is a protocol used by SAP System

is a mechanism, which is used to establish connection between two external servers

is configured by BASIS consultants

tcode to configure RFC : SM59

RFC is a interface , which provides communication between SAP systems (or) non-sap
systems

We have to provide RFC Destination name, connection type

hostname/IP address, System number

Gateway host / Gateway server details

finally save, test connection

if RFC connection is established successfully, then system provides time in


microseconds , otherwise it leads system failure (or) communication failure

RFC can classified as

tRFC - transactional RFC

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

aRFC - asynchronous RFC

sRFC - synchronous RFC

qRFC - queued RFC

webRFC

ALE : Application Link Enabling :

- SAP can be implemented as central server (or) distributed server

- in case of distributed environment , data is not stored centrally

- country specific servers are maintained

- ALE is a SAP proprietary technology used to distribute master data (or) transaction data
in distributed system

- operations happens in 2 systems

first system ,which sends data is called outbound system (outbound process)

second system, which receives data is called inbound system ( inbound process)

- ALE is used mainly to exchange data between SAP systems

- it provides asynchronous communication

- ALE uses RFC configuration, while establish connection between external servers

- ALE uses IDoc , to exchange data between external servers

- IDoc is intermediate document, is carrier which carries data from one system to another system

*************************************************************************************
**************

Messages : are used to know the operation result

are created in message class

tcode for message class : SE91

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

message class is also repository object

custom message class begins with Y or Z

6 types of message :

Type I - Information message

Type S - Status (or) Success message

Type E - Error message

Type W - Warning message

Type A - Abort (or) Abend message

Type X - Termination (or) Exit message

message class consist of message no and corresponding message text

message no represented by 3 digit number

valid message number range 000 to 999

maximum 1000 messages are possible for each message class

message text can be up to 72 characters , it may have alphanumeric values

message class concern messages are valid to use in entire SAP system

In order to use global message class in ABAP program, we have to specify message class name along
with report statement.

REPORT <program> MESSAGE-ID <msgcls>.

*- Syntax to display message text

MESSAGE <msgtyp><msgno>.

Ex :

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

MESSAGE I000.

Dialog behavior of messages :

Information message : displayed in special screen in model dialog box

it appears with some text and informs to user and allow the user to
proceed to next screen

Status (or) Success message : appears in status bar of same screen (or) next screen

it display text with green color tick mark

Error message : appears in special screen status bar

it display text with red color icon

user can't proceed further, he must go back rectify the issue

Warning message : appears in special screen status bar

it display text in yellow color

user can proceed to next screen, while pressing enter button

Abort (or) Abend message : appears in special screen with model dialog box

it displays with text , red color stop icon

continue with exit button

control transfer to SAP Easy Access

it restart the whole process

Short dump (or) termination message : leads to runtime error

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

it abnormally stops the process, and displays special


screen as short dump

short dump screen displays all runtime errors in SAP

runtime errors can be resolved using debugger

ST22 tcode is used to analyze all runtime errors

*- syntax to use any message class message

MESSAGE <msgtyp><msgno>(messageclass).

Ex :

message i000(zmsg_cls).

*- Syntax to display message of any message class :

MESSAGE ID '<msgcls>' TYPE '<msgtyp>' NUMBER '<msgnumber>'.

Ex :

message id zmsg_cls type 'I' number '000'.

*- syntax to display without specifying message class

MESSAGE '------<msg text>------' TYPE '<msgtyp>'.

*- syntax of message statement which raises exception

MESSAGE <msgtyp><msgno>(message class) RAISING <exception>.

Note : message class messages can be created by forward navigation also

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

*- System fields related to message class

sy-msgid : displays message class name

sy-msgno : displays message number

sy-msgtyp : displays message type

sy-msgv1 : display message variable

*- Messages can be created as static and dynamic

Static messages : are hard coded

always displays fixed message statement

are not reusable

Dynamic messages : are not hard coded

dynamically it display the corresponding text

are reusable

While program execution, program concern message statement sends values to message class
message statement

to hold the values message statement consist of place holders

Syntax of Dynamic Message :

MESSAGE <msgtyp><msgno>(msgclass) WITH <v1> <v2> <v3> <v4>.

Note : All messages are stored in T100 table

*************************************************************************

Write Formats :

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- Write statement displays program output

- NEW-LINE to display output in new line

- NEW-PAGE to display output in new page

- LEFT-JUSTIFIED is used to display output in left side

- CENTERED is used to display output in center

- RIGHT-JUSTIFIED is used to display in right side

- UNDER is used to display one value under another value

- NO-GAP removes explicit gap between two values

- NO-SIGN displays output with out sign

- NO-ZERO displays output with out zero

- NO-DECIMALS displays output with out decimals

************************************************************************************

*- Screens : while working with SAP, we come across 3 types of screens

- Dialog Screens

- Selection Screens

- List Screen

- Dialog screens are special screens , which are used to perform business transactions

- are used to accept input from user / display output to user

- are designed using screen painter

- Selection screens and List screens are used in Reporting (type 1 programs)

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- List screen is used to display program output

write statements and write formats are used to display output as per client requirement

main functionality of list screen is display program output

- in SAP every screen is identified by unique screen number

screen number is represented as 4 digit number

valid screen number range 0001 to 9999

1000 to 1010 are reserved SAP selection screens

Customer screen number range is : 1 to 999 and 1011 to 9999

- Selection Screen :

- are intermediate screen between program screen and output screen

- are interface between user and program

- main functionality of selection screen is to accept input from user

- it is used to filter the data while reading from database table

- standard selection screen number is 1000

- 3 keywords generates selection screen

- PARAMETERS keyword generates selection screen with single input field

- SELECT-OPTIONS keyword generates selection screen to accept range of values from


user

- SELECTION-SCREEN keyword is used to format selection screen and to create custom


selection screen

- PARAMETERS :

syntax :

PARAMETERS <p_field> TYPE <data type>.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Parameters field name should begins with P_ (or) PA_,

it can be up to 8 character long

selection text is used to provide alternative long text for parameter field

goto menu -> text elements -> selection text

- Parameters with DEFAULT addition is used to provide default values to selection screen field,

default values can be editable at runtime by the user

- Parameters with OBLIGATORY addition is used to make selection screen field as required entry
(mandatory field). User must supply the value, otherwise system doesn't allow to proceed to
next screen

- By default input field property is converting lower case value into upper case

this feature can be suppressed by adding LOWER CASE addition

As a result, lower case values retains in lower case only

- NO-DISPLAY addition is used to suppress the visibility of field in selection screen

- VISIBLE LENGTH addition is used to display input field with specified length, but it accept
value as defined length

- VALUE CHECK addition is used to perform validation of user input

it is only allowed if parameter field declared with dictionary type

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- syntax to create Check box :

PARAMETERS : <cb_field> AS CHECKBOX

- Predefined data objects in ABAP :

- System fields(SYST structure components)

- SPACE

- ME (Self reference method)

- SCREEN internal table

- syntax to generate radio buttons :

PARAMETERS : <rb_field1> RADIOBUTTON GROUP <rgrp>,

<rb_field2> RADIOBUTTON GROUP <rgrp>.

Radio buttons also called as option buttons

at least two radio buttons required under one radio button group

radio button group name can be alphanumeric, but can be up to 4 characters length

- Variant : provides pre configured values to selection screen

one selection screen can have many variants

each variant provides different set of values

step1 : execute program

provide values to selection screen

click on save

- specify variant name

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- short description

- save

notice that system generated get variant option, which is useful to choose any
variant from the available variants list

variants are program dependent

variant is important for background job

*- Syntax of parameters :

PARAMETERS <p_field> TYPE <DB Table>-<field>.

PARAMETERS <p_field> LIKE <DB Table>-<field>.

this syntax is used to create parameter field, by making use of database table field

As a result, parameter field get the technical properties(datatype, length)

and F1 help ,F4 help from the table field

Selection text can also created with dictionary reference

*- Syntax of Selection-Screen :

*- Syntax to design block with frame and title

SELECTION-SCREEN BEGIN OF BLOCK <blk> WITH FRAME TITLE <text-nnn>.

------------parameters

------------select-options

SELECTION-SCREEN END OF BLOCK <blk>.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

title for block can be provided by using text symbols

or using initialization event

*- Syntax to provide blank line with in the frame

SELECTION-SCREEN skip.

SELECTION-SCREEN skip <n>.

*- Syntax to provide under line with in the frame

SELECTION-SCREEN uline.

SELECTION-SCREEN uline /2(7).

*- Syntax to display elements in single line with in the frame

SELECTION-SCREEN begin of line.

---parameters

SELECTION-SCREEN end of line.

*- Syntax to display field at specified column position with in the frame

SELECTION-SCREEN POSITION <pos>.

*- Syntax to provide comment for field

SELECTION-SCREEN COMMENT <col_pos>(length) text-nnn FOR FIELD <field>.

Field text can be provided using comment

comment can be provided using text symbol

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

*- Syntax to design custom selection screen

SELECTION-SCREEN begin of screen <scr no>.

---parameters

SELECTION-SCREEN end of screen <scr no>.

*- Syntax to call custom selection screen

CALL SELECTION-SCREEN <scr no>.

CALL SELECTION-SCREEN <scr no> STARTING AT <col> <row>

ENDING AT <col> <row>.

System displays standard 1000 selection screen first ,next system display custom selection screen
100.

*- Syntax to create push button in selection screen

SELECTION-SCREEN pushbutton <col_pos>(length) text-<nnn> USER-COMMAND


<cmd>.

text symbols are used to display text on pushbutton

user actions on selection screen can be handled under AT SELECTION SCREEN event

SSCRFIELDS is a built in structure , which is used to handle user actions on selection


screen

UCOMM component holds the function code value dynamically based on user interaction on
selection screen push button

*- selection screen keyword also used to design tab strip control

***SELECT-OPTIONS : keyword also generates selection screen

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

it is useful to accept range of values (or) interval values from user

it generates two input fields(lower limit -> upper limit)

Syntax :

SELECT-OPTIONS <so_field> FOR <DB Table>-<field>.

select-options field name should begins with so_, it must be up to 8 characters long,

selection text is used to provide alternative long text .

system can't recognize the database field automatically (because of FOR addition)

so TABLES keyword is used to create one work area the name of database table

otherwise we can declare single variable on database table field also.

SELECT-OPTIONS statement creates a special internal table in the memory(RAM)

this special internal table name is <so_field>,

it is also called as selection table

this internal table always created as old syntax (with header line)

header name and body name is <so_field>

this special internal table have 4 fields

- sign : data type c, length 1

value can be 'I' or 'E'

I - include range (inclusive) - default

E - exclude range (exclusive)

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- option : data type c, length 2

is used as comparison operator

BT - between ( default )

NB - not between

EQ - equals to

NE - not equals to

GT - greater than

GE - greater than or equals to

LT - less than

LE - less than or equals to

- low : lower limit value

- high : upper limit value

Select-options generates multiple selections icon in the selection screen,

using this icon user can set / reset include single value or include range of values ,

exclude single value or exclude range of values.

system dynamically generates select statement according user input

- Advantage of this selection table is : user can dynamically specify the values to fetch data

(without changing select statement values can be fetched)

- we can also build this special internal table manually

it can be build by filling header and append statement

it can be build under INITIALIZATION event

so that this values appears as default values

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

*- Additions allowed for select-options :

DEFAULT keyword is used to provide values

NO-DISPLAY is used to suppress the visibility of field in selection screen

NO-EXTENSION is used to suppress the multiple selections icon, ( user can't choose
multiple selections )

NO INTERVALS is used to suppress the upper limit field, ( user can't enter upper limit value )

- Screen fields attributes :

field have some attributes like

- active - visible in the selection screen

- input - ready to accept input

- output - only display output

- invisible - password property( displaying *****)

- intensified - displaying in output in red color

- required - display field with tick mark

- F4 help - display field with F4 key

- we can set attributes for screen fields using programming

- dynamically we can modify screen field attributes

- SCREEN is a built-in internal table which provides several screen field attributes

- SCREEN is a built-in structure which provides several screen field attributes

- syntax to work with screen internal table

LOOP AT SCREEN

if screen-name = '<fieldname>'.

screen-<attribute> = 1 or 0.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

modify screen.

endif.

ENDLOOP.

- SCREEN internal table is by default created with old syntax

- conditional based we can set (or) reset attributes to screen field

- to apply / set attribute use value 1

- to reset attribute use value 0

- modify screen internal table with changed values

- Event AT SELECTION-SCREEN OUTPUT is used to provide several attributes to selection screen


fields

- MODIF ID addition is used to declare modification group name

modification group name can be up to 3 characters

by referring modification group, we can apply common attribute to all fields at a time

- PARAMETERS ,SELECT-OPTIONS both supports MODIF ID addition

*************************************************************

Open SQL : statements are used on Database Tables

sy-subrc and sy-dbcnt system fields are recommended to use for each open SQL
statement

- Insert : used to create new record in database table

first fill work area , and use below statement to create single record

INSERT <DB Table> FROM <wa>.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

fill multiple records into internal table, then use below statement to create many
records

INSERT <DB Table> FROM TABLE <itab>.

- UPDATE : used to modify database table records at later stage

Syntax :

UPDATE <DB Table> FROM <wa>.

UPDATE <DB Table> FROM TABLE <itab>.

- DELETE : used to delete database table entries

Syntax :

DELETE <DB Table> FROM <wa>.

DELETE <DB Table> FROM TABLE <itab>.

- SELECT : statement is used to read / fetch / retrieve data from database table

SELECT <required columns>

INTO <target area>

FROM <database table / database view>

WHERE <condition1>

GROUP BY <column>

HAVING <condition2>

ORDER BY <column>.

SELECT...ENDSELECT is a loop, which is used to read database table data directly

each iteration it reads single record

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

this loop repeats for number of times depends on number of database table entries

it is not recommended to hit the database table for number of times, it is having
negative impact

it is recommend to read single record ( alternative for SELECT SINGLE )

Array Fetch operation : is faster and recommended by SAP

it reads all the records of database table and directly appends to


internal table at one step

this operation bypass work area

it uses SELECT ....INTO TABLE <itab> syntax

*- declare variable as target area, populate it using SELECT single <field> statement

*- declare structure as target area, populate it using SELECT single * statement

*- declare internal table as target area, populate it using SELECT * statement

*- UP TO <n> ROWS addition is used to read records from database table based on index

whenever up to <n> rows statement is used, it is recommended to use ORDER BY addition

*- WHERE addition is used to read condition matching records

multiple conditions can be combined using logical operators AND / OR

comparision is case sensitive

*- ORDER BY is used reading in the specified mode order

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

default mode ascending

instead of sorting at itab level, use select with order by addition

*- GROUP BY :

if several records have similar data, then we can apply group by on column .

it reads several records to single record

it is recommend to perform aggregate function on column

HAVING :

followed by condition

it is only recommended to use after Group by

we can apply further condition of group by column

*- DISTINCT :

addition is used to eliminate duplicate records while reading unique records

*- CLIENT SPECIFIED :

addition is used to read data from other clients

by default system reads data from local logon client

*- Aggregate functions : are used to perform Arithmetic operations along with Select Statement

MAX( <f> ) : provides maximum value of field

MIN( <f> ) : provides minimum value of field

AVG( <f> ) : provides average value of field

SUM( <f> ) : provides sum value of field

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

COUNT( <f> ) : provides number of records

*- reading data from 2 database tables

pre-requisite : underlying database tables must have relationship

KNA1 <-> KNB1 <-> KNC1 ( common field is KUNNR - customer no)

LFA1 <-> LFB1 <-> LFC1 ( common field is LIFNR - vendor no )

MARA <-> MARC <-> MARD ( common field is MATNR - material no )

VBAK <-> VBAP ( common field is VBELN - sales doc no )

EKKO <-> EKPO ( common field is EBELN - purchase doc no )

*- Techniques used to read data from multiple tables :

- use Inner join (or) left outer join

- use inner queries or subqueries

- use for all entries

- use parallel cursor

*- Inner Join : reads the data from both tables using join condition

join condition is defined based on common fields in both tables

*- For all entries : is used while populating current internal table, while comparing existing
internal table

is used to read corresponding records from database table

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

pre-requisite : main driving table should not empty

is used alternative for nested select statements

***********************************************

Inter program Communication : this topic deals with program to program communication

- SUBMIT keyword is used to call executable program in another executable program.

(to call report in report)

syntax :

SUBMIT <program>.

- syntax :

SUBMIT<program> AND RETURN.

this syntax calls the another executable program and while returning it display currnt program output

- syntax :

SUBMIT <program> VIA SELECTION-SCREEN.

this syntax calls other program concern selection screen first, then display output

- syntax :

CALL TRANSACTION '<tcode>'.

this syntax calls the specified tcode , and while returning it executes current program remaining
statement

this syntax calls the initial screen of specified tcode

- syntax :

CALL TRANSACTION <tcode> AND SKIP FIRST SCREEN.

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

this syntax skips the initial (or) first screen

- syntax :

LEAVE TO TRANSACTION '<tcode>.

this syntax leaves the current program and calls the specified tcode, while returning control transfer
to SAP Easy Access

- SAP MEMORY : is a common memory which is shared by all external programs

SET / GET parameter statements are used to share SAP memory

SET parameter statement sets the value from program to SAP memory

GET parameter statement reads the value from SAP memory to other program

syntax :

SET PARAMETER ID <pid> FIELD <f>.

GET PARAMETER ID <pid> FIELD <f>.

Parameter id is used to read (or) set values

Parameter id is defined at Data Element level

Fieldname Parameter ID

KUNNR KUN

MATNR MAT

LIFNR LIF

VBELN AUN

BUKRS BUK

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

*- Parameter ID values can be defined permanently at user profile

whenever user logs in, system reads values from user profile and display

system menu -> user profile -> own data -> parameters tab ->

specify parameter ID and parameter value

*- Parameters and SELECT-OPTIONS can also be defined with parameter id, using MEMORY ID addition

PARAMETERS <pa_field> type <DB Table>-<field> MEMORY ID <pid>.

SELECT-OPTIONS <so_field> FOR <DB Table>-<field> MEMORY ID <pid>.

system reads the value from user profile and display as default value

****ABAP Memory : is a common memory between all internal sessions of an external session

can be exchanged using EXPORT and IMPORT statement

Export statement exports the value from internal session to ABAP memory

Import statement imports the value from ABAP memory to other internal
session

*- Substructure can be defined with BOXED addition

advantage of boxed addition is when data object is created, initially it won't allocate memory.

substructure components are created in PXA - with initial values, as non modifiable part

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

when substructure components are assigned with value (used), then it revoke the reference from
PXA to modifiable memory

*************ABAP Reporting :

- Reports are used to display structured and formatted output

- Reports are output of Executable Program (Type 1)

- Reports are used by end users

for - information / analysis / decision making

- All SAP defined built-in reports are available under information system

- Possible types of Reports in ABAP :

- Classical Reports (or) Classical List

- Interactive Reports

- ALV Reports

- LDB Reports : are mostly used in ABAP HR programming

- ABAP Query (or) SAP Query : are generated by Functional consultant, without programming
knowledge

- ABAP is Event driven programming language

- ABAP reporting and screen programming is implemented using Events

- Every event have unique name and purpose

- SAP recommends to write Events explicitly in the program

- after writing events total program is divided as event blocks

- system gives high priority to Events

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- events are not triggered as the sequence it was written in the program

- events have priority of execution

- some events triggers internally by the system ( implicit events )

- some events triggered by user actions ( explicit events )

- Dialog Screen Events :

- PBO : Process Before Output - it provides default values to dialog screen

it triggers while loading the screen

- PAI : Process After Input - it consist of user input validation

- it is triggered by user actions on dialog screen

- POH : Process on Help-Request - it provides F1 help to screen field

it is triggered by F1 function key

- POV : Process on Value-Request - it provides F4 help to screen field

it is triggered by F4 function key

- Selection screen Events :

INITIALIZATION - it triggers while displaying selection screen

it is used to provide default values to selection screen fields

it is used to perform certain calculation before displaying selection screen

it must followed by START-OF-SELECTION event

is only valid for Executable program (type 1)

AT SELECTION-SCREEN OUTPUT - it also triggers before displaying selection screen

it provides different attributes to screen fields

AT SELECTION-SCREEN - it triggers after user action on selection screen

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

is used to perform authorization check

is used to perform user input validation check

AT SELECTION-SCREEN ON <f> - it is useful to validate particular field

AT SELECTION-SCREEN ON RADIOBUTTON GROUP <grp>.

- it is useful to perform operation after user interaction on


radio button group

AT SELECTION-SCREEN ON BLOCK <blok>.

- it is useful to validate all block concern fields

AT SELECTION-SCREEN ON seltab.

- it is useful to validate selection table

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <f>.

- it provides F4 help to screen field

AT SELECTION0-SCREEN ON HELP-REQUEST FOR <f>.

- it provides F1 help to screen field

***********************

List Screen Events :

START-OF-SELECTION.

is implicit event triggered by the system for all executable programs


by default

is used to select the data from database table

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

END-OF-SELECTION.

is triggered at the end of data selection from database

is used to display output to list screen

TOP-OF-PAGE.

provides header information for page

is triggered by First write statement (or) Uline (or) SKIP statement

END-OF-PAGE.

provides footer information for page

is triggered by LINE-COUNT addition , along with Report statement

*************************************************************************************
****************

Report Transaction : is used to assign reports to end user

can be created using SE93 tcode

custom tcode name should begins with Y or Z

combines executable program and its selection screen 1000

Steps :

- execute tcode : se93

- specify tcode begins with Y or Z

- click on create

- specify short description

- choose report transaction

- continue

- specify program name

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- selection screen number 1000

- check GUI capability as SAP GUI support Windows

- save as local object

- check, test

**************************************************************************

Note : Custom List heading and column headings can be provided using text elements

goto menu -> text elements -> list headings

*************************************************************************************
***********************

Performance Tuning (or) Performance Analysis :

- Performance Factors on Database Tables :

- Indexes

- Buffering

- Log data changes

- Performance Factors on Select Statements :

- instead of select * , use select <f1> <f2>

- fetch required data only from database

- do not use select ...endselect loop, use Array Fetch (into table)

- implement many conditions, with WHERE

- instead of sorting at itab level, use Order by addition with select statement

- instead of perform arithmetic operations at itab level, use select aggregate functions

- instead of deleting duplicate records at itab level, use select distinct addition

- use inner join (or) database views

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- do not use nested select statements , use for all entries (or) parallel cursor

- Performance Factors on Internal Tables :

- use explicit syntax (without header line)

- nested loops not recommended

- select statement with in loop...endloop is not recommended

- Performance Tools :

- Extended Program Check - tcode SLIN

- Runtime Analysis - tcode SE30

- SQL Trace - tcode ST05

- Code Inspector - SCI

- ABAP Debugger

- Path for Performance examples :

ABAP Editor -> environment menu -> examples -> performance examples

- SAP Code Inspector :

- is a tool introduces from 4.7 version onwards

- is useful to check performance of any program

- it checks performance checks, security checks, extended program check, user interfaces

- it is also useful to perform check on WebDynpro application

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- path from ABAP Editor : Program menu -> check -> code inspector

- direct tcode : SCI

- path from SAP Easy Access : SAP menu -> tools -> ABAP Workbench -> test -> code
inspector

- Check variant : specifies list of checks to be carried out

- Object set : specifies list of object to be checked

- Inspection : combines check variant and object set

*****************************************************************

Authorization :

- we have to restrict user to access certain business critical data

- it can be implemented using Authorization Check

- in general select statement doesn't perform authorization check by default, we have to explicity
implement authorization check

- Authorization class is a collection of Authorization objects

Each Authorization object consist of fiedls

ACTVT field have 3 values 01 - create,

02 - change,

03 - display

- List of Authorization are defined under profile,

Profile is assigned to Role

Role is assigned to user master record

- Step1 : tcode : SU21 - create authorization class starting with Y or Z(ZACL)

- place the cursor on our authrozation class, then create authorization


object

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

specify fields like BUKRS, ACTVT,

specify permitted values(03 - display)

- BASIS consultant performs - profile creation with authorization

role creation , assign profile

user master record creation , assign role

- Step3 : tcode : SE93 : while creating tcode for executable program, ie.,Report Transaction,

specify authorization object and values

- Step4 : open program implement authorization check

under event AT SELECTION-SCREEN

call pattern, choose authorization radio button, specify authorization object, continue

specify values in the program,

check sy-subrc.

if the user is authorized ,specify select statement to read data

otherwise throw error message

*---------

Debugger : is a tool closely integrated with ABAP Workbench

is used to resolve runtime errors

is useful to analyze the program as line by line

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

Different ways to enter debug mode

- command /h

- break-point statement in program

- system menu -> utilities -> debug ABAP / program / system

- ABAP Editor -> program menu -> execute -> debugging

- In ABAP two types of debugger available :

old debugger - classic debugger , is valid up to 4.7EE version

new debugger introduced from ECC 5.0 onwards

- Classic Debugger :

common options available for all tabs :

F5 - single step - is useful for line by line execution

F6 - execute - is useful to execute set of statements at a time ( subroutines / function


modules / methods )

F7 - return - is useful to return the control back to main program

also useful to move cursor to next break point

F8 - run - it stops debugger and executes rest of the program at a time, procced to next
screen

Fields tab : is used to analyze variables, work areas

Tables tab : is used to analyze internal tables

we can change, delete, insert, append records in debug mode

change internal table content

- double click on field value

- specify new value

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

- then click on pencil icon(change field content)

- execute

Break-points :

- is a signal in the program source code, where system stops processing and starts debugger

- static break point can be created using syntax :

BREAK-POINT.

BREAK-POINT <n>.

BREAK <username>.

static break points : increase program lines

hard coded

- dynamic break points :

can be displayed in break points tab

can be maximum 30 (per program)

can be set / delete in program (or) debug mode

are not hard coded, doesn't increase program lines

can be set / delete using stop icon (application tool bar)

it is allowed on built-in programs also

- Watch Points :

unlike Break points, watch points are used to watch the program changes

one program can have maximum 10 watch points

Mail ID : avkrishna.sap@gmail.com +91 97048 86510


SAP ABAP Certification Notes - prepared by A.V.Krishna,SAP Certified Consultant & Trainer

can only set in debug mode

once debugger closed watch points are deleted automatically

watch point can be defined by specifying field name, whenever field value changes, system prompt
with message "watch point reached'

watch point can also be created by specifing condition (values), if system meets the condition then
prompts with message "watch point reached'

several watch points can be defined with logical operators AND or OR

- CALLS tab provides list of all active calls in chronological order

- Overview tab displays all list of events, and triggered sequence

- Settings tab displays advanced settings of debugger

- New Debugger : opens the debugger as parallel session

supports to debug webdynpro applications

Desktop1,2,3,standard used to analyze field values

structure tab is used to analyse structure values

tables tab is used to internal tables

objects tab is used to analyse object oriented objects

diff tab is used to compare two variable values

Mail ID : avkrishna.sap@gmail.com +91 97048 86510

You might also like