KEMBAR78
Sample Project Report | PDF | String (Computer Science) | Databases
0% found this document useful (0 votes)
82 views43 pages

Sample Project Report

The document is a summer training report submitted by Soumya Jaitawat to the Department of Computer Science and Engineering at Techno India NJR Institute of Technology. It details their four month long training from September to December 2022 at Diligent Tech India Pvt. Ltd. in Gurugram, Haryana where they learned SAP ABAP. The report includes chapters on SAP and ABAP introductions, the ABAP dictionary, tables, search helps, Open SQL, report programming, modularization, module pools, dialog programming, Adobe forms, object-oriented programming in ABAP, and user exits and enhancements.

Uploaded by

akshat audichya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views43 pages

Sample Project Report

The document is a summer training report submitted by Soumya Jaitawat to the Department of Computer Science and Engineering at Techno India NJR Institute of Technology. It details their four month long training from September to December 2022 at Diligent Tech India Pvt. Ltd. in Gurugram, Haryana where they learned SAP ABAP. The report includes chapters on SAP and ABAP introductions, the ABAP dictionary, tables, search helps, Open SQL, report programming, modularization, module pools, dialog programming, Adobe forms, object-oriented programming in ABAP, and user exits and enhancements.

Uploaded by

akshat audichya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Summer Training Report (Sept-Dec 2022)

Place of Training: Diligent Tech India Pvt. Ltd., Gurugram, Hariyana


Period of Training: 1 September - 31 December, 2022

Submitted to
Department of Computer Science and Engineering
Summer Training In-charge at TINJRIT: Ms. Aaditya Maheshwari

By

SOUMYA JAITAWAT
(Batch 2019-2023)
Branch: Computer Science and Engineering
Roll No.: 19ETCCS067

Techno India NJR Institute of Technology


Plot-T, Bhamashah (RIICO) Industrial Area, Kaladwas,
Udaipur – 313001, Rajasthan
Certificate I
Certificate II
This is to certify that Ms. SOUMYA JAITAWAT, Bachelor of Computer Science &
Engineering has successfully completed her Summer Training on the SAP ABAP from
Diligent Tech India Pvt Ltd., Gurugram as partial fulfillment of Bachelor of Engineering
CSE. The Summer Training Report, Presentation and Project are genuine work done by
her and the same is being submitted for evaluation.

Signature
ACKNOWLEDGMENT’s
I take this opportunity to express my profound gratitude and deep regards to my mentor
Mr. Nooruddin Bohra Sir for his exemplary guidance, monitoring and constant
encouragement throughout the course of the training. The blessing, help and guidance
given by him time to time shall carry me a long way in the journey of life on which I am
about to embark.

I specially take the opportunity to thank our coordinator Mr. Yogendra Singh Solanki and
Mr. Aaditya Maheshwari for their valuable information and guidance which helped me in
completing this task through various stages. I also take this opportunity to express a deep
sense of gratitude to all my teachers of Computer Science & Engineering Department for
their coordinal support.
I am obliged to the staff members of the Diligent Tech Pvt Ltd, Mr. Vaibhav Sir, Mr. Farhan
Sir, Mr. Kutub Sir, Mr. Vikas Sir, for the valuable information provided by them in their
respective fields. I am grateful for their corporation provided by them during my training
period.
I am thankful to the almighty and my parents for their moral support and my friends with
whom I shared my day-to-day experience and received lots of suggestions that improved
my quality of work.
CONTENTS

Certificate I………………….......…………………………………….......……….1
Certificate II…………………………………………………………………………2
Acknowledgements………………………………………………………………..3
List of Figures……………………………………………………………………….6
List of Tables…………… ………………………………………………………….7
Chapter 1: SAP Introduction………………………………………………………9
Chapter 2: ABAP Basic Syntax………………………………………………….10
2.1 Colon Notation…………………………………………………………………11
2.2 Comments………………………………………………………………………11.
2.3 Messages……………………………………………………………………….12
Chapter 3: ABAP Dictionary………………………………………………………13
3.1 Basic types in ABAP Dictionary……………………………………………….14
3.2 Dictionary Task…………………………………………………………………14
3.3 Domain…………………………………………………………………………..15
3.4 Data Elements…………………………………………………………………18
Chapter 4: Tables…………………………………………………………………19
4.1 Types of table fields…………………………………………………………..21
4.2 Creating Tables in ABAP Dictionary…………………………………………22
Chapter 5: Search Help………………………………………………………….23
5.1 Creating Search Help…………………………………………………………24
Chapter 6: Open SQL Overview…………………………………………………25
6.1 Insert Statement………………………………………………………………..25
6.2 Clear Statement…………………………………………………………………26
6.3 Update Statement………………………………………………………………27
6.4 Modify Statement……………………………………………………………….27
Chapter 7: Report Programming…………………………………………………28
7.1 Selection Screen………………………………………………………………30
Chapter 8: Modularization………………………………………………………31
8.1 Subroutines……………………………………………………………………
8.2 Function Modules………………………………………………………………
8.3 Include Programs………………………………………………………………
Chapter 9: Module Pool/Dialog Programming………………………………….
9.1 Modules…………………………………………………………………………
9.2 Table Control………………………………………………………………….
9.3 Tabstrip Control………………………………………………………………
Chapter 10: Adobe Form…………………………………………………………
10.1 Benefits Adobe form provides for SAP……………………………………..
10.2 Layout………………………………………………………………………….
Chapter 11: OOPS………………………………………………………………
11.1 Objects……………………………………………………………………..
11.2 Class………………………………………………………………………
11.3 Attributes…………………………………………………………………….
11.4 Methods………………………………………………………………………
11.5 Constructors……………………………………………………………………
11.6 ME Operator in Methods………………………………………………………..
Chapter 12: User Exits and Enhancements………………………………………..
12.1 Definition of User Exits…………………………………………………………
12.2 How to find User Exits…………………………………………………………
12.3 Definition of Enhancements………………………………………………….
12.4 Basic Advantages of Enhancements over Modification………………………
12.5Tyes of Exits……………………………………………………………………
List of Figures
Fig No. Title Page No.
1. Hierarchy in datatypes……………………………………………..……18
2. Flow of Subroutines………………………………………………………29
3. Table Control………………………………………………………………33
4. Tabstrip……………………………………………………………………...34
5. PDF Based Form…………………………………………………………..35
6. Adobe form Layout…………………………………………………………35
List of Tables
Fig No. Title Page No.
1. Elementary Data types …………….………………………………………12
2. Data types memory range………………………………………………13-14
3. Parameters for internal table characterization…………………………15
4. Element of table field…………………………………………………….19-20
5. Events and description………………………………………………..26-27
Chapter 1: ABAP Introduction

ABAP stands for Advanced Business Application Programming, a 4GL (4th generation)
language. Currently, it is positioned, along with Java, as the main language for SAP
application server programming.
The Presentation layer consists of any input device that can be used to control SAP
system. This could be a web browser, a mobile device and so on. All the central processing
takes place in Application server. The Application server is not just one system in itself,
but it can be multiple instances of the processing system. The server communicates with
the Database layer that is usually kept on a separate server, mainly for performance
reasons and also for security. Communication happens between each layer of the system,
from the Presentation layer to the Database and then back up the chain.
Note − ABAP programs run at the application server level. Technical distribution of
software is independent of its physical location. It means basically all three levels can be
installed on top of each other on one computer or each level can be installed on a different
computer or a server.
ABAP programs reside inside the SAP database. They execute under the control of the
runtime system that is a part of the SAP kernel. The run-time system processes all ABAP
statements, controlling the flow logic and responding to user events.
So, unlike C++ and Java, ABAP programs are not stored in separate external files. Inside
the database, ABAP code exists in two forms −
● Source code that can be viewed and edited with the ABAP workbench tools.
● Generated code, which is a binary representation. If you are familiar with
Java, this generated code is somewhat comparable with Java byte code.
The run-time system can be considered as a virtual machine, just similar to Java virtual
machine. A key component of the ABAP run-time system is the database interface that
turns database independent statements (Open SQL) into the statements understood by
the underlying database (Native SQL). SAP can work with a wide variety of databases
and the same ABAP program can run on all of those.
Chapter 2: ABAP – Basic Syntax
Statements ABAP source program consists of comments and ABAP statements. Every
statement in ABAP begins with a keyword and ends with a period, and ABAP is ‘Not’ case
sensitive. The first non-comment line in a program begins with the word REPORT. The
Report will always be the first line of any executable program created. The statement is
followed by the program name which was created previously. The line is then terminated
with a full stop.
The syntax is: REPORT [Program_Name]. [Statements…]. This allows the statement to
take up as many lines in the editor as it needs. For example, the REPORT may look like
this: REPORT Z_Test123_01. Statements consist of a command and any variables and
options, ending with a period. As long as the period appears at the end of the statement,
no problems will arise. It is this period that marks where the statement finishes.
2.1 Colon Notation

Consecutive statements can be chained together if the beginning of each statement is


identical. This is done with the colon (:) operator and commas, which are used to terminate
the individual statements, much as periods end normal statements.

2.2 Comments

● Full line comments are indicated by placing an asterisk (*) in the first position of
the line, in which case the entire line is considered by the system to be a comment.
Comments don’t need to be terminated by a period because they may not extend
across more than one line.
● Partial line comments are indicated by entering a double quote (") after a
statement. All text following the double quote is considered by the system to be a
comment. You need not terminate partial line comments by a period because they
may not extend across more than one line.
2.3 Messages
The MESSAGE command displays messages defined by a message ID specified in the
REPORT statement at the beginning of the program. The message ID is a two character
code that defines which set of 1,000 messages the program will access when the
MESSAGE command is used. The messages are numbered from 000 to 999. Associated
with each number is a message text up to a maximum of 80 characters. When message
number is called, the corresponding text is displayed.
S Message (Success)
S-type messages are displayed in the Status Bar on the same or next screen. The
message has no influence on the user's work. It only confirms the successful execution of
system functions.
I Message (Information)
This message has a model character - that is, the user must acknowledge the message.
I messages are therefore displayed in a modal dialog box. The processing can be
continued by pressing the ENTER key.
W Message (Warning)
So-called W messages interrupt the processing and allow the user to make corrections.
For this reason, fields are enabled for input. W messages are displayed in the Status Bar
if the messages have been issued by a primary window. If a dialog box issues the
message, the system displays the message in a separate dialog box.
With regard to the system response, warnings are similar to E messages. E messages,
however, force the user to change the entry.
E Message (Error)
When the system detects an error, E messages should be used. Incorrectly completed
fields must be ready for input. If consequential errors occur, we recommend to make not
only the incorrectly filled field ready for input but also those fields whose entries have
contributed to the error.
Depending on whether the E message was issued by a primary window or a dialog box, it
is either displayed in the Status Bar of the primary window or in a separate dialog box
Chapter 3: Dictionary

As you are aware, SQL can be divided into two parts -


▪ DML (Data Manipulation Language)
▪ DDL (Data Definition Language)
DML part consists of query and update commands such as SELECT, INSERT, UPDATE,
DELETE, etc. and ABAP programs handle the DML part of SQL. DDL part consists of
commands such as CREATE TABLE, CREATE INDEX, DROP TABLE, ALTER TABLE,
etc. and ABAP Dictionary handles the DDL part of SQL.
ABAP Dictionary can be viewed as metadata (i.e. data about data) that resides in the SAP
database along with the metadata maintained by the database. The Dictionary is used to
create and manage data definitions and to create Tables, Data Elements, Domains, Views
and Types.

3.1 Basic Types in ABAP Dictionary

The basic types in ABAP Dictionary are as follows −


▪ Data elements describe an elementary type by
defining the data type, length and possibly decimal
places.
▪ Structures with components that can have any type.
▪ Table types describe the structure of an internal
table.
Various objects in the Dictionary environment can be referenced in ABAP programs. The
Dictionary is known as the global area. The objects in the Dictionary are global to all ABAP
programs and the data in ABAP programs can be declared by reference to these
Dictionary global objects.
The Dictionary supports the definition of user-defined types and these types are used in
ABAP programs. They also define the structure of database objects such as tables, views
and indexes. These objects are created automatically in the underlying database in their
Dictionary definitions when the objects are activated. The Dictionary also provides editing
tools like Search Help and locking tool like Lock Objects.

3.2 Dictionary Tasks

ABAP Dictionary achieves the following −


▪ Enforces data integrity.
▪ Manages data definitions without redundancy.
▪ Integrates tightly with rest of the ABAP development
workbench.
Example
Any complex user-defined type can be built from the 3 basic types in the Dictionary.
Customer data is stored in a structure ‘Customer’ with the components Name, Address
and Telephone as depicted in the following image. Name is also a structure with
components, First name and Last name. Both of these components are elementary
because their type is defined by a data element.
The type of component Address is defined by a structure whose components are also
structures, and the Telephone component is defined by a table type because a customer
can have more than one telephone number. Types are used in ABAP programs and also
to define the types of interface parameters of function modules.
Data Types
While programming in ABAP, we need to use a variety of variables to store various
information. Variables are nothing but reserved memory locations to store values. This
means that when you create a variable you reserve some space in memory. You may like
to store information of various data types like character, integer, floating point, etc. Based
on the data type of a variable, the operating system allocates memory and decides what
can be stored in the reserved memory.
Elementary Data Types
ABAP offers the programmer a rich assortment of fixed length as well as variable length
data types. Following table lists down ABAP elementary data types −

Type Keyword

Byte field X

Text field C

Integer I

Floating point F

Packed number P
Text string STRING

Example
REPORT YR_SEP_12.
DATA text_line TYPE C LENGTH 40.
text_line = 'A Chapter on Data Types'.
Write text_line.

DATA text_string TYPE STRING.


text_string = 'A Program in ABAP'.
Write / text_string.

DATA d_date TYPE D.


d_date = SY-DATUM.
Write / d_date.
Some of the fields and numbers can be modified using one or more names as the following

• byte
• numeric
• character-like
The following table shows the data type, how much memory it takes to store the value in
memory, and the minimum and maximum value that could be stored in such type of
variables.

Type Typical Length Typical Range

X 1 byte Any byte values (00 to FF)

C 1 character 1 to 65535
N (numeric text filed) 1 character 1 to 65535

D (character-like date) 8 characters 8 characters

T (character-like time) 6 characters 6 characters

I 4 bytes -2147483648 to 2147483647

F 8 bytes 2.2250738585072014E-308 to
1.7976931348623157E+308
positive or negative

P 8 bytes [-10^(2len -1) +1] to [+10^(2len -1)


1] (where len = fixed length)

STRING Variable Any alphanumeric characters

XSTRING (byte string) Variable Any byte values (00 to FF)

Complex and Reference Types


The complex types are classified into Structure types and Table types. In the structure
types, elementary types and structures (i.e. structure embedded in a structure) are
grouped together. You may consider only the grouping of elementary types. But you must
be aware of the availability of nesting of structures.
When the elementary types are grouped together, the data item can be accessed as a
grouped data item or the individual elementary type data items (structure fields) can be
accessed. The table types are better known as arrays in other programming languages.
Arrays can be simple or structure arrays. In ABAP, arrays are called internal tables and
they can be declared and operated upon in many ways when compared to other
programming languages. The following table shows the parameters according to which
internal tables are characterized.
S.N Parameter & Description
o.

1 Line or row type


Row of an internal table can be of elementary, complex or reference type.

2 Key
Specifies a field or a group of fields as a key of an internal table that identifies the table
rows. A key contains the fields of elementary types.

3 Access method
Describes how ABAP programs access individual table entries.

Reference types are used to refer to instances of classes, interfaces, and run-time data
items. The ABAP OOP run-time type services (RTTS) enables declaration of data items
at run-time.
3.3 ABAP-Domains
The three basic objects for defining data in the ABAP Dictionary are Domains, Data
elements and Tables. The domain is used for the technical definition of a table field such
as field type and length, and the data element is used for the semantic definition (short
description). A data element describes the meaning of a domain in a certain business
context. It contains primarily the field help and the field labels in the screen.
The domain is assigned to the data element, which in turn is assigned to the table fields
or structure fields. For instance, the MATNR domain (CHAR material number) is assigned
to data elements such as MATNR_N, MATNN and MATNR_D, and these are assigned to
many table fields and structure fields.
3.3.1 Creating Domains
Before you create a new domain, check whether any existing domains have the same
technical specifications required in your table field. If so, we are supposed to use that
existing domain. Let’s discuss the procedure for creating the domain.
Step 1 − Go to Transaction SE11.
Step 2 − Select the radio button for Domain in the initial screen of the ABAP Dictionary,
and enter the name of the domain as shown in the following screenshot. Click the CREATE
button. You may create domains under the customer namespaces, and the name of the
object always starts with ‘Z’ or ‘Y’.
Step 3 − Enter the description in the short text field of the maintenance screen of the
domain. In this case, it is “Customer Domain”. Note − You cannot enter any other attribute
until you have entered this attribute.
Step 4 − Enter the Data Type, No. of Characters, and Decimal Places in the Format block
of the Definition tab. Press the key on Output Length and it proposes and displays the
output length. If you overwrite the proposed output length, you may see a warning while
activating the domain. You may fill in the Convers. Routine, Sign and Lower Case fields if
required. But these are always optional attributes.
Step 5 − Select the Value Range tab. If the domain is restricted to having only fixed values
then enter the fixed values or intervals. Define the value table if the system has to propose
this table as a check table while defining a foreign key for the fields referring to this domain.
But all these are optional attributes.
Step 6 − Save your changes. The Create Object Directory Entry pop-up appears and asks
for a package. You may enter the package name in which you are working. If you do not
have any package then you may create it in the Object Navigator or you can save your
domain using the Local Object button.
Step 7 − Activate your domain. Click on the Activate icon (matchstick icon) or press CTRL
+ F3 to activate the domain. A pop-up window appears, listing the 2 currently inactive
objects.
Step 8 − At this point, the top entry labelled ‘DOMA’ with the name ZSEP_18 is to be
activated. As this is highlighted, click the green tick button. This window disappears and
the status bar will display the message ‘Object activated’.
If error messages or warnings occurred when you activated the domain, the activation log
is displayed automatically. The activation log displays information about activation flow.
You can also call the activation log with Utilities(M) → Activation log.
3.4 ABAP-Data Elements
Data elements describe the individual fields in the ABAP Data Dictionary. They are the
smallest indivisible units of the complex types, and they are used to define the type of
table field, structure component or row type of a table. Information about the meaning of
a table field and also information about editing the corresponding screen field could be
assigned to a data element. This information is automatically available to all the screen
fields that refer to the data element. Data elements describe either elementary types or
reference types.
Fig 1: Hierarchy in data types.

3.4.1 Creating Data Elements


Before creating a new data element, you need to check whether any existing data
elements have the same semantic specifications required in your table field. If so, you
may use that existing data element. You can assign the data element with a predefined
type, domain, or reference type.
Following is the procedure for creating the data element −
Step 1 − Go to Transaction SE11.
Step 2 − Select the radio button for Data type in the initial screen of the ABAP Dictionary,
and enter the name of the data element as shown below.
Step 3 − Click the CREATE button. You may create data elements under the customer
namespaces, and the name of the object always starts with ‘Z’ or ‘Y’.
Step 4 − Check the Data element radio button on the CREATE TYPE pop-up that
appears with three radio buttons.
Step 5 − Click the green checkmark icon. You are directed to the maintenance screen of
the data element.
Step 6 − Enter the description in the short text field of the maintenance screen of the data
element. In this case, it is “Customer Data Element”. Note − You cannot enter any other
attribute until you have entered this attribute.
Step 7 − Assign the data element with the type. You can create an elementary data
element by checking elementary type or a reference data element by checking Reference
type. You can assign a data element to a Domain or Predefined Type within Elementary
Type and with Name of Reference Type or Reference to Predefined Type within
Reference Type.
Step 8 − Enter the fields for short text, medium text, long text, and heading in the Field
Label tab. You can press Enter and the length is automatically generated for these labels.
Step 9 − Save your changes. The Create Object Directory Entry pop-up appears and asks
for a package. You may enter the package name in which you are working. If you do not
have any package then you may create it in the Object Navigator or you can save your
data element using the Local Object button.
Step 10 − Activate your data element. Click the Activate icon (matchstick icon) or press
CTRL + F3 to activate the data element. A pop-up window appears, listing the 2 currently
inactive objects as shown in the following screenshot.
Step 11 − At this point, the top entry labelled ‘DTEL’ with the name Z_CUST is to be
activated. As this is highlighted, click the green tick button. This window disappears and
the status bar will display the message ‘Object activated’.
If error messages or warnings occurred when you activated the data element, the
activation log is displayed automatically. The activation log displays information about
activation flow. You can also call the activation log with Utilities(M) → Activation log.
Chapter 4: Tables
Tables can be defined independent of the database in ABAP Dictionary. When a table is
activated in ABAP Dictionary, similar copy of its fields is created in the database as well.
The tables defined in ABAP Dictionary are translated automatically into the format that is
compatible with the database because the definition of the table depends on the database
used by the SAP system.
A table can contain one or more fields, each defined with its data type and length. The
large amount of data stored in a table is distributed among the several fields defined in
the table.

4.1 Types of Table Fields


A table consists of many fields, and each field contains many elements. The following
table lists the different elements of table fields −

S.N Elements & Description


o.

Field name
1
This is the name given to a field that can contain a maximum of 16 characters. The field
name may be composed of digits, letters, and underscores. It must begin with a letter.

Key flag
2
Determines whether or not a field belongs to a key field.

Field type
3
Assigns a data type to a field.

Field length
4
The number of characters that can be entered in a field.
Decimal places
5
Defines the number of digits permissible after the decimal point. This element is used
only for numeric data types.

Short text
6
Describes the meaning of the corresponding field.

4.2 Creating Tables in ABAP Dictionary

Step 1 − Go to transaction SE11, select the ‘Database table’ radio button, and enter a
name for the table to be created. In our case, we have entered the name ZCUSTOMERS1.
Click the Create button. The Dictionary: Maintain Table screen appears. Here the ‘Delivery
and Maintenance’ tab is selected by default.
Step 2 − Enter an explanatory short text in the Short Description field.
Step 3 − Click the Search Help icon beside the Delivery Class field. Select ‘A [Application
table (master and transaction data)]’ option.
Step 4 − Select the ‘Display/Maintenance Allowed’ option from the ‘Data Browser/Table
view Maintenance’ drop-down menu. The Dictionary: Maintenance Table screen appears.
Step 5 − Select the Fields tab. The screen containing the options related to the Fields tab
appears.
Step 6 − Enter the names of table fields in the Field column. A field name may contain
letters, digits, and underscores, but it must always begin with a letter and must not be
longer than 16 characters.
The fields that are to be created must also have data elements because they take the
attributes, such as data type, length, decimal places, and short text, from the defined data
element.
Step 7 − Select the Key column if you want the field to be a part of the table key. Let’s
create fields such as CLIENT, CUSTOMER, NAME, TITLE and DOB.
Step 8 − The first field is an important one and it identifies the client which the records are
associated with. Enter ‘Client’ as the Field and ‘MANDT’ as the Data Element. The system
automatically fills in the Data Type, Length, Decimals and Short Description. The ‘Client’
field is made a key field by checking the ‘Key’ box.
Step 9 − The next field is ‘Customer’. Check the box to make it a key field and enter the
new Data Element ‘ZCUSTNUM’. Click the Save button.
Step 10 − As the Data Element ‘ZCUSTNUM’ doesn’t yet exist, it has to be created.
Doubleclick the new Data Element and the ‘Create Data Element’ window appears.
Answer ‘Yes’ to this and a ‘Maintain Data Element’ window appears.
Step 11 − Enter ‘Customer Number’ in the Short Description area. The Elementary data
type called ‘Domain’ should be defined for the new Data element. So enter ‘ZCUSTD1’,
double-click it and agree to save the changes made. Choose ‘Yes’ to create the domain
and type into the ‘Short Description’ box a description of the domain.
The ‘Definition’ tab opens automatically. The first field is ‘Data Type’.
Step 12 − Click inside the box and select ‘NUMC’ type from the drop-down menu. Enter
the number 8 in the ‘No. of characters’ field (a maximum of 8 characters) and enter 0 in
‘Decimal places’ area. The Output length of 8 must be selected and then press Enter. The
‘NUMC’ field’s description must re-appear, confirming that this is a valid entry.
Step 13 − Click Save button and Activate the object.
Step 14 − Press F3 to return to the ‘Maintain/Change Data Element’ screen. Create four
Field labels as shown in the following snapshot. After this, Save and Activate the element.
Step 15 − Press the back button to return to the table maintenance screen. The Customer
column has the correct Data Type, Length, Decimals and Short Description. This indicates
the successful creation of a Data element and also the Domain used.
Similarly, we need to create three additional fields such as NAME, TITLE and DOB.
Step 16 − Select ‘Technical settings’ from the toolbar. Choose APPL0 for the ‘Data class’
and the first size category 0 for the ‘Size’ category’ field. In case of buffering options,
‘Buffering not allowed’ has to be selected.
Step 17 − Click Save. Go back to the table and activate it. The following screen appears.
The table ‘ZCUSTOMERS1’ is activated.
Chapter 5: Search Help
Search Help, another repository object of ABAP Dictionary, is used to display all the
possible values for a field in the form of a list. This list is also known as a hit list. You can
select the values that are to be entered in the fields from this hit list instead of manually
entering the value, which is tedious and error prone.

5.1 Creating Search Help

Step 1 − Go to transaction SE11. Select the radio button for Search help. Enter the name
of the search help to be created. Let's enter the name ZSRCH1. Click on the Create button.
Step 2 − The system will prompt for the search help type to be created. Select the
Elementary search help, which is default. The screen to create elementary search help as
shown in the following screenshot appears.
Step 3 − In the selection method, we need to indicate whether our source of data is a table
or a view. In our case it happens to be a table. The table is ZCUSTOMERS1. It is selected
from a selection list.
Step 4 − After the selection method is entered, the next field is the Dialog type. This
controls the appearance of the restrictive dialog box. There is a drop-down list with three
options. Let's select the option 'Display values immediately'.
Step 5 − Next is the parameter area. For each Search help parameter or field, these
column fields have to be entered as per the requirements.
Search help parameter − This is a field from the source of data. The fields from the table
are listed in the selection list. The fields participating in the search help would be entered,
one field in each row. Let's include the two fields CUSTOMER and NAME. How these two
fields participate is indicated in the rest of the columns.
Import − This field is a checkbox for indicating whether a Search help parameter is an
import parameter. The export or import is with reference to the search help.
Export − This field is a checkbox for indicating whether a Search help parameter is an
export parameter. The export will be transfer of field values from the selection list to screen
fields.
LPos − Its value controls the physical position of Search help parameter or field in the
selection list. If you enter a value 1, the field will appear in the first position in the selection
list and so on.
SPos − It controls the physical position of Search Help parameter or field in the restrictive
dialog box. If you enter a value of 1, the field will appear in the first position in the restrictive
dialog box and so on.
Data element − Every Search Help parameter or field by default is assigned a data
element that was assigned to it in the source of data (Table or View). This data element
name appears in display mode.
Step 6 − Perform a consistency check and activate the search help. Press F8 to execute.
The 'Test Search Help ZSRCH1' screen appears as shown in the following screenshot.
Step 7 − Let's enter the number 100004 in the CUSTOMER's 'Ready for inp' screen field.
Press Enter.
The customer number, 100004, and the name ‘STEPHEN’ is displayed.
Chapter 6: Open SQL Overview
Open SQL indicates the subset of ABAP statements that enable direct access to the data
in the central database of the current AS ABAP. Open SQL statements map the Data
Manipulation Language functionality of SQL in ABAP that is supported by all database
systems.
The statements of Open SQL are converted to database specific SQL in the Open SQL
interface of the database interface. They are then transferred to the database system and
executed. Open SQL statements can be used to access database tables that are declared
in the ABAP Dictionary. The central database of AS ABAP is accessed by default and also
access to other databases is possible via secondary database connections.
Whenever any of these statements are used in an ABAP program, it is important to check
whether the action executed has been successful. If one tries to insert a record into a
database table and it is not inserted correctly, it is very essential to know so that the
appropriate action can be taken in the program. This can done using a system field that
has already been used, that is SY-SUBRC. When a statement is executed successfully,
the SY-SUBRC field will contain a value of 0, so this can be checked for and one can
continue with the program if it appears.
The DATA statement is used to declare a work area. Let's give this the name
'wa_customers1'. Rather than declaring one data type for this, several fields that make up
the table can be declared. The easiest way to do this is using the LIKE statement.
6.1 INSERT Statement
The wa_customers1 work area is declared here LIKE the ZCUSTOMERS1 table, taking
on the same structure without becoming a table itself. This work area can only store one
record. Once it has been declared, the INSERT statement can be used to insert the work
area and the record it holds into the table. The code here will read as 'INSERT
ZCUSTOMERS1 FROM wa_customers1'.
The work area has to be filled with some data. Use the field names from the
ZCUSTOMERS1 table. This can be done by forward navigation, double clicking the table
name in the code or by opening a new session and using the transaction SE11. The fields
of the table can then be copied and pasted into the ABAP editor.
CHECK statement can then be used as follows. It means that if the record is inserted
correctly, the system will state this. If not, then the SY-SUBRC code which will not equal
zero will be displayed.
Check the program, save, activate the code, and then test it. The output window should
display as 'Record Inserted Successfully'.
6.2 CLEAR Statement
CLEAR statement allows a field or variable to be cleared out for the insertion of new data
in its place, allowing it to be reused. CLEAR statement is generally used in programs and
it allows existing fields to be used many times.
In the previous code snippet, the work area structure has been filled with data to create a
new record to be inserted into the ZCUSTOMERS1 table and then a validation check is
performed. If we want to insert a new record, CLEAR statement must be used so that it
can then be filled again with the new data.
6.3 UPDATE Statement

If you want to update one or more existing records in a table at the same time then use
UPDATE statement. Similar to INSERT statement, a work area is declared, filled with the
new data that is then put into the record as the program is executed. The record previously
created with the INSERT statement will be updated here. Just edit the text stored in the
NAME and TITLE fields. Then on a new line, the same structure as for the INSERT
statement is used, and this time by using the UPDATE statement.
As UPDATE statement gets executed, you can view the Data Browser in the ABAP
Dictionary to see that the record has been updated successfully.
6.4 MODIFY Statement

MODIFY statement can be considered as a combination of the INSERT and UPDATE


statements. It can be used to either insert a new record or modify an existing record. It
follows a similar syntax to the previous two statements in modifying the record from the
data entered into a work area.
When this statement is executed, the key fields involved will be checked against those in
the table. If a record with these key field values already exist, it will be updated. If not, then
a new record will be created.
In this example, a CLEAR statement is used so that a new entry can be put into the work
area, and then the customer (number) 100007 is added. Since this is a new, unique key
field value, a new record will be inserted, and another validation check is executed.
When this is executed and the data is viewed in the Data Browser, a new record will have
been created for customer number 100007 (RALPH).
Chapter 7. Report Programming

A report is a presentation of data in an organized structure. Many database management


systems include a report writer that enables you to design and generate reports. SAP
applications support report creation.
A classical report is created by using the output data in the WRITE statement inside a
loop. They do not contain any sub-reports.
These reports consist of only one screen as an output. We can use various events such
as INITIALIZATION & TOP-OF-PAGE to create a classical report, and each event has its
own importance during the creation of a classical report. Each of these events is
associated with a specific user action and is triggered only when the user performs that
action.

Following is a table describing the events and descriptions −

S.No. Event & Description

1 INITIALIZATION

Triggered before displaying the selection screen.

2 AT SELECTION-SCREEN

Triggered after processing of the user input on the selection screen. This event verifies
the user input prior to the execution of a program. After processing the user input, the
selection screen remains active mode.

3 START-OF-SELECTION

Triggered only after the processing of the selection screen is over; that is when the
user clicks the Execute icon on the selection screen.
4 END-OF-SELECTION

Triggered after the last statement in the START-OF-SELECTON event is executed.

5 TOP-OF-PAGE

Triggered by the first WRITE statement to display the data on a new page.

6 END-OF-PAGE

Triggered to display the text at the end of a page in a report. Note, that this event is
the last event while creating a report, and should be combined with the LINE-COUNT
clause of the REPORT statement.

Triggered to display the text at the end of a page in a report. Note, that this event is
the last event while creating a report, and should be combined with the LINE-COUNT
clause of the REPORT statement.

7.1 Selection Screen

A selection screen is a special type of classic screen that is defined with the ABAP
statements PARAMETERS, SELECT-OPTIONS and SELECTION-SCREEN rather than
being created in the Screen Painter. Selection screens are called either implicitly when
an executable program is started or explicitly using the CALL SELECTION-SCREEN
statement.
Chapter 8: Modularization

In the SAP ABAP environment, modularization involves the organization of programs into
modular units, also known as logical blocks. It reduces redundancy and increases program
readability even as you are creating it and subsequently during the maintenance cycle.
Modularization also enables the reusability of the same code again. ABAP has made it
necessary for developers to modularize, i.e. organizing the programs relatively more, than
in the OOPS-based languages that have relatively more built-in modular features. Once a
small, modularized section of code is complete, debugged and so on, it does not
subsequently have to be returned, and developers can then move on and focus on other
issues.
ABAP programs are made up of processing blocks known as modularizing processing
blocks. They are −
● The processing blocks called from outside the program and from the
ABAP run-time environment (i.e., event blocks and dialog modules).
● Processing blocks called from ABAP programs.
Apart from the modularization with processing blocks, source code modules are used to
modularize your source code through macros and include programs.
Modularization at the source code level −
● Local Macros
● Global Include programs
Modularization through processing blocks called from ABAP programs −
● Subroutines
● Function modules

8.1 Subroutines

A subroutine is a reusable section of code. It is a modularization unit within the program


where a function is encapsulated in the form of source code. You page out a part of a
program to a subroutine to get a better overview of the main program, and to use the
corresponding sequence of statements many times as depicted in the following diagram.
Fig 2: Flow of subroutines

We have program X with 3 different source code blocks. Each block has the same ABAP
statements. Basically, they are the same code blocks. To make this code easier to
maintain, we can encapsulate the code into a subroutine. We can call this subroutine in
our programs as many times as we wish. A subroutine can be defined using Form and
EndForm statements.
Following is the general syntax of a subroutine definition.
FORM <subroutine_name>.
<statements>
ENDFORM.
We can call a subroutine by using PERFORM statement. The control jumps to the first
executable statement in the subroutine <subroutine_name>. When ENDFORM is
encountered, control jumps back to the statement following the PERFORM statement.
Hence, using subroutines makes your program more function-oriented. It splits the
program's task into sub-functions, so that each subroutine is responsible for one
subfunction. Your program becomes easier to maintain as changes to functions often only
have to be implemented in the subroutine.

8.2 Function Modules

Function modules are sub-programs that contain a set of reusable statements with
importing and exporting parameters. Unlike Include programs, function modules can be
executed independently. SAP system contains several predefined function modules that
can be called from any ABAP program. The function group acts as a kind of container for
a number of function modules that would logically belong together.
To look at how to create function modules, the function builder must be explored. You can
find the function builder with transaction code SE37.
Components of Function Module:
● Import - Input parameters of a Function Module.
● Export - Output parameters of a Function Module.
● Changing - Specifies the parameters act as importing and exporting parameters
to a Function Module.
● Tables - Specifies internal tables acts as importing and exporting parameters.

8.3 Include Programs

Include programs are global repository objects used to modularize the source code. They
allow you to use the same source code in different programs. Include programs also allow
you to manage complex programs in an orderly way. In order to use an include program
in another program, we use the following syntax −
INCLUDE <program_name>.
INCLUDE statement has the same effect as copying the source code of the include
program <program_name> into another program. As include program can’t run
independently, it has to be built into other programs. You may also nest include programs.
Following are couple of restrictions while writing the code for Include programs −
● Include programs can't call themselves.
● Include programs that must contain complete statements.
Chapter 9: Module Pool / Dialog Programming

It is a special type of programming where we write code that is used to create custom
SAP screens. In short in SAP ABAP we can create a specific screen and transaction
code as per our requirement. For the execution of the Module pool program, there is a
specific transaction code.
The transaction code for creating module pool programs is SE80.
Prerequisites for developing Module Pool are:
● Screen Painter [SE51].
● Transaction Code [SE93].
● ABAP Editor [SE38].
● ABAP Dictionary [SE11].
● Menu Painter [SE41].
Screen: It is a layout that is displayed in the output.
Following are the components of the screen.
● Screen Attributes
Properties of the Screen like screen type, next screen, and short description.
● Screen Layout
There are 2 ways to create a screen layout
1. With the help of Data Dictionary
2. With the help of available buttons on the Toolbar.
● Field Attribute
It is used to maintain filed characteristics.
● Flow Logic
It will contain the logic related to the screen in modules.

9.1 Modules
● In flow logic we can’t write ABAP statements, directly therefore we write in
the form of modules. That's why it is called Module Pool Programming
● In Modules 4 Events are there.
PBO (Process Before Output).
● This is processed before the output or screen is displayed.
PAI (Process After Input).
● This is processed after a user action on the screen.
PVO (Process On Value Request.
● Which is processed when F1 is pressed.
POH (Process On Help Request).
● Which is processed when F4 is pressed.
9.2 Table Control

Table controls and step loops are objects for screen table display that you add to a
screen in the Screen Painter.
From a programming standpoint, table controls and step loops are almost exactly the
same. Table controls are simply improved step loops that display data with the look and
feel associated with tables in desktop applications.
With table controls, the user can:

● Scroll through the table vertically and horizontally


● Re-size the width of a column
● Scroll within a field (when field contents are wider than the field)
● Select table rows or columns
● Re-order the sequence of columns
● Save the current display settings for future use
Table controls also offer special formatting features (some automatic, some optional)
that make tables easier to look at and use. Table Control provides –

● automatic table resizing (vertical and horizontal) when the user resizes the
window

● separator lines between rows and between columns (vertical and horizontal)
● column header fields for all columns
One feature of step loops is that their table rows can span more than one line on the
screen. A row of a table control, on the other hand, must always be contained in a single
line (although scrolling is possible).
In general, many of the features provided by the table control are handled locally
by your system’s SAPgui front, so you do not need to program them yourself. The
only notable exception to this is vertical scrolli

Fig 3: Table Control


Syntax
To handle table controls in ABAP programs, you must declare a control in the declaration
part of the program for each table control using the following statement:
CONTROLS <ctrl> TYPE TABLEVIEW USING SCREEN <scr>
where <ctrl> is the name of the table control on a screen in the ABAP program. The control
allows the ABAP program to read the attributes of the table control and to influence the
control. Here, <scr> is the screen number where the initial values of the table are loaded.
9.3 Tabstrip Control
Tab strip control is a screen element that contains more than one tab. Each of these
tabs is a sub-screen. The tab strip control contains one main screen and n number of
sub-screen. This n number denotes the number of tabs. The tab strip is as follows.
Fig 4: Tabstrip Control

Each tab contains a tab title and page area. In the page area, we can store the screen
elements. This page area is actually the sub-screen. Hence a tab strip is a combination of
the main screen and all those subscreens. If there are many tabs and all of those tabs
contain big tab titles then one tab strip control area is not sufficient to display all those
tabs. In this condition, a scroll bar appears and then we can scroll to all of those tabs.
Apart from that there will be a button that will display the list of all tabs.

The tab title acts as a button in tab strip control. We can set the function code of any tab
as we do for the push button. We also can set a title and icon for that tab. We generally
create all of these by the screen painter toolbar. We can customize the screen area of the
main screen, tab strip screen, and also the sub screens. We also can modify the position
of these as per requirement.
Chapter 10: Adobe Forms
It is a Universal file format developed by Adobe that preserves all the fonts, formatting,
graphics, and color of any source document,
regardless of the application and platform used to create it. PDF files are compact and
can be shared, viewed, navigated, and printed exactly as intended by anyone with Adobe
Reader software.

Why PDF Forms?

1. It's an open standard

2.An Ideal document format

3. It provides security options like -

a) Digital signature validation


b) Disable save option
c) Disable select option
d) Disable the print option.

10.1 Benefits Adobe Provides for SAP -

1. The use of PDF format ensures that the appearance of the form remains the same,
irrespective of the environment it is being used in.
2. It helps in the optimization of the business process by automating the creation of data
for SAP systems. Thus saving time and costs (in the case of interactive forms).
3. Integrate business processes with more users.
4. Overcome limitations of paper-based forms like -manual data entry, error-prone and
easily outdated, traceability, and high costs in production and storage.
Fig:PDF Based Form

Layout

Fig: Adobe form Layout


Chapter 11: OOPS
The object-oriented approach focuses on objects that represent abstract or concrete
things of the real world. These objects are defined by their character and properties that
are represented by their internal structure and their attributes (data). The behavior of these
objects is described by methods (i.e. functionality).
The key features of object orientation are −
● Effective programming structure.
● Real-world entities can be modeled very well.
● Stress on data security and access.
● Minimizes code redundancy.
● Data abstraction and encapsulation.

11.1 Objects

An object is a special kind of variable that has distinct characteristics and behaviors. An
object is a pattern or instance of a class. It represents a real-world entity such as a person
or a programming entity like variables and constants.
Creating an Object:
DATA: <object_name> TYPE REF TO <class_name>.
CREATE Object: <object_name>.
11.2 Class

A class is used to specify the form of an object and it combines data representation and
methods for manipulating that data into one neat package. The data and functions within
a class are called members of the class.
Class Definition and Implementation

CLASS <class_name> DEFINITION.


..........
..........
ENDCLASS.
The definition of a class can contain various components of the class such as attributes,
methods, and events. When we declare a method in the class declaration, the method
implementation must be included in the class implementation.

CLASS <class_name> IMPLEMENTATION.


...........
..........
ENDCLASS.

Implementation of a class contains the implementation of all its methods. In ABAP


Objects, the structure of a class contains components such as attributes, methods,
events, types, and constants.

11.3 Attributes

Attributes are data fields of a class that can have any data type such as C, I, F, and N.
They are declared in the class declaration. These attributes can be divided into 2
categories: instance and static attributes. An instance attribute defines the instance-
specific state of an object. The states are different for different objects. An instance
attribute is declared by using the DATA statement.
Static attributes define a common state of a class that is shared by all the instances of the
class. That is, if you change a static attribute in one object of a class, the change is visible
to all other objects of the class as well. A static attribute is declared by using the CLASS-
DATA statement.
11.4 Methods

A method is a function or procedure that represents the behavior of an object in the class.
The methods of the class can access any attribute of the class. The definition of a method
can also contain parameters so that you can supply the values to these parameters when
methods are called. The definition of a method is declared in the class declaration and
implemented in the implementation part of a class. The METHOD and ENDMETHOD
statements are used to define the implementation part of a method. The following syntax
shows how to implement a method −
METHOD <m_name>.
..........
..........
ENDMETHOD.
Accessing Attributes and Methods
Class components can be defined in public, private, or protected visibility sections that
control how these components could be accessed. The private visibility section is used to
deny access to components from outside of the class. Such components can only be
accessed from inside the class such as a method.
Components defined in the public visibility section can be accessed from any context. By
default, all the members of a class would be private. Practically, we define data in the
private section and related methods in the public section so that they can be called from
outside of the class as shown in the following program.
● The attributes and methods declared in the Public section in a class can be
accessed by that class and any other class, or sub-class of the program.
● When the attributes and methods are declared in the Protected section in a
class, those can be accessed by that class and sub-classes (derived
classes) only.
● When the attributes and methods are declared in the Private section in a
class, those can be accessed by only that class and not by any other class.
11.5 Constructors
They are special methods that are called automatically, either while creating an object or
accessing the components of a class. The constructor gets triggered whenever an object
is created, but we need to call a method to trigger the general method. In the following
example, we have declared two public methods method1 and constructor. Both these
methods have different operations. While creating an object of the class, the constructor
method triggers its operation.

11.6 ME Operator in Methods

When you declare a variable of any type in the public section of a class, you can use it in
any other implementation. A variable can be declared with an initial value in the public
section. We may declare the variable again inside a method with a different value. When
we write the variable inside the method, the system will print the changed value. To reflect
the previous value of the variable, we have to use the ‘ME’ operator.
User Exits and Enhancements

Definition of USEREXIT
Userexit allow us to add our own functionality to SAP standard program without modifying
it . These are implemented in the form of subroutines and hence are also known as FORM
EXITs. The userexits are generally collected in includes and attached to the standard
program by the SAP.
All Userexits start with the word USEREXIT_...FORM USEREXIT_..z..ENDFORM.
The problem lies in finding the correct userexit and how to find it if one exists for the
purpose. Once the correct userexit is found the necessary customer code is inserted in
the customer include starting with the z in the form routine.
e.g. USEREXIT_SAVE_DOCUMENT_PREPARE
Certain application like SD still provide this form of enhancement using userexit but this
practice is no longer being followed for newer extensions instead they are using EXITs
which come bundled in enhancement packages. Nevertheless existing USEREXITS will
be supported by SAP an all the newer versions of SAP.

How to find USEREXITS


1) To find userexits in SD module , goto object navigator(SE80) and select
development class from the list and enter VMOD in it. All of the userexits in SD are
contained in the development class VMOD. Press enter and you will find all the
includes which contain userexits in SD for different functions like PRICING,
ORDER PROCESSING etc. Select the userexit according to the requirement and
read the comment inserted in it and start coding .
2) The other method of finding userexit is to find the word USEREXIT in the
associated program of the transaction for which we want to determine userexit
using SE38.
3) The other method of finding userexits is to find the include in case of SD/MM
applications where the userexits are located ,this can be found in the SAP
reference IMG generally in the subfolder under SYSTEM MODIFICATION.
Some other examples of userexits in SD are:
USEREXIT_NUMBER_RANGE
This userexit is used to assign a different internal document number to the sales
order(VA01) when it is created depending on some criteria like a different SALES
ORGANIZAION(VKORG) .
USEREXIT_SAVE_DOCUMENT_PREPARE
This userexit is used to insert the ABAP code which will be called when the
document (sales order VA01) is just about to be saved.This userexit is used
generally for custom checks on different fields , to display some information before
the order will be saved or for making changes to certain fields before the sales
order will be saved.
Definition of Enhancements
The Enhancement Framework provides a technology for enhancing source code units
without modifying them. The basic mechanism is to offer the so-called enhancement
options in development objects. These enhancement options function like "hooks" where
you can attach your enhancements. The enhancement options are part of the
development objects which can be enhanced. When you assign an enhancement to an
enhancement option, at runtime the enhancement is processed when the control flow
reaches the option. At runtime the enhancement behaves as if it belongs to the
development object it enhances, while the enhancement as a transport object does not
belong to the enhanced object.

The Basic Advantages of Enhancements over Modifications


Enhancements result in far less work during an upgrade compared to modifications.
Enhancements are transport objects in their own right that can be stored in packages of
their own unlike modifications, which are part of the object they modify. Since during an
upgrade all SAP objects are replaced by the new version of these objects, after the
upgrade all modifications are gone. This results in customers having to adjust all
modifications no matter whether the underlying object has changed or not.
In contrast, customer enhancements as transport objects are never overwritten during an
upgrade because they are stored in customer packages in the customer namespace. It
may happen that the new version of a development object is no longer compatible with an
enhancement, if for example an enhanced object is deleted or a data type used in the
enhancement does no longer exist. In these cases, the relevant tools of the Enhancement
Framework provide the information which enhancements have to be adjusted and offer
tool support to do so.
After an upgrade, customers still have to adjust enhancement but these are only the
enhancements that are no longer compatible with the new version of the object they
enhance, but have to touch every single modification in a system. So enhancements are
far more robust during upgrade.
Types of Exits
There are six types of EXITS as shown below:
• MENU EXITS
• FUNCTION EXITS
• TABLE EXITS
• SCREEN EXITS
• KEYWORD EXITS
• FIELD EXITS

We use SAP transactions CMOD and SMOD to manage exits. Before implementing an
exit , it is required to create the project by using CMOD selecting the enhancement e.g.
V45A0002 and selecting the component (one which fulfills our need) i.e the exit which will
be implemented in SMOD and after coding has been done the project has to be activated.
An exit can be coded only once.

You might also like