Sap R/3 Abap/4 Training Manual: 5101 Camden Lane, Pearland, TX 77584
Sap R/3 Abap/4 Training Manual: 5101 Camden Lane, Pearland, TX 77584
Sap R/3 Abap/4 Training Manual: 5101 Camden Lane, Pearland, TX 77584
com
Course Outline
Section – A
1. Introduction to ABAP
1.1. What is SAP R/3
1.2. SAP R/3 architecture and where ABAP fits in
Section – B
3. Reports Statement
3.1. Line Size
3.2. Line-count
3.3. Message
3.4. Page Heading
3.5. Report Comment Section
4. Declarations
4.1. Tables
4.2. Includes
4.3. Variables (Data Types and Data Objects)
4.4. Structures
4.5. Internal Tables
4.6. Constants
6. Program Events
6.1. Initialization
6.2. Start of Selection and End of Selection
6.3. At Selection Screen
6.4. At Line Selection
6.5. At User – Command
7. Data Retrieval
7.1. Select Statement
7.2. Using the Select Statement for Single Line
7.3. Using the Select Statement for Several Lines
7.4. Using the Select Statement for Internal Table
7.5. Tables / Internal Table Operations
8. Processing Data
8.1. Assignment Statements
8.2. Arithmetic Expressions and Mathematical Functions
8.3. String Processing
8.4. Type Conversions
8.5. Logical Expressions
www.LearnSAP.com
Section – C
10.Types of Program Analysis
10.1.Static Checks
10.2.Dynamic Checks and Short Dump Analysis
11.Debugger
11.1.Breakpoints in Programs
11.2.Breakpoints in the Debugger
11.3.Watchpoints
12.Performance Tools
12.1.Runtime Errors
12.2.SQL Trace
Section – D
13.External Data Access
13.1.Upload and download data from / to presentation server
13.2.Upload and download data from / to application server
13.3.Write a data extract program
Section – E
15.Dialog Application
15.1.Create a Module Pool
15.2.Create a Transaction
16.Screen Painter
16.1.Use Screen painter to design a Screen
16.2.Arrange Data Dictionary elements of the screen
16.3.Set the OK-CODE
17.Menu Painter
17.1.Create GUI Status
17.2.Create a Menu Bar for a Screen
www.LearnSAP.com
Section – F
19.ABAP Query
19.1.Understand core functionality of SAP R/3 ABAP Query.
19.2.Explain the relationship between a user group, info set and query report.
19.3.Utilize the appropriate user groups and Info Sets to develop Queries.
19.4.Create all three types of SAP query. Basic List, Statistic and ranked list.
www.LearnSAP.com
Section – A
ABAP Workbench Overview
Objectives
• Understand the use of ABAP/4 in developing SAP Application
• Become familiar with the ABAP Workbench Tools
• Become Familiar with the features of
Object Navigator
ABAP Editor
Change and Transport System
Data Dictionary
Menu Painter
Screen Painter
Table of Contents
Section – A
1. Introduction to ABAP
1.1. What is SAP R/3?
1.2. SAP R/3 Architecture and where ABAP fits in
1.3. The Major Common Uses of ABAP/4
1. Introduction to ABAP
ABAP (Advanced Business Application Programming) is the programming language used by SAP
developers to build transactions that make up the R/3 application. Its also used by companies to
customize the R/3 application i.e. providing additional business functionality.
does not have any input fields. In our example, it would contain a list of the sales that
occurred within the specified date range. The selection screen is optional. Not all reports
have one. However, all reports generate a list.
b. Interface – a program that moves data into SAP – BDC, Call Transaction or reads data
from SAP and writes it to a system file to be transferred to an external computer system
e.g. a legacy mainframe – DATA EXTRACT
c. Custom Transaction – a program similar to SAP transactions to fulfill some business
function not provided by SAP – Dialog Programming.
All development objects created with the development tools found in the ABAP Workbench are
classified as Repository Objects and are stored centrally in the R/3 Repository.
The R/3 Repository is a special part of the SAP system’s central database. The Repository is
organized according to application. Each application is further divided into logical subdivisions
called development classes.
Repository objects are often made up of sub-objects that are themselves Repository objects.
Each Repository object must be assigned a development class when it is created.
Naming Standards
The company you work for is a customer of SAP. Therefore, programs that you create at your
company are called customer programs. For programs, the customer name range is two to forty
characters long and the program name must start with the letter Y or Z. SAP reserves the letters
A through X for their own programs.
Object Navigator automatically calls other tools when actions require them. For example, creating
a new program from the Object Navigator screen. The Object Navigator calls the ABAP Editor
and, after creating the program, returns back to the Object Navigator screen.
www.LearnSAP.com
An entire application can be created using the Object Navigator without directly calling any of the
other tools. In fact, the recommended method for creating an application is from the Object
Navigator because you can see what you build. The Object navigator provides an overview of all
the elements in an application and access to all necessary administration tools from one single
interface.
www.LearnSAP.com
Menu Path:
SAP Main Screen > Tools > ABAP Workbench > Overview > Object Navigator (Double Click)
Another way to reach the Object Navigator is to from the SAP Main Screen enter the transaction
SE80 into the transaction field and press Enter
Either way the Object Navigator is displayed. There are two input fields on this screen.
Object List Group – This contains a list of the objects contained within this environment: Local
Objects, Application Hierarchy Program, Development Class, Function Group, Class/Interface,
Internet Service. Select Local Objects in this field.
www.LearnSAP.com
If you select the down-arrow key in the second input field, object group selected in the first field
will be displayed. Click on the Display input field.
If the program already exists, it will be display under the object list. If it doesn’t exist, a dialog box
pops open, click the YES pushbutton for SAP to create the program.
www.LearnSAP.com
As soon as you click on YES another dialog box pops open querying about the program structure
either as an individual file or a framework program for includes. Large programs can be split up
into several sub programs (includes).
For now deselect the “With TOP INCL” flag. Click on Enter to continue
If this is the first time ever you are creating an ABAP program, another dialog window will pop
open requesting you to enter the Access Key so this user can be added as a Developer. Enter
your 20 Character access key here and click on continue. ( Note: this dialog only pops up once. )
A new template pops up where you will define the important attributes of the new application.
There are three important fields that must be maintained. And these are;
Title: Short description of the program. The program name comes up as default in this field. You
can add more text to it. For example Khans First ABAP Program
Program Type: Chose Executable program. Reports are usually this type.
Other fields are optional: status, authorization groups, logical database. After entering all the
values, click on SAVE.
When you save a new object for the first time, the system displays a correction and transport
dialog box. Here the Development Class field needs to be maintained. See section 2.2.5 and
section 2.2.4 on Workbench. For now click the local object pushbutton.
www.LearnSAP.com
You will be returned to the opening screen of the object navigator. Go to the course code screen
by double clicking on the object name.
Source code appears in display mode with just one line of code “report” and “report name”. To
switch from display mode to change mode click on the pencil mark
Place cursor after the period at the end of first sentence and press enter to get you to the next
line. Type WRITE ‘Hello World!’.
www.LearnSAP.com
A list is produced. To go back to the editor from the report output window, click on the back arrow
or F3 function key.
Menu Path:
SAP Main Screen > Tools > ABAP Workbench > Development > ABAP Editor (Double Click)
1. Source Code
2. Attributes
3. Text Elements
4. Documentation
5. Variants
Only the source code and program attributes components are required. The rest of the
components are optional, they will be looked at in another section.
All development objects and their components are stored in the R/3 Database. ABAP/4 programs
are interpreted; they are not compiled. The first time you execute a program, the system
automatically generates a runtime object. The runtime object is a pre-processed for of the source
code. However, it is not an executable that you can run at the operating system level. Instead, it
requires the R/3 system to interpret it. The runtime object is also known as the generated form of
the program. If you change the source code, the runtime object is automatically regenerated the
time you execute the program.
1. Front-end Editor
2. Back-end Editor
Front-end Editor
The front-end editor uses the SAP Textedit Control from the SAP Control Framework. It loads
your source code onto the front-end and allows you to perform many tasks without any
communication with the application server.
In the front-end editor, the ABAP source code is loaded onto the front-end and edited locally. The
advantage of this is that all editing functions that do not require communication with the backend
can be performed very quickly.
Back-end Editor
The back-end editor allows you to use the traditional back-end editor for editing your ABAP code.
The editor is line-based, and to use normal editor functions such as cut, copy and paste, you
must first select a block of lines. If is often useful to use the clipboards in this mode. If you have a
very long program (and specially if you are working in a WAN environment), the back-end editor
can produce better performance than the front-end editor. Furthermore, back-end editor allows
you to edit any development object that is based on the ABAP Editor.
You can change the mode from front-end to back-end by doing the following steps. To change the
editor mode from anywhere in the ABAP workbench: Chose utilities > settings.
www.LearnSAP.com
The User Specific Settings dialog box appears. Choose ABAP Editor. Set the editor mode to
back-end editor.
5. Enter the path and filename of the file you want to read in the dialog box, then
choose copy.
Version
These fields are used for version administration. The system fills them.
Title
In the required entry field “TITLE” enter a program description that describes the function of the
program. Thus, you can edit the title when maintaining the text elements.
Maintenance Language
The maintenance language is the logon language of the user who creates the program. The
system fills this field automatically. You can change the maintenance language. If you maintain
the program or its components in another logon language.
Type
In the Type Field you must specify the execution mode of your program.
Use Type 1 (report) to declare your program as executable. This means that program can
run on its own, and that you can start it in the R/3 system without a transaction code. You
can also run executable programs (reports) in the background.
Use Type M to declare your program as a module pool. This means that your program
cannot run on its own, but serves as a frame for program modules used for dialog
programming.
User Type I for include program. An include program is an independent program with two
main functions: On one hand, it contains program code that can be used by different
programs. On the other hand, it modularizes source code, which consists of several
www.LearnSAP.com
different, logically related parts. Each of these part is stored in different include program.
Include programs make your source code easier to read and maintain.
Status
This entry describes the status of the program development, for example, T for test program.
Application
This field contains the short form of your application, for example, F for Financial accounting. This
required entry enables the system to allocate the program to the correct business area.
Authorization Group
In this field, you can enter the name of a program group. This allows you to group different
programs together for authorization checks. The group name is a field of the two authorization
objects S_DEVELOP (program development and program execution) and S_PROGRAM
(program maintenance). Thus you can assign authorization to users according to program
groups. For more information about creating function modules, refer to the Users and
Authorization documentation.
Development Class
The development class is important for transports between systems. You combine all Workbench
objects assigned to one development class in one transportation request. If you are working in a
team you may have to assign your program to an existing development class, or you may be free
to create a new class – section 2.3.1 on Workbench Organizer covers this. All programs assigned
to the development class $TMP are private objects and cannot be transported into other systems.
You can enter the development class directly into this field. Otherwise, the system prompts for it
when you save the attributes.
Choosing Local Objects is equivalent to entering $TMP in the field Development Class. You can
change the development class of a program later on by choosing Object Directory Entry from the
GOTO menu, click change, type in the desired development class.
If you want to use a different selection screen, enter the number here (not 1000, since this is
reserved for the standard selection screen). The number must be smaller than 1000 and
correspond to an additional selection screen of the logical database. The possible values help
displays a list of available selection screens. You can also look in the selection include of the
logical database (Program DBxxxSEL, where xxx is the name of the logical database).