0% found this document useful (0 votes)
5 views

3 ABAP Programming

The document provides an overview of ABAP programming, focusing on the functionalities of the ABAP editor, data types, data objects, and various programming constructs such as loops and conditional statements. It details the operations for string manipulation, internal tables, and system variables, along with examples and syntax for each concept. Additionally, it categorizes data types and explains the differences between literals and named data objects.

Uploaded by

mydevices1728
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

3 ABAP Programming

The document provides an overview of ABAP programming, focusing on the functionalities of the ABAP editor, data types, data objects, and various programming constructs such as loops and conditional statements. It details the operations for string manipulation, internal tables, and system variables, along with examples and syntax for each concept. Additionally, it categorizes data types and explains the differences between literals and named data objects.

Uploaded by

mydevices1728
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 105

ABAP Programming

1
Introduction to ABAP Editor

▪ ABAP editor is a tool for ABAP coding.

▪ It is one of the main tool of the ABAP workbench.

▪ The transaction code for ABAP editor is SE38.

▪ Any customized program must start with Z or Y as first alphabet.

▪ A statement is a sequence of words that ends with a period.

▪ In the ABAP editor, the keywords appear in blue color.

2
Functionalities of ABAP Editor

▪ Save - Ctrl + S

▪ Syntax check - Ctrl + F2

▪ Activation - Ctrl + F3

▪ Execute - F8

▪ Display/change - Ctrl+ F1

▪ Display object list - Ctrl + Shift + F5

3
Functionalities of ABAP Editor - Pretty Printer

▪ The use of pretty printer is used to format the ABAP code. It makes the code more

readable.

▪ The shortcut of pretty printer is Shift + F1.

▪ The various functionalities of pretty printer are as follows:

 Indentation

 Convert uppercase/lowercase

4
Functionalities of ABAP Editor - Comments

▪ A comment is an explanation that is added to the source code of a program to help the

person reading the program to understand it.

▪ Comments are ignored when the program is generated by the ABAP compiler.

▪ The * character at the start of a program line indicates that the entire line is a comment.

▪ The " character, which can be entered at any position in the line, indicates that the

remaining content in the line is a comment.

5
Functionalities of ABAP Editor - Comments(Contd.)

▪ Shortcut to comment out lines - Ctrl + ,

▪ Shortcut to uncomment lines - Ctrl + .

6
Data Types

▪ Data types are templates for creating data objects.

▪ A data type defines the technical attributes of data objects.

▪ Data types do not use any memory space.

▪ Data types can be defined independently in the ABAP program or in ABAP dictionary.

7
Data Objects

▪ A data object is an instance of a data type.

▪ A data object holds the contents or data.

▪ It occupies the memory space based upon the data type specified.

▪ Example - DATA lv_empid(20) TYPE n.

lv_empid = 10.

▪ In the above example, DATA = keyword , lv_empid is the name of the data object,

TYPE = keyword , n(numeric) = is a data type of that data object.


8
Categories of Data Types
Categories of Data Types

▪ There are three categories of data types.

1. Elementary types

2. Complex types

3. Reference types

9
Elementary Types

▪ They are predefined data types.

▪ They are single data types. They are not composed of other data types.

▪ Elementary datatypes are of 2 types:

1. Fixed length data types - C(character) , N(numeric) , I(Integer) , P(packed number) ,

F(floating point) , D(date), T(time) , X(hexadecimal).

2. Variable length data types - String , Xstring.

1
0
Complex Data Types

▪ There is no pre-defined complex data type in ABAP.

▪ They are the combination of elementary data types.

▪ There are 2 types of complex data types.

1. Structure type

2. Table type

1
1
Reference Data Types

▪ There is no pre-defined reference data type.

▪ It describes data objects that contain references to other objects.

▪ They are of 2 types of reference data type.

1. Data reference

2. Object reference

1
2
Reference Data Types(Contd.)

▪ Example : DATA lo_object TYPE REF TO zclass.

▪ In the above syntax - DATA = keyword , lo_object = name of data object, TYPE REF TO =

keyword , zclass = name of already existing class.

1
3
Types of Data Objects

▪ The Data objects are of 2 types.

1. Literals(unnamed data objects)

2. Named data objects

1
4
Literals(Unnamed Data Objects)

▪ Literals don’t have any name that’s why they are called as unnamed data objects.

▪ The are fully defined by their value.

▪ There are 2 types of literals.

1. Numeric literals - Numeric literals have sequence of numbers. Examples - 123 , -4567

etc.

2. Character literals - Character literals are sequences of alphanumeric characters in single

quotation marks. Examples - ‘Test 123’ , ‘SAP ABAP’ etc.


1
5
Named Data Objects

▪ Data objects that have a name are called as named data objects.

▪ The various types of named data objects are as follows :

1. Variables

2. Constants

3. Text symbols

1
6
Variables

▪ Variables are data objects whose contents can be changed.

▪ Variables are declared using the DATA, CLASS-DATA, STATICS, PARAMETERS, SELECT-

OPTIONS, and RANGES keyword.

▪ Example - DATA lv_empid(20) TYPE n.

lv_empid = 10.

lv_empid = 20.

1
7
Constants

▪ Constants are data objects whose contents can not be changed.

▪ Constants are declared using the CONSTANTS keyword.

▪ Example - CONSTANTS lc_pi TYPE P DECIMALS 3 VALUE ‘3.141’.

1
8
Text Symbols

▪ A text symbol is a data object that is not declared in the program itself.

▪ It is defined as a part of the text elements of the program.

1
9
Write Statement

▪ The basic ABAP statement for displaying data on the screen is write.

▪ Example - Data: number TYPE I VALUE 1,

name(25) TYPE c VALUE 'Leena’.

WRITE: 'The Number is ‘, number.

WRITE: / 'The Name is ', name.

▪ We can use ‘ /’ in write statement to denotes a new line.

2
0
Chain Operator

▪ The chain operator is ‘:’.

▪ It is used to combine the statements.

▪ Statement sequence - WRITE var1.

WRITE var2.

WRITE var3.

▪ CHAIN statement : WRITE : var1 , var2 , var3.

2
1
Conditional Statements

▪ Conditional statements allows us to execute a block of code if a certain condition is met.

▪ The various conditional statements are as follows:

 IF statement

 CASE statement

2
2
IF Statement

Various options of IF Statement


▪ It is a conditional statement.

▪ Every if statement ends with endif.

▪ We provide multiple conditions using elseif.

▪ Multiple statements blocks are there,

depends upon the condition one block executes.

▪ If none of the If and elseif conditions

are satisfied, it goes to else part.


2
3
CASE Statement

CASE Statement
▪ It is a conditional statement.

▪ Every case statement ends with endcase.

▪ Multiple statements blocks are there,

depends upon the condition one block

executes.

▪ If none of the conditions are satisfied,

it goes to others part.


2
4
Difference between Case & IF

▪ If we have multiple IF conditions , IF check all the conditions, until it gets a true

condition whereas in CASE , it directly jumps to the true condition.

▪ Case is performance effective as compared to IF.

2
5
Loop

▪ Loop allows us to execute a group of statements multiple times.

▪ The various loops are as follows:

 Do loop

 While loop.

 Loop at <itab> where itab stands for Internal table.

2
6
Do Loop

▪ Do loop is called as a unconditional loop.

▪ Every do loop ends with enddo.

▪ Syntax : Do <n> TIMES.

<statement block>.

ENDDO.

2
7
While Loop

▪ While loop is called as a conditional loop.

▪ Every while loop ends with endwhile.

▪ Syntax : WHILE<condition>.

<statement block>.

ENDWHILE.

2
8
Loop Statements

▪ Exit - is used to exit from the loop.

▪ Continue - skip the current processing of the record and then process the next record in

the loop statement.

▪ Check - if the check condition is not true, loop will skip the current loop pass and move

to next loop pass.

2
9
System Variables

▪ System variables are pre-defined variables in SAP.

▪ SYST is the structure for the system fields.

▪ All system fields are addressed using SY field name.

▪ The various system variables are as follows :

 SY-SUBRC - System variable for return code (successful = 0, not successful = other than

0).

 SY-TABIX - It returns the current line index inside a loop.


3
0
System Variables(Contd.)

 SY-INDEX - It returns the current line index inside do and while Loop.

 SY-DATUM - System variable for current date (internal format - yyyymmdd).

 SY-UNAME - It returns the logon name of the user.

 SY-UZEIT - It returns the current system time(internal format - hhmmss)

 SY-UCOMM - System variable for user command.

3
1
String

▪ A string is a collection of characters.

▪ String is an elementary data type of variable length.

3
2
String Operations - Concatenate

▪ The purpose of concatenate is to combine the strings.

▪ Syntax : CONCATENATE <c1> --------<cn> INTO <c> SEPERATED BY <s>.

▪ In the above syntax : CONCATENATE = keyword , <c1>-------<cn> = individual strings ,

INTO = keyword , <c> = final result string , SEPERATED BY = keyword, <s> = separator.

3
3
String Operations - Split

▪ The purpose of split is to divide the strings.

▪ For split, separator is compulsory.

▪ Syntax : SPLIT <string> AT <separator> INTO <f1> <f2> <f3>…. .

▪ In the above syntax : SPLIT = keyword , <string> = string which we need to split, AT =

keyword, <separator> = any delimiter , INTO = keyword , <f1> <f2><f3>---- = individual

strings.

3
4
String Operations - Condense

▪ The purpose of condense is to remove the leading and trailing spaces and convert a

sequence of spaces into a single space.

▪ Syntax : CONDENSE <c>.

▪ In the above syntax : CONDENSE = keyword , <c> = string which we want to condense.

3
5
String Operations - Condense No-gaps

▪ To remove the entire spaces the addition no-gaps is used with condense.

▪ Syntax : CONDENSE<c> NO-GAPS.

▪ In the above syntax : CONDENSE = keyword , <c> = string which we want to condense ,

NO-GAPS = keyword.

3
6
String Operations - Strlen

▪ The purpose of strlen is to provide the string length.

▪ Syntax : len = strlen( string ).

▪ In the above syntax : len = variable name which returns the length of the string, strlen =

pre-defined operation , string = string whose length needs to be calculated.

3
7
String Operations - Find

▪ The purpose of find is to find a particular pattern in a string.

▪ Syntax : FIND <pattern> IN <str> .

▪ In the above syntax : FIND = keyword , <pattern> = is the sequence of characters we are

looking for , IN = keyword , <str> = is the string that is being searched.

3
8
String Operations - Translate

▪ The purpose of translate is to covert the string to upper case or lower case.

▪ Syntax : TRANSLATE <string> TO UPPER CASE/ LOWER CASE.

▪ In the above syntax : TRANSLATE = keyword , <string> = the string which needs to be

converted , TO = keyword , UPPER CASE/LOWER CASE = keyword.

3
9
String Operations - Translate Using Pattern

▪ We can translate a text based upon specific pattern also.

▪ Syntax : TRANSLATE <string> USING <pattern> .

▪ In the above syntax : TRANSLATE = keyword , <string> = the string which needs to be

converted , USING = keyword, pattern = contains letter pairs.

4
0
String Operations - Shift

▪ The purpose of shift is to shift the contents of a string.

▪ It shifts the string by a number of places.

▪ Syntax : SHIFT <string> BY n PLACES <mode>. (by default mode is left)

▪ In the above syntax : SHIFT = keyword , string = string which needs to be shifted, BY =

keyword , n = number , PLACES = keyword , <mode> = left/right/circular.

4
1
String Operations - Substring Processing

▪ Substring is a part of the string or small set of characters from the string.

▪ Depends upon the requirement we need to process the substring.

▪ Syntax : Target_variable = Source_variable[+][starting position of substring](length of

the substring).

4
2
Internal Tables

▪ Internal table is a temporary storage of data on application layer.

▪ Internal table stores any number of records at run time.

▪ A very important use of internal tables is for storing and formatting data from a

database table within a program.

4
3
Work Area In Internal Tables

▪ Work area is also a temporary storage of data on application layer.

▪ Work area are single rows of data.

▪ It is used to process the data in an internal table, one line at a time.

4
4
Types of Internal Tables

▪ Internal table is of 3 types.

1. Standard internal table

2. Sorted internal table

3. Hashed internal table

4
5
Types of Internal Tables

▪ Standard internal table - Standard internal table works on linear/sequential search.

▪ Sorted internal table - Sorted internal table works on binary search.

▪ Hashed internal table - Hashed internal table works on hash function.

4
6
Internal Table With Header Line

▪ In case of internal table with header line, there is an implicit(internal) work area.

▪ The name of the work area is same as that of internal table.

▪ To clearly identify the internal table use brackets after the internal table name(<itab>[]).

▪ CLEAR <itab>[] - Clear the contents of internal table.

Imp point : In case of internal table with header line, CLEAR <itab> clears the work area, not

the internal table. If you want to clear the internal table use brackets after the internal table

name.
4
7
Internal Table Without Header Line

▪ We can avoid the confusion of internal table with header line by using the concept of

internal table without header line.

▪ In case of internal table without header line, there is an explicit(external) work area.

▪ We declare an explicit work area.

▪ The name of the internal table is different from as that of work area.

▪ CLEAR <itab> - Clear the contents of internal table.

4
8
Internal Table Operations

▪ Append - It is used to insert data at the last of the internal table.

▪ Delete - It is used to delete the records from the internal table.

▪ Modify - It is used to modify the records of the Internal table.

▪ Loop - It is used to read the records one by one from the internal table.

▪ Read table - It is used to read the first matching record from the internal table.

▪ Clear , Refresh - It is used to clear the contents of the internal table.

4
9
Internal Table Operations(Contd.)

▪ Collect - It is used to make sum of numeric field values based upon unique character

(non-numeric) field values. The C(character) , N(numeric), D(date), T(time) are

considered as character(non-numeric) data types. The I(Integer) , P(packed number),

F(floating point) are considered as numeric data types.

▪ Sort - It is to sort the internal table. If we are not specifying anything, then by default It

sorts in the ascending order. If we want to sort in descending order, then we need to

specify the keyword descending.


5
0
Internal Table Operations(Contd.)

▪ Describe table - It returns the number of records in the internal table.

Syntax : DESCRIBE TABLE <itab> LINES <lv_lines>.

In the above syntax : DESCRIBE TABLE = keyword, <itab> = name of the internal table ,

LINES = keyword, <lv_lines> = local variable which returns the number of records.

5
1
Selection Screen

▪ Selection screen is also called as Input screen.

▪ With the help of selection screen user provides a input to the program.

▪ There are 2 ways to provide the input to the program.

 Parameters

 Select-options

5
2
Parameters

▪ Parameters are used to pass the single input.

▪ The various parameters variations are as follows:

 PARAMETERS <p> ...... DEFAULT <f> ......

 PARAMETERS <p> ...... OBLIGATORY ......

 PARAMETERS <p> ...... AS CHECKBOX ......

 PARAMETERS <p> ...... RADIOBUTTON GROUP <radi>......

5
3
Select-Options

▪ Select-options are used to pass a range of inputs.

▪ The various Select-options variations are as follows:

 SELECT-OPTIONS <seltab> FOR <f> ... DEFAULT <g> [TO <h>]

 SELECT-OPTIONS <seltab> FOR <f> ... NO-EXTENSION

 SELECT-OPTIONS <seltab> FOR <f> ... NO INTERVALS

 SELECT-OPTIONS <seltab> FOR <f> ... OBLIGATORY

5
4
Select-Options(Contd.)

▪ A select-option has 4 parts.

1. Sign - I/E(include/exclude)

2. Option - Relational operator( EQ, BT, LT etc.)

3. Low - Low value

4. High - High value

5
5
Classical Reports

▪ Reports are programs that read data from the database, processes the data and displays

the data in the required format.

▪ It consists of 2 screens - selection screen and output screen.

▪ The selection screen is optional.

▪ SAP ABAP classical reports are the most basic ABAP reports in which we displayed the

output using WRITE statement.

5
6
Open SQL

▪ SQL stands for structured query language.

▪ It is of 2 types.

1. Open SQL - Open SQL is database independent.

2. Native SQL - Native SQL is database dependent.

5
7
Open SQL Queries

▪ The figure shows an example of open SQL query.

▪ This query fetches data from database table ztordh_88, based upon the select-options

s_ono.

▪ Whenever, there is a select-options, we need to use IN operator.

Example of Open SQL Query

5
8
Open SQL Queries(Contd.)

▪ The figure shows an example of open SQL query.

▪ This query fetches data from database table ztordh_88, based upon the parameter

p_ono.

▪ Whenever, there is a parameter, we need to use = operator.


Example of Open SQL Query

5
9
Open SQL Queries - For All Entries In

▪ When we fetch the data from multiple tables, ‘For All Entries In’ is the best alternative.

▪ It reduces the database load.

▪ The parent internal table(lt_data1) must not be empty.


Use of For All Entries In

6
0
Open SQL Queries - Join

▪ With the help of join, we can read from more than one table in a single select

statement.
Use of Join to Fetch Data From Multiple Tables

6
1
Best Performance Practices/Guidelines

▪ Never use * in the query. Fetch the data of only those columns which are required.

▪ Columns fetching sequence needs to be same as that of data dictionary column

sequence.

▪ Where condition column sequence needs to be same as that of data dictionary column

sequence.

▪ Never use corresponding in the query.

▪ Never write the queries inside the loop.


6
2
Best Performance Practices/Guidelines(Contd.)

▪ For traditional databases avoid using JOIN, use FOR ALL ENTRIES IN.

▪ For fetching data from foreign key tables/dependent tables - check for sy-subrc or

internal table not initial condition.

▪ Use binary search in read table.

▪ Use parallel cursor in nested loops.

▪ For multiple conditions, use CASE conditional statement rather than IF conditional

statement.
6
3
Best Performance Practices/Guidelines(Contd.)

▪ Use existing indexes or create secondary indexes to improve the performance.

6
4
Message Class

▪ Messages always plays an important role for end user.

▪ The various types of messages are - A(abort), E(error), I(information),

S(success/status),W(warning), X(exit).

▪ The transaction code for message class is SE91.


Transaction Code : SE91

6
5
Message Class(Contd.)

▪ A message number length is 3(000-999).

▪ One can pass values to a message number using &.

▪ In a message number, we can pass up to 4 &.

▪ Syntax to use a message in a program: MESSAGE E000(<msg class >).

▪ In the above syntax - MESSAGE = keyword , E = error message type , 000 is message

number , <msg class> = name of the message class.

6
6
Transaction Code

▪ One can create own shortcut/transactions to access the applications.

▪ The transaction code to create a transaction code is SE93.

Transaction Code : SE93

6
7
Classical Report Events

▪ Classical reports are the most basic ABAP reports in which we display the output using

WRITE statement.

▪ Event is always triggered by a specific action or a specific occurrence(when a particular

time has been reached).

▪ The example of specific actions are mouse click, pressing a key etc. The example of

specific occurrence is running out of memory etc.

6
8
Classical Report Events(Contd.)

▪ The same concept of events is applicable to classical reports. Some events trigger by

specific user action and some events trigger at specific occurrence in classical reports.

▪ The various classical report event are as follows:

 Initialization

 At selection-screen

 Start-of-selection

 End-of-selection
6
9
Classical Report Events(Contd.)

 Top-of-page

 End-of-page

 At selection-screen output

 At selection-screen on value request for <field>

 At selection-screen on help request for <field>

 At selection-screen on <field>

7
0
Initialization

▪ This event calls before displaying the selection screen/Input screen.

▪ The purpose of this event is to assign the default values to parameters and select-

options.

7
1
AT Selection-Screen

▪ This event calls when user performs some action (enter, click etc.) on to the selection

screen.

▪ The purpose of this event is to validate the Input.

7
2
Start-of-Selection

▪ This event calls when user clicks execute button on the selection screen.

▪ The selection logic is the part of this event.

7
3
End-of-Selection

▪ This event calls when selection process ends or after the last statement in the START-OF-

SELECTON event is executed.

▪ This event helps to identify the end of data/records.

7
4
Top-of-Page

▪ This event calls when the first write statement occurs in a program for

a page.

▪ The purpose of this event is to provide title/header at the beginning of a new page.

7
5
End-of-Page

▪ This event calls when the last write statement occurs in a program for

a page.

▪ The purpose of this event is to provide footer or some information at the end of a new

page.

▪ For end-of-page event to trigger, we need to provide the line-count.

▪ Example: LINE-COUNT 5(2), It means the total number of lines on a page is 5 and out of

that 2 are reserved for end-of-page.


7
6
AT Selection-Screen Output

▪ This event calls before displaying the selection screen/Input screen.

▪ The purpose of this event is to modify the selection screen before it is displayed.

7
7
Initialization and AT Selection-Screen Output Comparison

▪ Initialization event calls only first time before displaying the selection screen whereas at

selection-screen output event calls every time before displaying a selection screen.

▪ Initialization event is to assign the default values to parameters and select-options

whereas at selection-screen output event is used to modify the selection screen.

7
8
AT Selection-Screen and AT Selection-Screen Output Comparison

▪ AT selection-screen event calls when user performs some action (enter, click etc.) on to

the selection screen whereas at selection-screen output event calls before displaying

the selection-screen.

▪ At selection-screen event is to validate the input whereas at selection screen output is

to used to modify the selection screen.

▪ AT selection-screen event is equal to PAI( Process After Input) of module pool whereas

at selection-screen output is equal to PBO(Process Before Output) of module pool.


7
9
AT Selection-Screen On Value Request For <Field>

▪ This event calls when user clicks F4 on a field of selection screen.

▪ The purpose of this event is to provide value help for an input field.

8
0
AT Selection-Screen On Help Request For <Field>

▪ This event calls when user clicks F1 on a field of selection screen.

▪ The purpose of this event is to provide technical information for a field.

8
1
AT Selection-Screen On <Field>

▪ This event calls when user performs some action (enter, click etc.) on to the selection

screen.

▪ This event is used to validate a particular input field present on the selection screen.

8
2
AT Selection-Screen and AT Selection-Screen On <Field> Comparison

▪ AT selection-screen event is used to validate multiple input fields whereas at selection-

screen on <field> event is to validate a particular input field present on the selection

screen.

▪ In case of at selection-screen event to highlight a wrong input field the explicit logic is

required, whereas in at selection screen on <field> the wrong input field highlighted

automatically.

8
3
AT Selection-Screen and AT Selection-Screen On <Field> Comparison

▪ In case of at selection-screen event all input fields remain enable after the wrong input

whereas in case of at selection-screen on <field> event the wrong input field remain

enable and other input fields become disable.

8
4
Interactive Classical Report Events

▪ In classical report we only display the output on basic list . There is no interaction with

the output.

▪ In Interactive classical report is one we interact with the output on basic list and it take

us to secondary list.

▪ Basic list is the list which is generated at first by our ABAP program.

▪ The secondary lists are generated by further navigation or user selection from the basic

list.
8
5
Interactive Classical Report Events(Contd.)

▪ The number of basic list in classical report is 1.

▪ The number of secondary lists in classical report is 20.

▪ The various interactive classical report events are as follows:

 At line-selection

 At user-command

 Top-of-page during line-selection

8
6
AT Line-Selection

▪ When user double clicks on the line or select a line and press F2 or select a line and click

choose at that time at line-selection event triggers.

8
7
AT User-Command

▪ When user clicks on the functions created using pf-status, at that time at user-command

event triggers.

▪ The system variable sy-ucomm is used to capture the value of function code.

8
8
Top-of-Page During Line-Selection

▪ This event calls when the first WRITE statement occurs in a program

for a page on secondary list.

▪ The purpose of this event is to provide title/header at the beginning of a new page on

secondary list.

8
9
Interactive Classical Reports Statements - HIDE

▪ The HIDE statement is one of the fundamental statements for

interactive reporting.

▪ We can use HIDE statement to store the line-specific information while

creating a basic list.

▪ This stored information will be used while creating secondary list.

▪ Syntax : HIDE <f>.

▪ The above statement places the contents of the variable <f> into the
9
0
Interactive Classical Reports Statements - HIDE(Contd.)

▪ We can consider hide area as a table which stores the field name, field

value and line number(system variable SY-LINNO).

▪ The various pre requisites for HIDE statement are as follows:

1. HIDE statement must be written after the WRITE statement.

2. HIDE statement must be called inside the loop.

9
1
Interactive Classical Reports Statements - Working of HIDE

▪ The user selects a line for which data has been stored in the HIDE

area.

▪ The system variable SY-LILLI determines the selected line.

▪ The runtime system jumps to the point in the HIDE area where data for

this

line is stored.

▪ The runtime system then inserts all values stored for the selected line
9
2
Interactive Classical Reports Statements - GET CURSOR

▪ In interactive classical reports, GET CURSOR statement is used to create secondary lists

according to the cursor position.

▪ The parameter FIELD provides the name of an output field. The parameter VALUE

provide the output value

▪ Syntax : GET CURSOR FIELD <lv_field> VALUE <lv_value>.

▪ In the above syntax - the field name and field value will be returned in to variables

lv_field and lv_value respectively.


9
3
Comparison of HIDE and GET CURSOR Statements

▪ HIDE statement responds for a particular line whereas GET CURSOR statement responds

for a particular field.

▪ HIDE statement is used to store the line with line number in the hide area whereas GET

CURSOR is used to store the value of the selected field name.

▪ With HIDE statement, we can not display secondary lists based upon Individual field

name and field value whereas with GET CURSOR statement we can display secondary

lists based upon the Individual field name and field value.
9
4
System Variables in Interactive Classical Report Events

▪ The various system variables used in interactive classical report events are as follows:

 SY-LISEL - It is a system variable which returns the contents of the selected line.

 SY-LILLI - Absolute number of a selected line in the list displayed.

 SY-LSIND - It is a system variable which returns the index of the displayed list. For the

basic list SY-LSIND = 0 and for the secondary lists SY-LSIND > 0.

9
5
Control Break Statements

▪ Control break statements are also called as control break events.

▪ Control break statements are used to control loop or we can say they are used to control

the data flow in loop.

▪ Control break statements starts with at and ends with endat.

▪ The various pre-requisites to apply control break statements are as follows:

 Control break statements should be applied inside a loop.

 Internal table should be in the sorted order.


9
6
Types of Control Break Statements

▪ The various control break statements are as follows:

 AT FIRST

 AT LAST

 AT NEW <fieldname>

 AT END OF <fieldname>

9
7
Types of Control Break Statements

 AT FIRST - It triggers for the first row/first record/first iteration of the internal table in

loop.

 AT LAST - It triggers for the last row/last record/last iteration of the internal table in

loop.

 AT NEW <fieldname> - It triggers for the new/first record of a group having the same

value for the specified fieldname in loop.

9
8
Types of Control Break Statements(Contd.)

 AT END OF <fieldname> - It triggers for the end/last record of a group having the same

value for the specified fieldname in loop.

9
9
Control Break Statements With SUM Statement

▪ SUM statement can only be used in loop- endloop statement and needs to be applied in

control break statements(at and endat).

▪ SUM calculates the sum of all numeric fields to the right of the current group key.

▪ The sum is for all rows of the current group and assign it to the corresponding fields of

the workarea.

1
0
Control Break Statements - Important Points

▪ Always sort the internal table based upon the fieldname used in AT NEW<fieldname> or

AT END OF <fieldname>.

▪ The event AT NEW <fieldname> and AT END OF <fieldname> also triggers if the value of

other fields change which are present on the left hand side of specified fieldname. If we

want AT NEW <fieldname> and AT END OF <fieldname> to trigger based on specified

fieldname only , then we need to take specified fieldname at the first position in the

internal table.
1
0
Control Break Statements - Important Points

▪ Whenever AT FIRST and AT LAST control break events triggers all character field values

converted to **** and all numeric field values converted to 0.

▪ Whenever AT NEW <fieldname> and AT END OF <fieldname> triggers the value of

character fields on the right hand side of specified fieldname converted to **** and

numeric field values converted to 0.

 Solution : Store the values in a temporary work area before any of the control break

event triggers.
1
0
Database Operations

▪ Database operations deals with database tables. The various database operations are as

follows:

 Select - Select is used to fetch data from database tables.

 Insert - Insert is used to insert the records to database tables.

 Update - Update is used to update the existing records in the database tables.

 Delete - Delete is used to delete the existing records from database tables.

1
0
Database Operations(Contd.)

 Modify - It works for both - insert + update. For existing records - It acts as update, for

non-existing records - it acts as Insert.

1
0
Thank You

1
0

You might also like