Professional Documents
Culture Documents
Krishna
+91 9704886510
krishna.saptrainer@gmail.com
ABAP Dictionary :
Domain : - describes technical properties like datatype, length , decimal places and
values, intervals, value table )
- is low level component in the hierarchy
- is also independent Repository Object
- it is used while creating Data Element
- One Domain can be used while creating multiple data elements (Reusability)
- it can't be used in tables or structures directly
- Conversion Routine is attached at Domain level
- Domain can be defined directly from ABAP Dictionary initial screen
- Value Range
- Fixed Values : if the expected values for table field is fixed ,then we can define at domain level.Wherever this
domain is used these fixed values automatically populated as F4 help for input field. If the user chooses a value
from the F4 list, then record is valid, otherwise it is invalid.
- Intervals : if the expected values for table field contains rage of values, then we can define at domain
level.Wherever this domain is used these range of values automatically populated as F4 help for input field.If the
user enters a value from any one of the valid range then record is valid, otherwise system rejects entry (Field
Validation)
*- Where-Used List :
it is SAP provided special feature, used to findout object concern
the result is displayed as List
result is depdend on cursor position (object based)
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- Definition :
- F.key is keyfield of other table
- F.key servers like interface between two tables
- F.key may consist of duplicate values
- Advantages :
- F.key generates F4 help
- F4 help is useful to enduser while creating current record, with the help of
- Filed Validation ( if the user enters a value from F4 list , then record is valid
system rejects entry)
- New Terminology :
- Check Table : is parent table (or) base table for other tables
- this table works like reference to other tables, after creating
- on successful creation of F.key check table keyfield values
automatically populated as F4 help in F.key field
- Forieng key Table : it is child table (or) dependent table on Check table
it consist of F.key field (or) Check Field
it performs implicit check against check table entries
otherwise
F.key
proces
used to cross check with Check
- Constant F.Key :
we can define constant value for a field
Ex :
'MANDT = 800'
- F.key field type :
- can be key field of F.key table
- can be non-key field of F.key table
- can be keyfield of text table
( Text Table is a foriegn key table which maintains text.
text is always maintained for serverl languages.
if any F.key table one of the key field consist of LANG as datatype
- Cardinality
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- is also called as Multiplicity
- precisely defines the relationship between two tables
- specifies the number of dependent records for a record of check table
- Structure :
- is a collection of components
- component uses component type as Data Element, Structure, Table Type
- structure doesn't store data
- structure is included in another structure (or) Database Table
- One Structure can be included in many structures (or) Database Tables
(Reusability)
- We can provide search help and check table for Structure component
- We can provide Ref table and Ref field name for CURR and QUAN
datatype fields.
- it is independent Repository Object
- it is data type defined centrally in ABAP Dictionary
- whenever structure is included in table, structure components becomes
part of table field
- Structures are 3 types :
1.Flat Structure :
is collection of components, Components are created using component type
2. Nested Structure :
one of the structure component is ref to another structure
3.Deep Structure :
one of the structure component is ref to table type
as Data Element
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
Note : Structure component may ref to data element, table type, structure,
may ref to existing Database Table (or) View
may ref to Global Class / Global Interface(Ref checkbox activated )
may ref to object / data ( Ref checkbox activated )
Structure can be included with .include (or) general field name also.
Append Structure :
- is used to add custom fields to standard table (or) structure
- it is implemented as Table Enhancement
- is always adds the fields at the bottom
- is not reusable ( it is applicable to only one table )
- it is special procedure, implemented based on requirement only
- Access key not required to perform table enahcnement
- Append Structure name and its field name should begin with YY or ZZ
- Difference between Include Structrure and Append Structure
Include Structure :
- is used to include fields to table or structure
- is possible at any position
- is reusable
- name begins with Y or Z
- possible for custom tables / structures
Append Structure :
- is used to add fields to table or structure
- is always added at the bottom
- is not reusable
- name begins with YY or ZZ
- possible for both custom / standard tables
- Customizing Includes :
- are called as CI_Includes
- are special includes defined by SAP for some tables
- CI_includes empty includes by default
- User can add additional custom fields to Standard Table using CI_Includes
- are reusable includes
- Ex : PA0002 consist of CI_P0002 as include
AUFK table consist of CI_AUFK as include
*---------------------------------------------------------------*
- Table Type : Global Internal Table Types can be defined in ABAP Dictionary
- are valid for all programs
- are created using structure type as line type
*------------------------------------------------------------------*
- Type Group :
- it is also called as Type-pool
- it belongs to program type 'T'
- it is a collection of Types and Constants
- it consist of elementary types, structure types, and table types
- it is 5 characters length and all components of type group must begin
underscore
- Ex : SLIS
*-------------------------------------------------------------------*
VIEW : is a collection of data from more than one related database tables
Basically View doesn't consist of data, but it contain data at runtime
it is also called as Temporary table (or) imganiry table (or) virtual table
4 types of Views are possible in SAP.
1.Database View :
2.Projection View :
3.Maintenance View :
4.Help View :
- Database View :
(dynamically)
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- it is a collection of data from more than 1 related tables
- it implements inner join
it fetches the data from two tables based on join condition
Join condition can be defined on keyfields of both tables
- Selection conditions can be defined
- Maintenace Status : Read Only
- DB View can be buffered like Database Tables
- DB views can be used ABAP Programs ( alternative for inner join select
statement )
- Database View can be created on Single table also, then we can create entires
- Custom Database View creation steps :
Execute Tcode SE11
select View Radiobutton
specify view name begins with Y or Z
click on create
select database view and continue
specify short description
specify database tables ( MARA, MARC)
select both tables
click on relationships
system proposes relationship dialogbox
choose correct relationship , continue
click on view fields tab
select key fields from both tables
select required non key fields from both tables
save, check, active
- path to display view content :
Utilities menu -> Content
- path to view system generated Create statement :
Extras -> create statement
- path to set buffer settings
goto menu -> technical settings
condition.
2.Left Outer Join : fetches all keyfields key information first and later it cross checks with right side table. i.e.,
Leftside entire loaded data is loaded into target area first and later system fetches relevant data from right side
table
- Projection View :
it is used to hide some data and inturn display other data
it is always created on single table only
it can be used in ABAP Programs
Join conditions not possible
Selection condidtions not possible
Maintenance Status : Read Only
System doesn't generate create view statement
Technical settings (buffer settings) not possible
Steps :
- go to Tcode SE11
- select view radiobutton
- specify view name begins with Y or Z
- click on create
- select projection view and continue
- specify short text
- specify BASIS Table name
- choose required fields including key fields
- save, check, activate
- Maintenance View :
it is also used to fetch data from related tables and display
Unlike other views, it also supports to maintain (insert/change/delete) data
- it implements left outer join
- condition based data retrieval is possible
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- Maintenance Status : read, insert, change, delete
- Working with M.view is 2 step procedure :
Step1 : View creation
Step2 : Table Maintenance Generator
Step1 :
- go to Tcode SE11
- select view radiobutton
- specify view name starting with Y or Z
- click on create
- select M.view and continue
- specify short description
- specify table name(Left side table)
- click on relationships
- select one relatship based on system proposed list
- click on view fields tab ( notice that system proposed left side table
- select right side table keyfields
- select required non key fields from both tables
- save, check, activate it
keyfields)
users
changes done by
Maintenance Generator
Help View :
- it is also used to fetch data from database tables and display
- it implements left outer join
- selection conditions possible
- maintain status : Read only
- it is used as a selection method while creating Elementary Search Help
- Append View is possible for Database View and Projection View
*---------------------------------------------------------------------------------*
Search Help :
Definition :
- it is also called as F4 help (or) Possible Entries (or) Possible value help (or) Input Help (or) Hit List (or) Entry Help
- F4 help provides list of possible values, which is useful to consultant / end
user
- F4 help is useful to end user to select a value from the list (or) to provide a new value
- SAP provides default search help in different ways :
1.Domain - fixed values (or) interval values will automatically populated as
2.Check Table generates F4 help
3.data type DATS generates Calender control as F4 help
4.data type TIMS generates Timer control as F4 help
F4 help
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
number field
- Prerequisites :
- Table must be active status
- Table must have some data
- Table field must have data element
- Procedure :
- goto Tcode SE11
- specify Search help name begins with Y or Z
- click on create
- select Elementary Search help name, continue
- specify selection method as Tablename(ZDE_EMPMASTER)
- specify Search help parameter as Mobileno
- check import and export checkboxes
- specify LPos as 1 and SPos as 1
- save, check, activate, test (F8)
- Search help attachment to table field
open the table in change mode,
click on Entry help/check tab
place the cursor on fieldname
click on search help button
specify search help name and continue, copy
notice the status message and Origin of Search help
While createing entry notice F4 help
- Search help can also be attached to structure component using Entry help /
check tab
- Search help can also be attached to Data Element using Further Characteristics tab
- Note : Search parameter name and field name should be same
Import parameter fetches the field data from database and lates
Export Parameters export the value (choosen by the user) from Hit
LPos specifies ( List Position) field appearing position in the Hit List
SPos specifies Search Position in the internal system generated select
in Hit List
List to Screen field
statement.
Using Modified check box ,we can modify system proposed Data Element
Search Help Exit : is used to change the standard behaviour of Search Help
it is implemented using Function Module
Using this function module , we can deviate standard
behaviour
Hot Key : consist of one character of Elementary Search Help name
it is useful to switch from other elementary search help to current
Collective Search Help )
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
Dialog Behaviour :
- Dialog Type :
- Display values immediately : default option, values are dispalyed as soon as
chooses F4 key
- Dialog depends on set of values : set this option, if the values are less than
500
- Dialog with Value Restriction : set this option, if the values are more than
system displays resriction dialog box ,which is useful to
Rescriction can be set by defing condition
conditions can be defined for any field using relational operator (= <> <
<= > >=)
this condition comparision is case sensitive
user
500
set further restrictions
Helps
- Steps :
- create Help View using left outer join
- create Elementary Search help using Help View
- creating Collective Search help :
- goto Tcode : SE11
- select search help radio button
- specify collective search help name begins with Y or Z
- click on create
- specify short description
- specify field names under definition tab
- specify elementary search help names under include search help tab
- select each elementary search help and click on parameter assignment
- copy
save, check, activate,test
- Assign collective search help to Data Element / Table field
- Personal Value List :
- can be created for any F4 help
- it can be created based end user requirement
- system always displays personal value list only
- Data browser Navigation :
se11 : open any table in display mode
Utilities -> table contents -> display
system displays Data browser of selection screen
- this selection screen is used to restrict output list based on user input
- Adding fields to selection screen :
settings menu -> Fields for selection
- Maximum no of Hits = Number of records to display
- width of output list is 250 by default ( can be change settings menu -> user
- displaying required columns in the output
settings menu -> format list -> choose fields
*--------------------------------------------*
Performance Factors on Database Tables :
1.Buffering :
- Every application server consist of local buffer
- Buffers resides behind application server
- Buffer is a small area, which is a part of shared memory
parameters)
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- Buffer data is volatile ( not fixed, keep on changing )
- while executing select statement, database interface looks for local buffer
content , if the required data is
already avilable in the buffer it reads from
buffer rather than database
- reading from buffer is 100 times faster than reading from databse
- Tables and DB Views can be buffered
- Using Technical settings , we can specify buffer option
- Frequently accessed and rarely updated tables are advisable for buffering
- Buffering not allowed : if this option is set, then table content is not
- Buffer allowed but switched off : if this option is set, then table content is
not aware of number of records
loaded into buffer then choose this option
- Buffering switch on : if this option is set, table content is processed
buffering type (3 types)
- Fully Buffered :
if fully buffered is selected all the table content is loaded into buffer, even if
3.Index :
- makes faster access of data records from database table
- speeds up the data retrieval from database table
- while activation of database table system creates primary index on all the
- Primary index is always Unique Index
Primary index name is 0
- Indexes are created permanently in the underlying database
- while executing select statement, system uses index of the database table
- Index is a copy of database table with reduced fields
- Index is always created in the sorted order
- system performs binary search while searching for match found record
- Secondary indexes are created on tables based on requirement
- path to view indexes of table
Utilities menu -> database object ->database utility -> indexes tab
- path to create secondary index :
open the table display mode -> click on Indexes tab ->
click on create
index ->
specify short description ->
specify index fileds
save, check, activate,back
*----- DATABASE Utility : SE14 tcode
- is used to perform conversion process ( activate and adjust database)
- Indexes tab displays list of all indexes
- check runtime object is possibe
- check database object is possible
- under storage parameters displays table and indexes of database
- Object log tab displays error log list
*------------------------------------------------------------------------*
LOCK OBJECT :
consultants
(update,delete) done by users of
clients
keyfields
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- is used to restrict simultanious access of table record by several users at a time.
- SAP supports row level (or) record level locks
- if one user is editing particular table entry, at that of time that entry must be locked - so that other users can't
perform other operation
- way to work with lock object
lock table entry
- perform operation ( insert, update, modify, delete ,select )
unlock table entry(release)
- if at all we want to lock particular table entry, lock object must be defined in ABAP Dictionary
- User defined lock object name begins with Ey (or) Ez
- we can lock primary table entry and dependent table entries also
- lock happens by default using lock argument as table key field
- lock modes (or) lock types classifed as 3 types :
1. Type 'E' - Exclusive Lock (Write Lock) :
if Exclusive lock set by user on table entry, that user only can
perform all operations on table entry.
other shared and execlusive locks are rejcted
it is cumulative ( can be set / released for several times allowed )
2.Type 'S' - Shared Lock (Read Lock) :
if Shared Lock is set by user on table entry, user can only view the
table entry, editing is not allowed.
other shared locks are accepted, but not Exclusive Locks
3.Type 'X' - Extensive Lock (Write Lock) :
it is Exclusive Lock, but not cumulative
Exclusive lock can be set / released by the user for several times.
but Extensive lock can only set / released by the user only one
time.
- Physical lock happens at underlying table
- Logical lock happens at application level
- Lock mechanism is handled by Enqueue Work Process
- Lock Entries are stored in Enqueue Server (or) Lock Table
- using SM12 tcode we can view lock entries
- Upon defining and activating lock object , system generates 2 function modules automatically
Enqueue_<lockobjectname> : this function module is used to set
lock
Dequeue_<lockobjectname> : this function module is used to release
lock
- Steps to Work with Lock Object :
Business Scenario : perform lock operation on zempmaster of
delete)
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
C, C++ language
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
Type
Type
Type
Type
Type
1 program are self execute , and other program types are not self
I,S,F are Modularization Techniques
T is created in ABAP Dictionary
K,J used in Object Oriented ABAP
X - XSLT program is used to convert ABAP Programs to XML and
allowed
executable
single line
A.V. Krishna
+91 9704886510
Operator denoted by symbol
Operator performs unique operation
Operators need not to be specified with in quotes
krishna.saptrainer@gmail.com
operations
*-------------------------- keywords------------*
- are
reserved words, which are used for special purpose
- DATA : declaration keyword, which is used to declare variable, structure,
TYPES : keyword is used to define custom elementary data types, structure
CONSTANTS : keyword is used to define constant variable
PARAMETERS : keyword generates selection screen with single input field
SELECT-OPTIONS : keyword generates selection screen with lower and
internal table
types, internal table types
upper limit fields
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- X - Hexadecimal ( used in SAP Graphics )
- Variable length data types
- Strings ( character sequence)
- Xstrings (byte sequence) - are used in bitwise operations
- Complex data types
- Structure type - Structure
- Table type - Internal Table
- Reference data types
- Data Ref - using LIKE
- Object ref - using TYPE REF TO
- classes
- interfaces
- Data Objects : are instances of data types, which occupy memory.
- are 7 types
1.Literals : are named data objects, used to assign value to data objects
- Numeric Literals : consist of numbers
Ex : '123'
-456
specifying single quotes are optional
- Character Literals : consist of characters
Ex : 'RAVI'
'AP11Z 4282'
specifying single quotes is mandatory
2.String : - is a collection of characters
- must be placed with single quotes
Ex :
write 'Welcome to SAP R/3'.
3.Constants : are data objects consist of fixed values
4.Interface Work Areas : Tables (or) Nodes
5.System Fields :
- also called as System Variables
- are predefined data objects
- are SYST structure components
- are specified using prefix syst-<component>.
- can be printed along with write statement
Ex :
sy-datum : displays current application server date
sy-uzeit : displays current application server time
sy-uname : displays current logon user name
sy-subrc : displays return code of operation
sy-dbcnt : displays record count , as a result of SQL operation
6.Variable : is data object which holds the value at runtime
7.Text Symbol : is a part of text pool and text element
supports to write language independent program
are used to avoid hard coded text
are used for reusable text
are displayed along with write statement
write / text-<nnn>.
<nnn> specifies the text symbol name.
*---------------------------------------------------------------------*
- ABAP supports to print 7 background color IDs
- /
prints output in new line
- /<col_pos>
prints output at specified column position
- ULINE statement prints under line
- ULINE /<col_pos(<length>).
it prints underline for specific word
- ULINE AT /col(pos).
it prints underline at specified column position
- SKIP statement provides one blank line in the output
- SKIP <n> statement provides <n> blank lines in the output
- SKIP to line <line no>. it skips <line no> in the output, this works on line
NOTE : ULINE and SKIP statements are printed individually,
can't be used along with WRITE statement
count basis
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- if the variable is created using custom data type , then length specification is not allowed
- syntax to define custom data type :
TYPES <custom data type> type <predefined type> length <len>.
- value addition is not possible for types
- Tcode : ABAPHELP - provides keyword documentation (F1 help)
- Tcode : ABAPDOCU - provides list of predefined example programs
or not
data object.
A.V. Krishna
+91 9704886510
- D : is used to display date
YYYYMMDD -> DDMMYYYY
(sourcecode)
(output)
it is fixed length 8 places
default saparater .
- T : is used to display time
TIMS displays dictionary format
it is fixed length 6 places
default separater :
HHMMSS -> HHMMSS
krishna.saptrainer@gmail.com
Note : when we are accepting values from user using selection screen,
by default.
if the input is wrong system throws error message
select-options field
using this option
A.V. Krishna
+91 9704886510
Syntax :
shift <string> [by <n> places] [<mode>].
<n> specifies number of places to be shifted
by default 1 place of left side is shifted
krishna.saptrainer@gmail.com
8. SPLIT : is used to devide large string into sub strings at particular delimeter
Syntax :
SPLIT <string> at '<delimeter>' into <sub string1> <sub string2>.
9.OVERLAY : is used to overwrite one string with other string.
Syntax :
OVERLAY <string1> with <string2>.
sring
fdpos values begins with
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
String Comparision Operators :
CO
Contains only
CN
Contains not only
CA
Contains any
NA
Contains not any
- above operations are case sensitive
CS
NS
CP
NP
Contain String
Not contain String
Contain Pattern
Not contain Pattern
- above operations are not case sensitive
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- this loop repeats for <n> times
- <n> is counter, which consit of integer value
- if <n> times addition is not specified , it repeats for infite loop
and finally terminates as runtime error
- sy-index is a system field using in loops
sy-index prints current loop index number
sy-index default value is zero, when it comes to first iteration it is incremented as 1 and next iterations its value
incremented by 1..and so on..
- Terminating Loops :
Loop can be terminated conditionally using CHECK statement
and unconditionally using CONTINUE , EXIT statement.
- While LOOP :
- conditional loop, which checks the condition first, if the condition is true it
Syntax :
While <condition>.
----<statement block>----.
Endwhile.
*- Working with Date and Time calculations -*
Standard SAP date format is : YYYYMMDD
1234 56 78
- using offset we can perform operations
date+6(2) = 'DD'.
date+4(2) = 'MM'.
date+0(4) = 'YYYY'.
Standard TIME format is : HHMMSS
12 34 56
time+4(2) = 'SS'.
time+2(2) = 'MM'.
time+0(2) = 'HH'.
- Complex data types
- Structure :
- it is collection of components
- it is complex data object, which is declared by DATA keyword
- it will create at runtime on RAM (dynamic object)
- it holds only one record at a time
- syntax to declare struture :
DATA : begin of <structure>,
<comp1> type <data type>,
<comp2> type <data type>,
--------------------------------,
-------------------------------,
end of <structure>.
- DATA keyword creates data object
begin of keyword starts structure, end of keyword ends structure
structure is created with specified components
- Syntax to address structure component
<structure>-<component>.
- we can assign value to structure to components in 3 ways :
- using VALUE keyword
- using = operator
- using MOVE keyword
- structure is also called as Field string
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- Warnings ( can be ignored )
- Dynamic Erros
- also called as Runtime Errors
- are displayed as short dump
- while processing programming if system across typical situation then it leads to runtime error
REPORT ZDE_PROGRAM.
*-------------------------------------program for color and uline
*write / 'Welcome to SAP R/3' COLOR 1.
*uline.
*write /5 'Welcome to SAP R/3' COLOR 2.
*uline 25(18).
*uline at /5(18) .
**write /10 'Welcome to SAP R/3' COLOR 3.
**uline /10(7).
**write /15 'Welcome to SAP R/3' COLOR 4.
**uline /26(3).
*
**----------------------------------------program for write and skip statement
*write / 'Welcome to SAP R/3' COLOR 1.
*skip.
*write /5 'Welcome to SAP R/3' COLOR 2.
*skip.
*write /10 'Welcome to SAP R/3' COLOR 3.
*skip 2.
*write /15 'Welcome to SAP R/3' COLOR 4.
*skip 3.
*write /20 'Welcome to SAP R/3' COLOR 5.
**skip to line 25.
*write /25 'Welcome to SAP R/3' COLOR 6.
*write /30 'Welcome to SAP R/3' COLOR 7.
*write / 'Reddy''s Lab'.
*write : / 'cap', '$', 'gemini' .
*write sy-vline.
*write '|'.
*write '/'.
*-----------------first program(static assignment using = operator)----------------------*
*data n1 type i.
*data n2 type i.
*data res type i.
*
**n1 = 10.
**n2 = 20.
**res = n1 + n2.
*res = 10 + 20.
*
*write / n1.
*write / n2.
*write / RES.
*--------------chain operator-----------*
*data : n1 type i,
*
n2 type i,
*
res type i.
*
*n1 = 10.
*n2 = 20.
*res = n1 + n2.
*
*write : / 'N1 value is', n1,
*
/ 'N2 value is', n2,
*
/ 'Res value is',RES.
*------------Static value assignement using VALUE keyword-------------*
*data : n1 type i value 25,
*
n2 type i value 35,
*
res type i.
*
*
A.V. Krishna
+91 9704886510
*res = n1 + n2.
*
*write : / 'N1 value is', n1,
*
/ 'N2 value is', n2,
*
/ 'Res value is',RES.
krishna.saptrainer@gmail.com
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
*----------------------LIKE
*data : n1 type i,
*
n2 type i,
*
n3 like n2.
*
*n1 = 10.
*n2 = 20.
*n3 = 30.
*
*write : / n1,
*
/ n2,
*
/ n3.
*data v_lifnr type lfa1-lifnr. " data obj creation by making use of table field
*data v_lifnr like lfa1-lifnr. " data obj creation with ref to existing table field
*data v_nam1 type name1_gp.
*data v_name1 like kna1-name1.
**------------------working with data types
* data : n1 type i,
*
num1 type f ,
*
number1 type p decimals 2,
*
*
name(8) type c,
*
add(6) type n,
*
date type dats,
*
time type tims.
*
* n1 = '45.47'.
* num1 = '12.34'.
* number1 = 25000.
*
* name = 'Satish01'.
* add = '-US789'.
* date = '12345678'.
* time = '160433'.
*
* write : / 'n1 value is', n1,
*
/ 'num1 value is', num1,
*
/ 'number1 value is', number1,
*
/ 'name is', name,
*
/ 'add is', add,
*
/ 'date is', date,
*
/ 'time is', time.
*------------------working with data types accepting user input
*parameters : n1 type i,
**
num1 type f ,
*
number1 type p decimals 2,
*
*
name(6) type c,
*
add type n,
*
date type d,
*
time type tims.
*
*
* write : / 'n1 value is', n1,
**
/ 'num1 value is', num1,
*
/ 'number1 value is', number1,
*
/ 'name is', name,
*
/ 'add is', add,
*
/ 'date is', date,
*
/ 'time is', time.
*---------working with system fields ------------------*
*write : / 'Current Application Server Date is', syst-datum,
*
/ 'Current Local date is', sy-datlo,
*
/ 'Current Application Server Time is', sy-uzeit,
A.V. Krishna
*
/ 'Current
*
/ 'Current
*
/ 'Current
*
/ 'Current
*
/ 'Current
+91 9704886510
Local time is', sy-timlo,
User name is', sy-uname,
logon client is', sy-mandt,
operating system is', sy-opsys,
database is',sy-dbsys.
krishna.saptrainer@gmail.com
A.V. Krishna
+91 9704886510
** write / 'Vowel'.
** when 'I'.
** write / 'Vowel'.
** when 'O'.
** write / 'Vowel'.
** when 'U'.
** write / 'Vowel'.
** when others.
** write / 'Consonent'.
**endcase.
*
**parameters alphabet type c.
**case alphabet.
** when 'A' or 'E' or 'I' or 'O' or 'U'.
** write / 'Vowel'.
** when others.
** write / 'Consonent'.
**endcase.
*
**-----------------------------DO---------------------*
**do 5 times.
** write : / sy-index, 'Welcome'.
**enddo.
*
**do.
** write : / 'Welcome'.
**enddo.
krishna.saptrainer@gmail.com
A.V. Krishna
ENDDO.
WRITE : / 'program'.
+91 9704886510
krishna.saptrainer@gmail.com
*----------------------------------------------------------- WHILE
*data n1 type i value 1.
* write : / 'sy-index value', 'N1 value'.
*while n1 <= 10.
* write : / sy-index, n1.
* n1 = n1 + 1.
*endwhile.
*data n1 type i value 10.
* write : / 'sy-index value', 'N1 value'.
*while n1 >= 1.
* write : / sy-index, n1.
* n1 = n1 - 1.
*endwhile.
*------------------------------DATE calculations---------------*
*data date type sy-datum value '99991122'.
*write : / date.
*uline.
**- changing date
*write : / 'Changing Date' color 3.
*date+6(2) = '01'.
*write / date.
*
*uline.
**- changing month
*write : / 'Changing Month' color 4.
*date+4(2) = '04'.
*write / date.
*
*uline.
**- changing year
*write : / 'Changing Year' color 5.
*date+0(4) = '2013'.
*write / date.
*
*
*uline.
*data date1 type dats.
*date1 = sy-datum.
*write : / date1.
*skip.
*date1 = date1 - 1.
*write : / date1.
*parameters date2 type dats.
*&---------------------------------------------------------------------*
*& Report ZDE_PROGRAM1
*&
*&---------------------------------------------------------------------*
*&
*& working with strings
*&---------------------------------------------------------------------*
REPORT ZDE_PROGRAM1.
*-------------------string comparisions ------------*
if 'SAP AG' CO 'SAP AG'.
* if 'SAP ag' CO 'SAP AG'.
* if 'SAP AG' CO 'SAP AG Ltd'.
* if 'SAP AG Ltd1' cn 'SAP AG Ltd'.
* if 'city' ca 'Ramoji Film city'.
* if ' ' ca 'Ramoji Film city'.
* if 'Z' ca 'Ramoji Film city'.
*if 'Welcome to SAP' cs 'come'.
* if 'SAP R/3' cp 'SAP +/3'.
* if 'SAP R/3' cp 'SAP +/+'.
A.V. Krishna
+91 9704886510
* if 'SAP R/3' cp '*/3'.
* if 'SAP R/3' cp 'SAP */*'.
* if 'SAP R/3' cp 'SAP +++'.
krishna.saptrainer@gmail.com
write : / 'True'.
else.
write : / 'False'.
endif.
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
** endif.
*
**---------------- REPLACE
** replace 'Y' in str1 with 'A'.
** write / str1.
** replace all OCCURRENCES OF 'Y' in str1 with 'A'.
** write / str1.
*
**----------------CONDENSE
** data string1 type string value 'Des
IDEA Pvt ltd'.
** write / string1.
** skip.
** condense string1.
** write / string1.
** skip.
** condense string1 no-gaps.
** write / string1.
*
**----------------------------------------------------------CONCATENATE
** data str3 type string.
*** concatenate str1 str2 into str3.
** concatenate str1 str2 into str3 separated by '*'.
** write : / str3.
*
**--------------------------------------------------------SPLIT
** data : var1 type string value 'ABCD,EFG',
**
var2 type string,
**
var3 type string.
**
** write / var1.
** uline.
** split var1 at ',' into var2 var3.
** write : / var2,
**
/ var3.
*
**-------------------------------------------------OVERLAY
data : name1 type string value 'ABCDEFG',
name2 type string value 'a c e g'.
overlay name2 with name1.
*overlay name2 with name1 ONLY ''.
write : / name1,
/ name2.
*&---------------------------------------------------------------------*
*& Report ZDE_PROGRAM3
*&
*&---------------------------------------------------------------------*
*&
*& working with structures
*&---------------------------------------------------------------------*
REPORT ZDE_PROGRAM3.
*--- declaring structure
data : begin of emp,
no type i value 15,
name(5) type c value 'Kiran',
add(10) type c value 'UK',
doj type dats value '20130215',
end of emp.
*---- assigning value to structure
emp-no = 10.
emp-name = 'Ravi'.
emp-add = 'USA'.
move 20 to emp-no.
move 'Reddy' to emp-name.
move 'India' to emp-add.
*--- display structure content
A.V. Krishna
write : / emp-no,
emp-name,
emp-add,
emp-doj.
+91 9704886510
krishna.saptrainer@gmail.com
A.V. Krishna
+91 9704886510
- ooabap program support this syntax
- nested internal tables are possible
- initial size 0
- type
krishna.saptrainer@gmail.com
tables)
- 3.Line Type : specifies the internal table created on which data type
internal table is created using line type
the components specified in the line type becomes
A.V. Krishna
+91 9704886510
- internal table creation using two table fields
Base Tables must have relationship
Syntax :
DATA : begin of <i table> occurs <m>,
<f1> like <DB table1>-<f1>,
<f2> like <DB table1>-<f2>,
<f3> like <DB table2>-<f1>,
<f4> like <DB table2>-<f2>,
end of <i table>.
krishna.saptrainer@gmail.com
Ex :
DATA : begin of itab occurs 0,
kunnr like kna1-kunnr,
land1 like kna1-land1,
bukrs like knb1-bukrs,
erdat like knb1-erdat,
end of itab.
- internal table creation with ref to entire database table
Syntax :
data <i. table> like <DB table> occurs <m> with header line.
with header line addition creates header line
Ex :
data itab like kna1 occurs 0 with header line.
*--------------------------------------------------------------------------------------*
Standard Index internal table :
- records are mainted in the standard index
- operations can be performed using index
- system uses linear search (or) sequential search to find a record
- always uses non-unique key field of database table
- default and mostly used internal tables
- response time is propotional to the number of entries
- Syntax :
data itab type standard table of kna1 with non-unique key land1 initial size 0 with header line.
Sorted Index internal table :
- records are mainted in the sorted index
- operations can be performed using index
- system uses binary search to find a record
- uses either unique key (or) non-unique key field of database table
- are used if the internal table to be created in sorted order
- response time is propotional to the number of entries
- Restrictions : sort operation is not possible
- Syntax :
data itab type sorted table of kna1 with non-unique key land1 initial size 0 with header line.
Hased internal table :
- records are not maintained using index ( only key )
- operations are possible using only Hashed key
- system uses Hash Algorithem to find a record
- always uses Unique key field of database table
- are used to store large amount of data
- response time is constant regardless of number of entries
- Restrictions : index based operations not possible
- Syntax :
data itab type hashed table of kna1 with unique key kunnr initial size 0 with header line.
- operations on internal table :
1.select
2.append
3.insert
- to fill (or) populate internal table
4.read
5.loop..endloop
- to read records from internal table
A.V. Krishna
6.modify
7.collect
8.sort
9.delete
10.clear
11.clear[]
12.refresh
13.free
+91 9704886510
krishna.saptrainer@gmail.com
- special operations
*-------------------------------------------------------*
SELECT statement is used to fetch (or) retrieve data from database table and populate into target internal table
using SY-SUBRC system field , we can check SELECT statement result immediately
if the SELECT operation is success then sy-subrc value is zero, otherwise 4.
*-----LOOP...Endloop :
- it is a loop used to read multiple records from internal table body
- it reads record by record from body to header line
- Syntax :
LOOP at <body> into <header line>.
"this loop reads all the
records in the body
LOOP at <body> into <header line> from <index> to <index>. "this loop reads records
index based
Loop at <body> into <header line> where <condition>.
" this loop only reads all
conditiona matching records
----<write statement>-----.
Endloop.
*-----------append operation :
- it is used to add additional records at the bottom of internal table
- records are always added at the last (without interrupting existing
- it adds the record from header to body
- Syntax :
APPEND <header line> to <body>.
*-----------insert operation
- it is used to insert particular record at any index
- record gets inserted at the specified index position (it interrupts the
- this operation also happens from header to body
- Syntax :
INSERT <header line> INTO <body> INDEX <index no>.
Note : Insert must followed by Index number, otherwise it leads to
entires)
runtime error
*------------READ operation-----------*
it is used to read single record from internal table body.
it is good practice to check read statement result using subrc statement
- Syntax :
READ TABLE <body> into <header line> INDEX <index no>.
this syntax is used to read a record based on index
- Syntax :
READ TABLE <body> into <header line> with key <condition>.
this syntax reads first occurance of condition matching entry.
condition comparision is case sensitive
- Syntax :
SORT <body> by <field>.
READ Table <body> into <header line> with key <condition> binary
search.
Read statement supports binary search addition
Binary search finds the record quickly
Inorder to use Binary Search addition, table must be sorted first.
- SORT statement is used to sort internal table entries in the specified sorted order
Syntax :
A.V. Krishna
+91 9704886510
SORT <body>.
SORT <body> by <f> <mode>.
SORT <body> by <f1> <f2> <mode>.
krishna.saptrainer@gmail.com
record
body
syntax :
DELETE <body> index <indexno>.
this syntax delete specified index record
syntax :
DELETE <body> from <index> to <index>.
this syntax deletes index matching records
syntax :
DELETE <body> where <condition>.
this syntax delete condition matching records
syntax :
sort <body> by <field>.
DELETE adjacent duplicates from <body>.
this syntax delete duplicate records from the internal table body
Inorder to use this syntax sort internal table first
- COLLECT : statement compares current record with existing record, if system finds any duplicate record ( data
type C must match ), then it removes all duplicate records and also sums up non key field concern ( data type
I,F,P,CURR ) values .
it is useful to elimate duplicates while summing up numeric values.
if system doesn't find duplicate record , it performs append operation
Syntax :
COLLECT <header line> into <body>.
- CLEAR : statement reset record to intial value
Syntax :
CLEAR <header line>.
it is always good practice to clear header line
- CLEAR [] : removes internal table body content
Syntax :
CLEAR <body>[].
- REFRESH : statement removes internal table body content, but
Syntax :
REFRESH <body>.
- FREE : statement removes internal table body content and
Syntax :
FREE <body>.
only
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
*- creating internal table with ref to existing internal table -*
syntax :
data <new itab> like <existing itab> occurs <m> with header line.
*- moving existing internal table content to new internal table -*
move <source itab>[] to <target itab>[].
<target itab>[] = <source itab>[].
*- Appending multiple records from one internal table to another
internal table -*
Syntax :
Append lines of <exisiting itab> from <index> to <index> to <target
itab>.
*- Inserting multiple records from one internal table to another internal table -*
Syntax :
Insert lines of <existing itab> from <index> to <index> into <targe itab> index <index no>.
A.V. Krishna
+91 9704886510
data : <itab> type <table type>,
<wa> type <DB Table>.
*
<wa> like line of <itab>.
krishna.saptrainer@gmail.com
A.V. Krishna
+91 9704886510
*
<wa> like line of <itab>.
krishna.saptrainer@gmail.com
*--------------------------------------------------------------------------------------*
- operations on internal table :
1.select
2.append
3.insert
- to fill (or) populate internal table
4.read
5.loop..endloop
- to read records from internal table
6.modify
7.collect
8.sort
9.delete
10.clear
11.refresh
12.free
- special operations
*-----LOOP...Endloop :
- it is a loop used to read multiple records from internal table body
- it reads record by record from body to work area
- Syntax :
LOOP at <body> into <work area>. "this loop reads all the
records in the body
LOOP at <body> into <work area> from <index> to <index>. "this
based
Loop at <body> into <work area> where <condition>.
" this
matching records
----<write statement>-----.
Endloop.
*-----------append operation :
- it is used to add additional records at the bottom of internal table
- records are always added at the last (without interrupting existing
- it adds the record from work area to body
- Syntax :
APPEND <work area> to <body>.
*-----------insert operation
- it is used to insert particular record at any index
- record gets inserted at the specified index position (it interrupts the
- this operation also happens from work area to internal table
- Syntax :
INSERT <work area> INTO <internal table> INDEX <index no>.
entires)
runtime error
*------------READ operation-----------*
it is used to read single record from internal table body.
it is good practice to check read statement result using sy-subrc
statement
- Syntax :
READ TABLE <itab> into <work area> INDEX <index no>.
this syntax is used to read a record based on index
- Syntax :
READ TABLE <itab> into <work area> with key <condition>.
this syntax reads first occurance of condition matching entry.
condition comparision is case sensitive
- Syntax :
SORT <body> by <field>.
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
READ Table <itab> into <work area> with key <condition> binary
search.
Read statement supports binary search addition
Binary search finds the record quickly
Inorder to use Binary Search addition, table must be sorted first.
- SORT statement is used to sort internal table entries in the specified sorted order
Syntax :
SORT <itab>.
SORT <itab> by <f> <mode>.
SORT <itab> by <f1> <f2> <mode>.
Sort operation happens directly on internal table body
Sort always by specifing the fieldname
<mode> specifies sorted mode ie., Ascending / Descending
default mode is Ascending
- MODIFY statement is used to modify existing record by current
record
body
syntax :
DELETE <body> index <indexno>.
this syntax delete specified index record
syntax :
DELETE <body> from <index> to <index>.
this syntax deletes index matching records
syntax :
DELETE <body> where <condition>.
this syntax delete condition matching records
syntax :
sort <body> by <field>.
DELETE adjacent duplicates from <body>.
this syntax delete duplicate records from the internal table body
Inorder to use this syntax sort internal table first
- COLLECT : statement compares current record with existing record, if system finds any duplicate record ( data
type C must match ), then it removes all duplicate records and also sums up non key field concern ( data type
I,F,P,CURR ) values .
it is useful to elimate duplicates while summing up numeric values.
if system doesn't find duplicate record , it performs append operation
Syntax :
COLLECT <work area> into <itab>.
- CLEAR : statement reset record to intial value
Syntax :
CLEAR <work area>.
it is always good practice to clear work area content
- CLEAR <itab> : removes internal table body content
Syntax :
CLEAR <itab>.
- REFRESH : statement removes internal table body content, but
A.V. Krishna
Syntax :
REFRESH <itab>.
+91 9704886510
krishna.saptrainer@gmail.com
only
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
data : itab type standard table of kna1 with non-unique key land1 initial
wa type kna1.
size 0,
data : itab type sorted table of kna1 with non-unique key land1 initial
wa type kna1.
size 0,
data : itab type hashed table of kna1 with unique key kunnr initial size
wa type kna1.
Syntax :
data : <internal table> type [<tabletype>] table of <linetype> [with
<work area> type <line type>.
0,
TABLE TYPE :
- specifies classfication of internal table
- can be Standard Index, Sorted Index, and Hased
- can be defined as local (or) global
- local table types are defined by TYPES keyword (datatype)
local table types are defined with in the program and used with in
local table types scope is local
local table types are used while creating data object , internal table
- global table types are created by navigation in ABAP Dictionary
global table types are defined centrally in DDIC and it is valid for all
global table types scope is global
global table types are used while creating data object, internal table
- Data types
Data Objects
- elementary data types -> variables
- structure types
-> structure
- table type
-> internal table
are defined by TYPES
are declared by DATA keyword
keyword
no memory allocated
the program
programs
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
*--------------------------------------------------------------------------------------*
Type Group :
- is also called as Type Pool
- belongs to program type 'T'
- is a collection of Types and Constants
- is also Repository Object
- User defined Type Group name begins with Y or Z
- Type group name can be maximum 5 characters
- All the Type group components name should begin with 'Type group name_'
- Type Group defined and activated as global in ABAP Dictionary
which is valid to use in any program (or) global class
- Inorder to use global type group in ABAP Program, we have to introduce type grop name in the declaration
section using syntax :
Type-pools <Type group>.
- we can create data objects(variables, structure, internal tables) in the program using Type group components
- Steps to create Type group
- go to SE11
- select Type group radiobutton
- specify type group name begins with Y or Z
- click on create
- specify short description
- save as local object ( editor appears )
- define required elementary data types, structures types, table types
and constants
- save, check, activate
A.V. Krishna
+91 9704886510
-----<st block>-----.
Endat.
it executes end of particular field value
it may exist multiple times with in the loop
it is used to print sub total
krishna.saptrainer@gmail.com
4.At last.
-----<st block>----.
Endat.
it executes end of the report
it terminates the loop
it is used to print grand total of field
it exist only one time
5.SUM.
it is used to calculate sub total (or) grand total for numeric
it can be used for multiple times
6. on change of <field>.
-----<statement>-----.
else.
------<statement>-----.
endon.
this is alternative for at new
it also executes whenever the field value changes
Difference between At new and On Change .
At New :
- doesn't support else part
- only used in loop...endloop
On Change :
- support else part
- can be used in any loop
columns
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
another macro.
statement.
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- recursive includes not possible
- parameter passing not possible between include and calling
- Includes classification :
Include <program>top.
"global declarations
Include <program>i01.
"PAI modules
Include <program>o01.
"PBO modules
Include <program>f01.
"subroutines
Include <program>e01.
"events
Include <program>u01.
"user-exits
program
- Procedures :
Procedures contain a set of statements, and are called from other ABAP programs
- Subroutine :
- is also called as routines (or) forms
- it is a set of statements, which performs unique operation
- it is a procedure, mainly used for local modularization
- Subrouitne definition begins with FORM keyword and ends with
- Syntax to define Subroutine :
FORM <subroutine>.
-----<statement block>----.
ENDFORM.
- Subroutines are called by PERFORM statement
Syntax of PERFORM statement :
PERFORM <subroutine>.
ENDFORM keyword.
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
1.Pass by Reference :
In case of pass by reference, while subroutine call formal parameters are created as a copy of actual
parameters.
Formal parameters doesn't contain special memory, but inturn they points to the address of actual parameters
Any changes done to formal parameters have immediate effect on
actual parameters
USING and CHANGING keywords acts like same.
2. Pass by Value :
In case of pass by value, while subroutine call formal parameters
are created with its own memory.
Formal parameters have separate memory.VALUE keyword creates
separate memory
Any changes done to formal parameters have effect on formal
parameters only ( no effect on actuals )
3. Pass by Value and Result :
this is also pass by value, but it is used to return the operation result
retains
*--------------------------------------------------------------------------------------*
Function Module :
- is a procedure, which accepts (imports) values and perform operation and returns(exports) values to calling
program.
- SE37 : tcode for Function Builder
- Using Function Builder Function Groups and Function Modules are
created
- Function Builder is closely integrated with ABAP Development Workbench
- Step1 : Function Group Creation
Step2 : Function Module Creation
- Function Group :
- is also called as Function Pool (or) Function Library
- it belongs to program type 'F'
- F.Group is not self executable
- F.Group is independent Repository Object
- F.Group is a collection of similar functionality of Function Modules
- F.Group is also collection of Screens, Modules,
Includes,Subroutines...etc.,
- path to create function group :
go to tcode SE37
goto menu -> Function Group -> create group
specify function group name begins with Y or Z
specify short description
save as local object
Activating Function Group :
goto menu ->Function Group -> Display Group
notice that Function Group status is inactive
click on main program
double click on top include , activate it, back
activate functionpool program, back
now notice that Function Group is Active
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- Function Module :
it is an independent program, which performs unique operation
F.Module also independent Repository Object
Every F.Module belongs to one Function Group
Similary Functionality of Function Modules logically grouped under
Function Group
F.Module can be created, activated, released
F.Modules are implemented as External Subroutines
F.Modules are mainly used for Global Modularization
F.Modules are created independetly under F.Group, which are valid to call and use in any program
One F.Module can be called in multiple programs (Reusablity)
Once F.Module is created and activated , it can be called in any Executable program.
- Syntax to call Function Module :
call function '<function module>'
.
- Function Modules are used to perform operations
we can perform simple and complex operations using parameter
interface.
While defining function module , we can define import, export,changing parameters and tables, exceptions also
Business Scenario1 : working with Import and Export tabs
- specify function module name begins with Y or Z
- click on create
- specify function group and short text , continue
- define import parameters under import tab
n1 type i
n2 type i
- define export parameters under export tab
res type i
- specify logic under source code tab ( between function
...endfunction)
res = n1 + n2.
- save, check, activate, test Function Module.
- Usage of Function Module in ABAP Executable Program :
- declare actual parameters
- call function module
- pass actual parameters
- display output
Note : Function Module can be defined with out interface also
if F.Module consist of Write statement, its result is displayed in
list screen.
Function Modules :
zde_fmodule - pass by ref example
zde_fmodule1 - pass by value example
zde_fmodule2 - no parameter interface (write statement)
zde_fmodule3 - working with changing tab (pass by value and result)
zde_fmodule4 - tables tab with all table fields , with select statement
zde_fmodule5 - tables tab with all table fields, without select , only
zde_fmodule6 - tables tab with required fields
display
can be called
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
3.Update Function Module : is used to modified record to database
table, while updating it uses VB*
temporary tables
Update can be done - immediately
- delayed
- collective update
Import tab : is used to define import parameter
import parameters acts like formal parameters, which
imports(accepts) the value from calling program and
pass to
source code
import parameter name should begin with ip_
import parameter can be defined using associate type as
- predefined type
- dicationary type
- data element / structure-component / table type
- database table-field / view-field
- global class / global interface
if optional check box is checked , this parameter appears as
comment , wherever it is called
we can provide default value, short text and long text also
Export Tab : is used to declare export parameter
export parameters acts like formal parameters, which
program
- Nested Function Modules are not possible, but one function module can call another function module
- Recursive Function Module leads to runtime error
- Changing Tab : is used to declare both import and export parameters
it is used for pass by value and result
- Tables Tab : is used to define internal table with in the function
Internal Tables can be defined as Formal parameters using
Internal Tables can be passed to Function Modules always as
module
Tables tab
Pass by Ref
modules
code logic
of function module
between function .....endfunction.
table types) and declare local data objects (
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
Develop a FM which accpets S.org,Dist.Channel, Division ,fetches its corrsponding data from knvv database table
and display output
- Exploring Function Module :
date_to_day : it provides name of the day for the given date
spell_amount : it converts currency values into corresponding text
Amount_string_convert : it converts amount string into currency
convert_to_local_currency : it translate foreign currency amount to
convert_to_foreign_currency : it Translate local currency amount
currency
calculate_exchange_rate : Find Rate Based on Amounts, Currency
(in words)
values
local currency
into foreign
Keys and Date
interface not
possible)
interface
(parameter passing
***********************************
Messages : are used to know any operation result , while working with
SAP
Messages are created under message class
Message class tcode : SE91
Message class is independent Repository Object
Message class is a collection of messages
M.Class consist of Message number and corresponding Message Text
Message Number is represented as 3 digit number
Valid Message Number range is 000 to 999
we can create 1000 messages per class
Message Text can be 73 characters length, which consist of
alphanumeric and special symbols also.
Text Symbols are program dependent, but Message class messages are created as Global independent objects,
which are valid to use in ABAP Programs, Function Modules, Forms, Screens,Global Classes and Global Interfaces
- Types of Messages :
Type I - Information Message
Type S - Success (or) Status Message
Type E - Error Message
Type W - Warning Message
A.V. Krishna
+91 9704886510
Type A - Abort (or) Abend Message
Type X - Termination Message
krishna.saptrainer@gmail.com
green
Warning Message : is also displayed in the status bar of special screen with red color, it doesn't allow to proceed
futher screen.
Abort Message : is displayed as cancel dialog box with stop red color icon, it stops process, and exit the process
control
transfer to SAP Easy Access.
it restarts whole process
Termination Message : leads to runtime error
it abnormally stops processing and system
Short dump is a special screen, which displays runtime error
ST22 tcode to analyse short dump
statement)
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
Pretty print tab is used to set program indetation , code gets modied
as per standard
- ABAP Dictionary,
Data Browser,
BAdI builder,
Function Builder,
Logical database Builder,
Class Builder,
Adobe forms builder
..etc.,
- it is used to navigate object to object ( using Edit object option )
- using one screen, we can view all pacakges concern objects,
all function group concern objects, and local objects...etc.,
- objects can be created, changed, displayed, and deleted also.
- it supports to develop BSP / Web Dynpro Applications
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
Packages can be created by BASIS consultant , using Package
Builder(SE21) (or) ABAP Development Workbench
Custom Package creation :
- go to tcode SE21
- specify package name begins with Y or Z
- click on create
- specify short description
- specify application compont and software component ( HOME )
- speciy transpor layer
- specify package type ( not a main package )
continue
system proposes local workbench request dialog box
click on create request
system opens another screen ( specify current activity concern
client)
save
continue.
Note : now on wards , we can save developed objects in Custom
Quality (or)
Production box.
2.Customizing Request :
it is generated at Fucntional level
while configuration, whenever new data is created in SAP, then
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
specifying description
open SQL :
-
Native SQL :
- statements are special commands written with respect to database
- statements by pass ABAP Workbench and buffer (Application layer)
- are not converted by database interface
- are database dependent statements
- are so powerful, and rarely used commands
- syntax to define native SQL statements
EXEC <SQL>.
---<native SQL>---.
Endexec.
- statements doesn't follow ABAP Editor standard rules
- SELECT statement basic syntax :
SELECT <required fields>
INTO <target area>
FROM <database table>
[ where <condition1>]
A.V. Krishna
+91 9704886510
[ group by <field>]
[ having <condition2>
[ order by <field> <mode>].
krishna.saptrainer@gmail.com
- it is always good practice to check sy-subrc statment immediately after every open SQL operation
if the open SQL operation is success then system return code value 0, otherwise 4.
- sy-dbcnt system field provides count of database records
which can be used to check open SQL statment result.
- select * statement
fetches all rows and all columns from the database table
- select <f1> <f2> <f3> statement
fetches required fields from database table
specify field order as per the database table order ( sequence ) , to
addition
into corresponding fields - it fetches the data from database table
fields
( it compares source field name and target field name )
OR, NOT)
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
select <f1> <f2> <f3> from <DB table> into ( f1, f2, f3 ) where
<conidtion>.
if condition is not specified system fetches first record values
- select single * :
is used to fetch single record from database table
if condition is not specified it fetches first record
- if at all we want to fetch data from more than 1 database table,
we can use
- inner join
- left outer join
- inner join fetches the common data exist in both tables
it fetches data based on join condition
join condition is defined using common keyfields of both tables
- left outer join fetches entire left side table entries , irrespective of
Syntax :
select <alias>~<field1>
<alias>~<field2>
------------------------------------into table <target internal table>
from <DB table1> AS <alias>
inner join
<DB table2> AS <alias>
ON <alias>-<keyfield> = <alias>-<keyfield>.
we can use table names directly instead of using Alias
Alias is alternative name for Database Table
- Alternative for inner join select statement is, usage of Database View
- we can internal table on Database Views
- FOR ALL ENTRIES :
it is alternative for nested select statement
it is used while populating current internal table by comparing existing
internal table entries
it is special select statement, where it compares database table
entries are compared with internal table
entires.
it can't be used to fill first internal table
it is used to fill other internal tables while comparing with existing
internal table
it must followed by where condition
condition must be specified by keyfield comparision
Prerequisite : initial internal table should not be empty
check the status of initial internal table
- Working with Complex Report (or) Working with many database
Steps :
- Identify the data (fields) required by End user
- Identify the data from single database table (or) multiple tables
- Identify table relationship
tables :
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
*********************************************************************
INSERT open SQL statement :
- it is used to create a new record in the database table
- we can check the result using sy-subrc statement immediately
- inserting single record using work area
work area must be declared using database table.
specify new record using work area components
Use below syntax to insert record :
INSERT <Database Table> from <work area>.
Insert into <Database Table> values <work area>.
- Inserting several records in the database table
declare internal table and work area in the program
append new records to internal table
Use following syntax to insert records from internal table :
INSERT <Database Table> from table <Internal Table>.
*********************************************************************
UPDATE open SQL statement :
- it is used to update database table records
- if existing database table consist of blank values (or) incorrect values,
using UPDATE statement we can enter new values for blank records,
we can rectify incorrect values.
- MODIFY is also another open SQL statement, which also used for update purpose.
it will update if record found, otherwise it creates new record
Syntax :
UPDATE <Database table> SET <field> = 'value' where <condition>.
matching records
Syntax :
UPDATE <Database table> from <work area>.
this syntax is used to update single record
Syntax :
UPDATE <Database table> from table <internal table>.
this syntax is used to update several database records.
*********************************************************************
DELETE open SQL operation :
- is used to delete records from underlying database table
Syntax :
DELETE FROM <Database Table> WHERE <cond> .
this syntax delete condition matching records
Syntax :
DELETE <Database Table> from <work area>.
this syntax is used to delete single record from database table
Syntax :
DELETE <Database Table> from table <internal table>.
this syntax is used to delete severl records from database table
***********************************************************************
The SELECT statement bypasses the buffer when you use any of the following:
The BYPASSING BUFFER addition in the FROM clause
The DISTINCT addition in the SELECT clause
Aggregate expressions in the SELECT clause
Joins in the FROM clause
The IS NULL condition in the WHERE clause
Subqueries in the WHERE clause
The ORDER BY clause
The GROUP BY clause
The FOR UPDATE addition
*********************************************
Mathematical Functions
Function
A.V. Krishna
Result
+91 9704886510
krishna.saptrainer@gmail.com
ABS
Absolute value of argument.
SIGN
Sign of argument:
1X>0
SIGN( X) = 0 if X = 0
-1 X < 0
CEIL
Smallest integer value not smaller than the argument.
FLOOR
Largest integer value not larger than the argument.
TRUNC
Integer part of argument.
FRAC
Fraction part of argument.
************************************************************************
Field-Symbol :
- are place holders for data objects
- doesn't reserve memory , but they points to existing variables
- implements dereferenced pointer concept of 'C' language
- points to the value of variable, which is assigned to it.
- Syntax to declare Field-Symbols :
Field-Symbols <FS>.
Angle brackets are part of syntax
- using ASSIGN keyword we can assign variable to Field Symbol
Syntax to assign variable to field symbol
ASSIGN var to <FS>.
then <FS> points to the value of var at runtime.
- Field Symbols are mainly used for Dynamic Memory Management
- we can assign data objects ( variables, structures, internal tables ) to field symbols.
**************************************************************************
***********************************************************************
- write is used to display output
- Syntax :
write : /<col_pos> '------<text>----------'.
- write statement supports color addition
7 color ids are possible (1...7)
- skip statement provide one blank line in the output
- uline statement provides under line the output
- sy-vline system field provide verticle line
- write statement with left-justified addition provides output as left
centered addition display output as centered
right-justified display output as right justified
- Syntax :
write : / <var> [left-justified][centered][right-justified].
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- providing output without gap
write : / <var1> no-gap, <var2>.
it displays two variable values with out gap
no-gap addition removes explicit gap between strings
- providing output one under another
Syntax :
write : /<col_pos> <var1>,
/ <var2> under <var1>.
- no-sign addition removes sign for integer values
- no-zero removes leading zeros for character values
- no-decimal removes decimals
- printing date as per our own format using syntax :
write / <date> using edit mask '__/__/____'.
- printing time as per own own format using syntax :
write / <time> using edit mask '__/__/__'.
FORMAT color <id>.
this syntax provides specified color <id> for followed by write
statements.
statements.
Requirement ( FS)
Programming standards
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
Phase3 Activities
: Check Performance Tuning
-> output must meet business requirement
-> check performance with system point of view
-> check your program against check list ( Code Review Lead)
follow coding standards, naming
creation
-> relase task/object
done by
conventions,modularity, tcode
Consultant
screen, dialog
the program
system (ABAP processor) gives top priority to events over general statements
Events are executed by the system on priority basis
Events are not processed as per the typed sequence
- Selection-screen events :
1.LOAD-OF-PROGRAM.
- is implicit event triggered by the system while executing program
- it loads program into context area
2.INITIALIZATION.
- it is triggered by the system , before displaying selections-screen
- using this event, we can provide default values to selection-screen fields
3.AT SELECTION-SCREEN OUTPUT.
- it is triggered by the system,after INITIALIZATION event and
before displaying selection-screen
- it provides default different attributes to selection-screen fields
4.AT SELECTION-SCREEN.
- it triggers after user interaction on selection screen
- it performs two activities
- autorization checking
- validate user input
5.AT SELECTION-SCREEN ON <f>.
- it triggers when the user interacts with particular field in the
- it is used to validate particular field
selection screen.
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
9.AT SELECTION-SCREEN ON RADIOBUTTON GROUP <radi>.
- In the PAI event of the selection screen
- it is triggered when the contents of all of the fields in a radio button
group are passed from the selection
screen to the ABAP program.
10.AT SELECTION-SCREEN ON HELP-REQUEST FOR <field>.
- it is used to provide F1 help docuementation to selection-screen
- it triggers , when the user press F1 key of field
field.
- **********************
List Screen Events :
1. START-OF-SELECTION.
- it is implicit default event, triggred by system for all executable
- it triggers before displaying list screen
- it consist of data fetching logic
programs
2.END-OF-SELECTION.
- it is triggered after START-OF-SELECTION event
- it triggers once the data selection is over
- it is used to display output to list screen
3.TOP-OF-PAGE.
- it provides header information to list screen
- it is triggered by first write statement,skip (or) uline statement.
4.END-OF-PAGE.
- it provides footer information for page
- it is triggered by LINE-COUNT addition along with REPORT
statement.
A.V. Krishna
+91 9704886510
- created a program (zde_classical_list)
created tcode (zclist_tcode)
tested tcode
krishna.saptrainer@gmail.com
field
input fields
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- parameters doesn't support float data type, we can't accept float data type values from user.
- Basic Syntax of Parameters Keyword
Parameters <f> type <data type>.
Parameters <f> like <DB Table>-<field>.
parameter field name should begin with p_
parameter field name can be up to 8 characters
Alternative Long text can be provided for parameter field using
Selection text is a part of Text Element
selection text
default addition along with parameters is used to provide default value to selection screen field
syntax :
parameters <f> type <data type> default 'value'.
parameters with obligatory addition is used to make selection screen field as required entry (or) mandatory field.
syntax :
parameters <f> type <data type> obligatory
In general user entered character values are converted to upper case
by default.
but parameters with lower case addition is used to suppress auto conversion of lower case values to upper case.
As a result, lower case values are displayed in lower case only.
syntax :
parameters <f> type <data type> lower case.
parameters with no-display addition is used to suppress particular field in the selection screen. that field is not
visible in the selection screen.
syntax :
parameters <f> type <data type> no-display.
parameters with visible length addition is used to specify input field length to be displayed in selection screen.
syntax :
parameters <f> type <data type> visible length '<len>'.
selection screen.
- generating radiobuttons :
syntax :
parameters : <f1> radiobutton group <grp>,
<f2> radiobutton group <grp>.
radiobutton name begins with rb_
at least two radiobuttons defined under one group
using default 'X' , we can select that radiobutton while loading the
selection screen.
- Note :
check boxes are provided to user, where user can check nothing (or) user can check all (or) user can check any
one or required options
radiobuttons are provided to user, where user can select one option out of several options under one group
by default first radiobutton is selected by system automaticaly.
VARIANT : is used to provide default values to selection screen.
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
pre defined (or) pre configured values of selection screen can be saved as Variant.
we can create one or many variants to selection screen
Each variant provides different set of values.
Selection screen is required to create variant
Standard Selection screen number is 1000.
Steps to create variant :
- execute program
- specify different values to selection screen fields
- click on save
- specify name and meaning , type of variant
save, back
- notice that system enabled get variant option in selection screen
- using get variant option, we can choose any variant from the list of
variants
Syntax :
parameters <f> like <DBtable>-<f>.
parameter field is created with ref to DB Table field, As a result technical attributes(data type, length) and semantic
attributes ( field label, F1 help documentation, F4 help) are copied selection screen field.
Alternative syntax ;
parameters <f> type <DBtable>-<f>.
next
A.V. Krishna
- F4 help
- output only
- intensified
etc.,
+91 9704886510
krishna.saptrainer@gmail.com
- SCREEN is built-in global structure which provides different attributes screen fields.
- SCREEN is built-in internal table ( system data object ) ,which
provides different attributes to screen fields
- SCREEN is like an internal table with a header line.
using following syntax we can set default attributes to screen fields
under AT SELECTION-SCREEN OUTPUT event.
loop at screen.
if screen-name = '<field>'.
screen-<attribute> = '1' or '0'.
modify screen.
endif.
endloop.
- by specifying loop statement for SCREEN internal table, we can
fields.
profile )
user
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
select-options <f> length can be up to 8 characters
using Selection Text , we can provide alternative long text for
options <f>.
- system(ABAP interpreter) can't recognize table field automatically
- Inorder to tell the system regarding table field, we have to declare
keyword.
- syntax :
Tables : <DBtable1>, <DBtable2>.
- Tables keyword works like interface work area
- Tables keyword loads the Data Dictionary Structure as work area
- As a result, One work area gets created on RAM, with the database
select-
table name
- Advantage of select-options :
system displays multiple selection icon in the selection screen, which is useful to set include single / range of
values, to set exclude single / range of values according user choice. (without changing select
query in the
source code )
- default addition along with select-options is used to provide default values to selection screen field
- no-display addition along with select-options is used to suppress the visibility of field in the selection screen
- no-extension addition along with select-options is used to suppress
screen
As a result , user always select only one range of values.
extended selection is not possible
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- no intervals addition along with select-options is used to suppress
upper limit value, but multiple selection icon
is avilable
As a result, user can choose single (or) range of values of field
range of values can be set using multiple selection option
*****************************************************************************
write statement, uline, and skip statement generates list screen
NOTE :
- RANGES keyword also used to create internal table with sign,option, low and high values.
- RANGES keyword doesn't generate selection screen
- Push buttons, Tab strip control , subscreens also possible Selection screen.
Inter program communication :
- this topic deals with program to program communication
- SUBMIT statement is used to executable program in another
Syntax :
SUBMIT <program>.
- Syntax :
SUBMIT <program> and return.
this statement calls executable program and while returning it
- Synatx :
SUBMIT <program> via selection-screen.
this statement calls executable program and its selection screen also.
- Syntax :
call transaction '<tcode>'.
this statement is used to call any existing tcode
while executing this statement, control transfer to specified
current program.
- Syntax :
leave to transaction '<tcode>'.
this statement calls specified tcode and while returning control
- SAP Memory :
it is common memory shared by all external sessions
SAP Memory can be shared using SET / GET parameter statements ( SPA and GPA staments )
SET parameter statement reads a value from one session and places into SAP Memory
GET parameter statement reads a value from SAP Memory to
another session.
Syntax :
SET parameter id '<PID>' field <f>.
GET parameter id '<PID>' field <f>.
parameter id can be defined at DATA Element level :
path to view parameter id :
go to tcode : SE11 -> open data element in display mode -> further
parameter id
Field name
KUNNR
MATNR
LIFNR
VBELN
EBELN
BUKRS
Werks_d
Parameter Id
KUN
MAT
LIF
AUN
BES
BUK
WRK
- Using parameter ID ,we can provide default value to dialog screen, under user profile.
menu path to set default value for parameter ID :
system menu -> user profile -> own data
-> parameters tab
specify parameter ID and its value
BUK - 1000
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
EKO - 0001
KGK - 0002
- TPARA table consist of all Parameter ID
- custom parameter ID also possible
while creating Custom data element we can create custom
specify custom parameter ID name begins with Y or Z
EX : ZEID
double click on parameter id , specify short text
activate data element.
parameter ID
- ABAP Memory : is a common memory , shared by all internal sessions of an external session
using EXPORT and IMPORT statement ABAP memory can be shared between session.
EXPORT statement exports the field value from one internal session to ABAP Memory
IMPORT statement imports the field value from ABAP Memory to
Syntax :
EXPORT <f> [FROM <gs>] TO MEMORY ID <key>.
IMPORT <f1> [TO <gs>] FROM MEMORY ID <key>.
Interactive List :
- Classical List is used to display required all columns in the list screen
- Interactive List is used to display required columns in the basic list, and based on user interaction it displays
corresponding details in the detail list
- 1 basic list + 20 secondary lists are possible
- it is also called as Drill down list (or) detail list (or) secondary list
- sy-lsind is a system field , which provides index of interactive list
- sy-lsind value for basic list is zero and for secondary list1 is 1 and so on....
- Secondary lists are genererated by Events
- Events used in Interactive List :
1.AT LINE-SELECTION.
it triggers after user interaction on basic list (when user interacts
on a
row)
it consist of logic to generate secondary list
2.TOP-OF-PAGE during LINE-SELECTION.
it also triggers when user interacts on basic list
it provides header information to secondary lists
3.AT USER-COMMAND.
it triggers when the user issue commands on basic list ( using
it also triggers when user interacts on STATUS(menu) of list
it also consist respective logic to handle user action
command field)
screen
A.V. Krishna
+91 9704886510
demo_list_at_pf
krishna.saptrainer@gmail.com
HIDE :
- is a statement
- it hides the row information (which is interacted by the user)
into HIDE area , to display further details in
the next list
- it must be used with in loop
- it muse be after write statement
- syntax :
HIDE <f>.
- Hide must followed by key field
- it moves the user interacted row information from internal table to work area
- it works on row basis ( regardless of cursor position )
when user interacted on a row of basic list ( double click (or) F2 )
then PICK function code triggeres AT Line Selection event.
GET Cursor :
- statement is alternative for HIDE
- it also used to generate interactive list
- it works on cursor position based
- it is used to read particular column(field) value
- syntax :
GET CURSOR FIELD <f> [OFFSET <off>]
[LINE <lin>]
[VALUE <val>]
[LENGTH <len>].
- System Fields used in Interactive List :
sy-lilli : provides absolute line number where user interacted
sy-lisel : provides the content user interacted line
sy-ucomm : it consist of command enterd by the user
sy-pfkey : provides current GUI status
sy-title : provides title of current program
sy-linno : current line number
sy-colno : current column number
sy-listi : provides index of list, where last user interacted
ALV :
- ABAP List Viewer
- it is also called as SAP List Viewer
- it is reporting technique used in ABAP
- using ALV, we can display simple and complex reports also
- ALV Reporting is possible as two ways :
- Procedural ALV :
- reports are generated by using Globle Type Group(SLIS)
and Function Modules( REUSE_ALV )
- OOALV :
- reports are generated using Global Class ( CL_GUI_ALV_GRID )
and Methods ( Set_table )
- Limitations of Classical Reporting :
- automatic column heading display not possible
- automatic back ground color display not possible
- output display column positions must be specified
- automatic column width is not possible
- automatic all columns display not possible
- Advantage of ALV :
- ALV output is displayed with special application tool bar
which consist of severla options like
- sorting (ascending/ descending)
- detail display
- save output as Excel / word / RTF format / HTML / clipboard
- change layout settings (hide columns / display columns)
- perform grand total and sub total
- navigation buttons
- first column
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- previous column
- next column
- last column
- set filter ( specify required values )
- Types of Possible Reports using Procedural ALV
1.Simple ALV List
2.Simple ALV Grid
3.ALV Fieldcat List
4.ALV Fieldcat Grid
5.ALV List - Fieldcatalog merge
6.ALV Grid - Fieldcatalog merge
7.ALV Event List
8.ALV Event Grid
9.ALV Block List
10.ALV Hierarchical List
11.ALV Interactive List
12. ALV Interactive Grid
1.Simple ALV List :
it is used to display database table data(all columns) in list screen
steps :
1.declare internal table and selection screen
2.populate internal table using select statement
and
3. to display final output call SAP defined function module
'REUSE_ALV_LIST_DISPLAY'.
uncomment exporting and pass database table
name as
i_structurename
pass internal table name for tables parameter
this function module functionality is , it writes either single line or
'REUSE_ALV_GRID_DISPLAY'.
i_structurename
module
code of program
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
'REUSE_ALV_FIELDCATALOG_MERGE'.
data
required format
'REUSE_ALV_LIST_DISPLAY'
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
this function module is used to pass logo ( using this option we can
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
it is used display required data on basic list, based on interaction on basic list it generates secondary list (or) detail
list
detail list displays user interacted row corresponding data
to handle user interaction on basic ALV list, we have to use USER_COMMAND event.
when this event triggers control transfer to corresponding subroutine.
we can generate detail list as 3 ways
- user interacted index based
- user interacted fieldname based
- user interactef field value based
Syntax of subroutine to be passed for USER_COMMAND event.
form <subroutine> using rs_ucomm like sy-ucomm
rs_selfield type slis_selfield.
endform.
this subroutine is defined with 2 formal parameters
rs_ucomm is declared with sy-ucomm, which is used to handle user command ( double click - F2 )
rs_selfield is is declared with SLIS component SLIS_SELFIELD
- SLIS_SELFIELD consist of
tabindex - is used to read record based on internal table index
value - is used to read record based on field value , where user
fieldname - is used to read record based on fieldname, where
interacted
user interacted.
while working with function modules read documenation ( goto menu -> documenation) and implement
SAP provided description and possible values as do
cumentation
Fieldcat options :
col_pos : field appearing column position in the list
value set : 0, 1-60
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
element
grand total
completely.
- zebra
value set: SPACE, 'X'
'X' = striped pattern (e.g. for wide lists)
- box_fieldname
value set: SPACE, internal output table field name
to display checkbox for all the rows
NOTE : ALV output supports Layout Management
while displaying final output by function module
we have to specify i_save as 'X' , to enable save layout option
-
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
display
information also
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
routines
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
LDB name can be attached in Attribute screen of ABAP program
create
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
specify program name starting with Y or Z
click on create
specify title , type as Executable , specify LDB name
save as local object
- Sequence of events in LDB program :
start-of-selection.
get
get late
end-of-selection.
- get <node>.
this event triggers corresponding subroutine exist in LDB database program.
PUT statement reads the data from database node
and sends to work areas defined in program
- get <node> late.
this event triggers late, after processing all subnodes under main node and before branching to another main
node
this is useful to calculate sub total / grand total
- LDB nodes can be terminated conditionlly using CHECK statement
and uncoditionally using STOP statement.
- Difference between Exit and Stop ?
Exit is used to terminate loop
Exit always terminates current loop and procedes further
Stop is used to terminate LDB Nodes
Stop stops the processing immediately, and control transfer to End-of-selection.
- Note : using LDB_PROCESS function module , we can use several LDBs in one executable program
cb_
pb_
gif_
A.V. Krishna
import parameter
import structure
import internal table
export parameter
-
+91 9704886510
it_
krishna.saptrainer@gmail.com
i_
is_
e_
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
program
statements
*******************************************************************
- Runtime Analysis :
- tcode : SE30
- menu path from any screen : system menu -> utilities -> runtime
- menu path from ABAP Editor : program menu -> execute ->
- it is used to analyse the performance of Tcode (or)Function
- Steps :
specify program name
click on execute button
system executes program output, back
As a result, this tool measures the program parameters at
program check
***********************************************************
SQL Trace :
- Tcode : ST05
- Menu path from any screen : system menu -> utilities -> performance trace
- it is used to analyse SQL statements involved in program
- by default all traces are switched off
- we can activte trace for user specific and program specific
- Steps :
Activate Trace with filter
- execute program parallel
Deactivate trace
and display trace
result is displayed as trace
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
table/view
between instances.
**********************************************
SAP Code Inspector :
- tcode : SCI
- menu path from Easy Access : SAP Menu -> Tools -> ABAP Workbench -> Test -> SCI
- menu path from any ABAP Editor screen : program menu -> check
-> code inspector
->
->
->
->
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
- sequence of program execution steps,
- sequence of events triggering,
- how values are passed to variables, work areas
- how internal tables are populated
- values of system fields
- it is useful tool to resolve runtime errors and configuration errors
Different Ways of calling Debugger :
- /h in command field
- break-point statement in program
- menu path from any screen :
system menu -> utilities -> debug screen/ program
- menu path from ABAP Editor initial screen :
program -> execute -> debugging
(or) click on Debugging tab
- path form ABAP Program screen :
program -> test -> debugging
Types of Debugger :
1.Classic Debugger
2.New Debugger
- menu path to set default debugger from Editor
utilities menu -> settings -> ABAP Editor -> Debugging tab -> choose classic/ new debugger
- we can swith between classic to new debugger and vice versa using menu path
- debugging menu -> debugging off
-> exit debugger
this path is used to close debugging
- Classic Debugger :
Common options (icons) for all tabs
F5 - Single Step : it is used to analyse program code as step by step
F6 - (Execute) : it is used to execute modularization units (
(line by line)
display output
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
it is a signal in the source code, where system stops execution and
starts debugger
once system come across break point , system enables debugger
and rest of code executed in debugging
mode
Break point can be set as 2 types :
Static Break Point
Dynamic Break point
Static Break point can be set using below syntax :
break-point.
break-point <n>.
break-point <username>.
Ex :
break SAPUSER.
break-point sy-uname.
break-point 'SAPUSER'.
static break points are user speicific
Static break points are not advisable, because they are hard coded
permanent
->set/delete
color )
Watch Point :
- can only be created in Debug Mode
- maximum 10 watch points are allowed per program
- it is used to interrupt program, when particular field value changes
- Watch point can be created as local (or) global
local watch points are valid for specific program
global watch points are valid ,if this program is used in another
program
- Watch point consist of a field name, whenever the field content changes system prompts with a message "watch
point reached"
- Watch point can be defined with condition also, whenever system meets the condition, it prompts with a message
"watch point is reached"
- Multiple Watch points can be created using logical operators (AND /
- Watch points are deleted automatically once program is closed
(debugger is closed)
OR)
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
New Debugger :
- is avilable from ECC 5.0 onwards
- it consist of 11 tabs
- it is extension to Classic Debugger
- New Debugger supports to debug WebDynpro Application
- Separate tab provide to analyse objects,structures, internal tables, ..etc.,
- when new debugger started, program is locked for the user,
debugger is opened as parallel session
- it consist of Desktop1, 2, 3, Standard with different views
- we can increase program section or analysis section
- we can swap program section with analysis section
- program and analysis sections can be displayed as horizonal (or)
verticle comparision
- it supports to save layout also
- local and global variables can be displayed separate
-
fieldstring
watchpoints,checkpoint activation
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
Material creation :
Execute Tcode : MM01
Specify Material Number( alphanumeric) fanta
Specify Industry sector (F- food and related product)
Specify Material type(Fert-finished product)
Click on select views
Select basic data1 and sales organization1
Click on organizational levels(specify plant-1000,
Sales org 0001, division -01) and continue
-
A.V. Krishna
-
+91 9704886510
krishna.saptrainer@gmail.com
Purchase Document :
Tcode to create Purchase Requisition(ME51)
/Purchase order ME21N
Table related to P.Requisition : eban
Tables related to P.order : EKKO/ EKPO
Execute Tcode : ME21N
Choose document type : NB Standard PO
Specify vendor number : 400000
Press enter
Maintain org data tab : ( Purchase org -0001
Purchasing Group 001
Company code 0001)
Delivery/Invoice tab :
Maintain payment terms(0001) and currency(inr)
Enter item as Material number (RAMX), press Enter
Maintain PO quantity(15) PC
Maintain plant (P10)
Maintain delivery date
Click on save finally
*-----------------*
AS01 Create Asset Master Record
F-01 Create Accounting Document
F-02 Enter G/L Account Posting
KS01 Create Cost Center
FB50 Enter G/L Acct Posting(Enter single screen posting)
FB60 Enter incoming invoice(vendor)
FB70 Enter outgoing invoice(customer)
FBL1N Vendor line items
A.V. Krishna
+91 9704886510
FBL3N - G/L Account Line Items
FBL5N - Customer Line Items
krishna.saptrainer@gmail.com
Transaction Recorder :
Tcode : SHDB
Path from any screen : system menu -> services
-> Batch Input -> Recorder
It is SAP proprietary tool used to record any
Transaction
It records entire transaction concern screens and
Fields, finally it generates code as per user
Navigation
It captures technical information of screens and
Fields as per user navigation
This recoding code is used, while developing Call
Transaction / Session method program
Prerequisite : Awareness of entire transaction
Steps :
Go to tcode : SHDB
Click on New recording
Specify recording name, tcode
Click on start recording
Enter valid values and create sample record while
Calling sequential screens.
Finally save system generated code
Business Scenario : Uploading Vendor master data
Using CALL Transaction method :
Prerequisites :
o
Flat file with vendor data
o
Recorded code of XK01 tcode
A.V. Krishna
+91 9704886510
krishna.saptrainer@gmail.com
Interview Questions :
Explain Architecture Software oriented view and User oriented view ?
Advantages of R/3 over R/2 architecture?
Explian 3 tier (or) 3 layr architecture?
What is Repository ? Explain Repository object features ?
Explain the functionality of message server, gateway server and enqueue server?
What are application server components ?
what are the work process components ?
Difference between open SQL and native SQL ?
What is ESOA , explain?