unit 2 - object navigator, repository and abap programs

36
Unit 2: Introduction to the ABAP Workbench

Upload: dubon07

Post on 13-Apr-2017

106 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Unit 2 - Object Navigator, Repository and ABAP Programs

Unit 2: Introduction to the ABAP Workbench

Page 2: Unit 2 - Object Navigator, Repository and ABAP Programs

•This lesson gives a short description of the Repository and a brief overview of the most important components of the ABAP Workbench. It presents the Object Navigator as a central development tool.

Lesson: Repository and Object Navigator

Lesson Overview

Page 3: Unit 2 - Object Navigator, Repository and ABAP Programs

•Describe the structure of the Repository, use suitable tools to search for Repository objects and analyze their structure.

Business Example

Page 5: Unit 2 - Object Navigator, Repository and ABAP Programs

•The Repository consists of all system development objects - programs, function modules, definitions of database tables, and so on.

• In the Repository, you have objects delivered by SAP as well as objects defined by the customer.

•The Repository is in the database

Page 6: Unit 2 - Object Navigator, Repository and ABAP Programs

•The Repository is subdivided according to application components. (Commonly known as ‘modules’)

•Within a module (e.g., MM) there are several packages containing relevant objects for a more detailed logical subdivision.

•Whenever a Repository object is created, it must be assigned to a package.

Page 7: Unit 2 - Object Navigator, Repository and ABAP Programs

Working with the Object Navigator

•The ABAP Workbench includes all tools required for creating and editing Repository objects.

•These tools cover the entire software development cycle.

Page 8: Unit 2 - Object Navigator, Repository and ABAP Programs

•The most important tools are:▫The ABAP Editor for editing source code▫The ABAP Dictionary for editing database table definitions, central data

types, and so on▫The Screen Painter for configuring screens (screens together with functions

for user dialogs)▫The Menu Painter for designing user interfaces (menu bar, standard

toolbar, application toolbar, function key settings)▫The Function Builder for maintaining function modules▫The Class Builder for maintaining global classes and interfaces

Page 9: Unit 2 - Object Navigator, Repository and ABAP Programs

•You can call each of these tools explicitly and then load a Repository object for processing. But it is much more elegant and convenient to access them using the Object Navigator.

•The Object Navigator screen is split into two areas:▫The navigation area for displaying a hierarchical object list▫A tool area for displaying and editing a development object using the

appropriate tool

Page 10: Unit 2 - Object Navigator, Repository and ABAP Programs

•Object lists are displayed in the navigation area. For example, if you choose to display a package there, all of the Repository objects belonging to the specified package are listed.

•You can display or hide the navigation area. (.Full screen on/off.)

•Double-clicking a listed object lets you display or edit it.

•You can add frequently used object lists to your favorites.

Working with the Navigation Area

Page 11: Unit 2 - Object Navigator, Repository and ABAP Programs

Functions in the Tool Area

• In the tool area, a Repository object is displayed in the corresponding tool.

•You can navigate between the objects that have been previously displayed in the current Object Navigator session (blue arrows).

•When you double-click an object in the navigation history, it is displayed in the tool area.

Page 12: Unit 2 - Object Navigator, Repository and ABAP Programs

Synchronizing the Navigation and Tool Areas If necessary, you can synchronize both areas as follows:•You can display an object in the tool area by double-clicking in the

navigation area or by using the corresponding context menu function of the object.

•You can display the object list of an object that you are currently editing in the tool area by choosing Display Object List in the navigation area.

•To create a new object, you can use the context menu for an object type in the corresponding object list. Alternatively, you can use the Edit Object or Other Object ... buttons to create any objects you want.

Page 13: Unit 2 - Object Navigator, Repository and ABAP Programs

•Describe the structure of the Repository•Name and use the search tools of the Repository•Use the Object Navigator for displaying Repository objects

You should now be able to:

Page 15: Unit 2 - Object Navigator, Repository and ABAP Programs

•You are to create a new package and ABAP programs within the framework of a development project.

Business Example

Page 16: Unit 2 - Object Navigator, Repository and ABAP Programs

Organizing Developments

•Development projects are carried out in a development system. The development objects edited or created in a project are transported to subsequent systems (test and/or production system) on project completion.

Transporting Development Objects

Development System

Production System

New developments

and Objects

Change Request

Page 17: Unit 2 - Object Navigator, Repository and ABAP Programs

•At the start of a development project the project manager creates a change request in the Transport Organizer (Transaction SE01)

•The Transport Organizer then creates a task for each developer in the change request.

•When a development object is edited or created, the developer assigns this to the change request.

•The object is entered into the task of the developer.•All repository objects that a developer works on during a project are

collected within his or her task.

Page 18: Unit 2 - Object Navigator, Repository and ABAP Programs

Creating Packages

1. Navigate to the Object Navigator.

2. Create the attributes of the package to be created.

3. Assign the package to a change request.

Page 19: Unit 2 - Object Navigator, Repository and ABAP Programs

• Is typed•Enables multi-language applications•Enables SQL access•Has been enhanced as an object-oriented language• Is platform-independent• Is upward-compatible

Introduction to the ABAP Programming Language

Page 20: Unit 2 - Object Navigator, Repository and ABAP Programs

•ABAP programs are made up of individual statements.•The first word in a statement is called an ABAP keyword.•Words must always be separated by at least one space.•Each statement must end with a period.•Statements can be indented.•Statements can take up more than one line.•You can have multiple statements in a single line.

Page 21: Unit 2 - Object Navigator, Repository and ABAP Programs

•For indentations and for converting uppercase/lowercase letters, you can use the Pretty Printer (the correspondingly labeled button in the Editor).

•Comment lines are introduced with an asterisk *. The code generator recognizes the corresponding line as a comment so that it will be ignored by the runtime system.

• If you wish to have the rest of a line set as a comment, you must use double quotation marks ".

Page 22: Unit 2 - Object Navigator, Repository and ABAP Programs

• If there are several ABAP statements, the ABAP runtime system writes the corresponding return code into the system field SY-SUBRC in order to provide information as to how successfully the particular statement was executed.

•The value zero means that the statement was successful. = 0

•Other value different from zero means an error, warning or exception occurred. <> 0

Page 23: Unit 2 - Object Navigator, Repository and ABAP Programs

•There are various ways of navigating to the documentation for an ABAP statement:

•The F1 key takes you directly to the documentation for the statement on which the cursor is positioned.

•The i button with the description Help on ... takes you to a dialog box where you can enter the required ABAP statement.

Page 24: Unit 2 - Object Navigator, Repository and ABAP Programs

1. Navigate to the Object Navigator.(Transaction SE80)3 options are available:

▫In the navigation area, choose the object type Program and enter the name of the program in the input field below.

▫Display the package where you want to create the program▫Choose the Edit Object button on the initial screen of the Object Navigator.

2. Change the title to a self-explanatory short text and choose Executable Program as the program type.

Developing an ABAP Program

Page 25: Unit 2 - Object Navigator, Repository and ABAP Programs

The ABAP Editor

Line numbers

Blocks that can be compressed Current line

Differente colors for keywords

Current nesting User specific settings

Page 26: Unit 2 - Object Navigator, Repository and ABAP Programs

Activating Programs•Whenever you create a development object, or change and then save it, the

system first stores only one inactive version in the Repository.

•At the end of your development, you have to activate the inactive version of the object.

•This version becomes the new active version of the object.

Page 27: Unit 2 - Object Navigator, Repository and ABAP Programs

•The request release and the transport of the developed objects are only possible if all objects in the request have been activated.

• If your program is available in both versions (active and inactive), you can switch between the displays of these two versions.

•Whenever you activate a program, the system first displays a list of all inactive objects that you have processed. This is called the worklist.

Page 28: Unit 2 - Object Navigator, Repository and ABAP Programs

The activation of an object includes the following functions:

•Saving the object as an inactive version•Syntax or consistency check of the inactive version•Overwriting the previously active version with the inactive version (only

after a successful check)•Generating the relevant runtime object for later executions, if it is a

program.

Page 30: Unit 2 - Object Navigator, Repository and ABAP Programs

1. In the Object Navigator, display the object list for your program.2. In the navigation area, use the context menu of the program to

choose Create→ More → Transaction.3. Enter the required transaction code.4. Assign a short text and choose the label Program and Selection Screen

(Report Transaction) .5. Enter the name of the program and choose Professional User

Transaction.6. Under GUI enabled set the indicator SAP GUI for Windows.7. Save the transaction.8. Assign it to a package and to a change request.

Page 31: Unit 2 - Object Navigator, Repository and ABAP Programs

1. Navigate to the initial screen (SAP Easy Access Menu).2. In the Favorites context menu, choose Insert Transaction.3. In the dialog box that appears, enter the required transaction code.

Adding Transactions to your Personal Favorites

Page 32: Unit 2 - Object Navigator, Repository and ABAP Programs

•Once a user has completed the required development task, he or she carries out a quality check and releases the task within the change request.

•The corresponding object entries are transferred from the task to the request.

•However, other developers can still edit these objects.•Once all tasks of a change request have been released the change

request is released.•This concludes the project.

Closing Development Projects

Page 34: Unit 2 - Object Navigator, Repository and ABAP Programs

•Create Your First Program •Declare a variable•Keyword Constants•Assign a value•Write Statement•Use TAB key for autocomplete.

Procedure: Creating an ABAP Program

Page 35: Unit 2 - Object Navigator, Repository and ABAP Programs

•Create your first table•Enter data into your table•View the data in your table

Procedure: Creating Tables

Page 36: Unit 2 - Object Navigator, Repository and ABAP Programs

Your assignment is to:

•Create a program to list all related flight information .•Assign a transaction in the SAP easy access menu Favorites.•Organize the objects inside a package and release the development for

transportation.

Unit 2: Case Study – Flight Information Report