The interface accepts input from the user in the form of keystrokes, mouse-clicks, and functionkeys, and sends these requests to the application server to be processed.. Amount of memory
Trang 8Having taught the ABAP/4 certification course to hundreds of beginners andexperienced developers at both at SAP and at other institutions, I know the kind
of problems and questions you will have when learning this powerful language
By incorporating all the best techniques that I have encountered into this book, Ihope to impart that same learning experience to you as well To that end, thisbook is chock full of detailed diagrams, full-screen snapshots, working sampleprograms, narrated screencams, and step-by-step procedures All the sampleprograms are also supplied on the CD-ROM so that you can upload and run them
on your own system In addition, the utilities that I supply to all of my classesare included on the CD-ROM, plus some new ones that I have written
specifically for the buyers of this book
ABAP/4, for all of its simplicity on the surface, is a complex language
underneath Because of that, the beginner is often bewildered by its behavior Byunderstanding how it works below the surface, you will be able to master thislanguage By understanding the hows and whys, you will gain an understandingfew have in this exciting field
This book will guide you through the intricacies of the ABAP/4 language andenvironment one step at a time After you complete each chapter, you will bepresented with exercises to reinforce your learning Working solutions are
provided for all exercises on the CD-ROM
As experienced programmers know, and beginners soon find out, creating
ABAP/4 programs often means creating more than just a program It frequentlyinvolves the creation of development objects to support it Procedures for
creating these objects are all explained in exquisite detail using a list of
numbered steps Each step contains the title of the screens you encounter and theexpected responses to each command All procedures are accompanied by ascreencam showing you exactly how it is done Now, not only can you learn bywatching me, but you can fast forward and rewind me as well
The sheer volume of information needed to master ABAP is a daunting task formost, but I have taken the most vital information that you need and separated itinto 21 manageable bites With the knowledge you gain using this book, you will
be able to branch out to complex ABAP/4 tasks with a solid understanding as
Trang 9As you go through the material, if you have problems or questions please visitthe Internet site http://www.abap4.net There I will post answers to frequentlyasked questions, and problems you may encounter that have not been covered Ifyou find an error in this book, or suspect there may be an error, you can find andpost errata there
Each chapter ends with questions pertaining to that day's subject matter, withanswers from the author Most chapters also include an exercise section and aquiz designed to reinforce the day's concepts (The answers appear in AppendixB.)
Trang 11be sent to cadillac@mindless.com.
Trang 12As the reader of this book, you are our most important critic and commentator.
We value your opinion and want to know what we're doing right, what we could
do better, what areas you'd like to see us publish in, and any other words ofwisdom you're willing to pass our way
As the Executive Editor for the Client/Server Database team at Macmillan
Computer Publishing, I welcome your comments You can fax, email, or write
me directly to let me know what you did or didn't like about this book-as well aswhat we can do to make our books stronger
Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able
to reply to every message.
When you write, please be sure to include this book's title and author as well asyour name and phone or fax number I will carefully review your comments andshare them with the author and editors who worked on the book
Trang 14Sams Teach Yourself ABAP/4 ® in 21
Days
Trang 15Understanding the Logon Client
Understanding Client-Dependent and Client-Independent TablesUsing SAP's Open SQL
Portability
Buffering Data on the Application Server
Automatic Client Handling
Summary
Trang 16WorkshopQuizExercise 1
Trang 17After you complete this chapter, you should be able to answer the followingquestions:
Trang 18R/3 is an integrated suite of applications designed to handle the data processingfor large corporations It was developed in Germany by the company namedSAP (an acronym for Systems Applications and Products for data processing)
R/3 is the system in which your ABAP/4 programs will run Logically, it lookslike Figure 1.1
Figure 1.1 : Application modules are all written in ABAP/4, which is interpreted
by Basis executables, which in turn, run on the operating system.
What is the Purpose of R/3?
The sole purpose of an R/3 system is to provide a suite of tightly integrated,large-scale business applications A few of these can be seen at the top of Figure1.1 The standard set of applications delivered with each R/3 system are thefollowing:
PP (Production Planning)
MM (Materials Management)
SD (Sales and Distribution)
FI (Financial Accounting)
Trang 19Traditionally, businesses assemble a suite of data processing applications byevaluating individual products and buying these separate products from multiplesoftware vendors Interfaces are then needed between them For example, thematerials management system will need links to the sales and distribution and tothe financial systems, and the workflow system will need a feed from the HRsystem A significant amount of IS time and money is spent in the
implementation and maintenance of these interfaces
R/3 comes prepackaged with the core business applications needed by most largecorporations These applications coexist in one homogenous environment Theyare designed from the ground up to run using a single database and one (verylarge) set of tables Current production database sizes range from 12 gigabytes tonear 3 terabytes Around 8,000 database tables are shipped with the standarddelivery R/3 product
Why Do You Need to Know This?
This is important for you, as an ABAP/4 programmer, to know because theseapplications are all written entirely in ABAP/4 These are the applications youmust understand to be a proficient developer in R/3
For example, assume you know ABAP/4 and you have been asked to write afinancial report summarizing debits and credits by fiscal year for each vendor inthe enterprise You might know how to code in ABAP, but would you know how
to begin to solve such a request?
Trang 20of the highly integrated nature of the R/3 environment
I only point this out because many developers who wish to become independentconsultants think that learning ABAP/4 is all they need to develop in the R/3system It is certainly a great start, but it is only the start The importance oftraining in a functional area can be overlooked or unknown to those interested inbecoming proficient ABAP/4 consultants Obviously, much of this learning canand will be done on the job However, I hope to illustrate the point that learningthe ABAP/4 language is only the beginning of a long journey into SAP If youdesire to be successful as an independent consultant, you will eventually need toacquire functional area knowledge
Trang 21In a Windows environment, you will sign on to R/3 either by choosing a menupath from the Start menu, or by double-clicking on an R/3 icon, such as the oneshown below in Figure 1.2
Figure 1.2 : The R/3 icon on the desktop.
The R/3 system will prompt you for a user ID and password The logon screenappears in Figure 1.3 You will fill in these two fields and then press Enter
Figure 1.3 : The R/3 logon screen prompts you for a password.
The R/3 system will then display a copyright screen, and when you press Enter,the system will display the R/3 main menu as shown in Figure 1.4
In the Basis area, you can run transactions that monitor the R/3 system itself Toaccess the Basis area, from the main menu choose the menu path Tools-
>Administration Here you will find many performance, tuning, and databaseadministration tools
The Development Workbench is used to create and test ABAP/4 programs As
an ABAP/4 programmer, you will spend most of your time within the
Workbench To access the Development Workbench, choose the menu path
Trang 22or update application data, and so it will be destined to become part of the
application area With that in mind, let's have a look within an Applications areafirst
For our example, imagine that you are a clerk working in an accounts payabledepartment A vendor calls to say his address has changed You put a bookmark
Change Vendor: Initial screen
Figure 1.6 : The menu path to update a vendor master record (part 2).
From the Initial screen shown in Figure 1.7, you type his vendor number,
tickmark the Address check box, and press the Enter key You will then see theAddress screen (see Figure 1.8)
Figure 1.10: The Initial Screen gives verification that the address change was
made.
This transaction is representative of many of the transactions in the R/3 system
Trang 24number, insert/overtype mode indicator, and the current time
You can turn most screen elements on and off If your screen does not look orbehave like the one described in this chapter, follow the instructions in the nextsection to correct it
Working with the Interface Menu
The icon with three colored circles in the upper right-hand corner of the R/3
window is called the Interface Menu With it, you can customize user interface
settings such as screen colors, font sizes, and cursor behavior To accomplishthis, click once on the icon in the upper right-hand corner of the R/3 window(see Figure 1.12) A menu will appear; click on the Options menu item
Figure 1.12: The Interface Menu with the Options menu item highlighted.
Click on the General tab and change your settings to match those shown inFigure 1.13 Doing so will ensure that your user interface will look and behave
as described in this book
Figure 1.13: The General Interface options.
Turn on all of the toolbars (tickmark them all) and set Quick Info to Quick.Tickmark the first and last of the message check boxes as shown Click Apply
TIP
You must click the Apply or OK button before choosing another tab
If you do not, your changes will not take effect
Click on the Colors In Lists tab and tickmark the Lines In Lists check box asshown in Figure 1.14 Click OK to return
Figure 1.14: Tickmarking the Colors In Lists check box.
The Lines In Lists option turns on or off the display of horizontal and verticallines in your report output It should be checked so that you will see the effect of
Trang 26
For example, from the R/3 main menu, choose the menu path Accounting->Financial Accounting->Accounts Payable You will see the Accounts Payablescreen From here, choose the menu path Master Records->Display You will seethe Display Vendor: Initial Screen Choose the menu path System->Status Youwill see the System:_Status screen In the Transaction field is the transactioncode for this screen: FK03
Now that you have the transaction code, you can start this transaction from anyscreen by entering in the command field /n followed by the transaction code
For example, return to the main menu (click the Cancel button twice and thenclick the Back button) In the command field type /nfk03, then click the Enterkey You will immediately see the Display Vendor: Initial Screen
TIP
On any screen, you can find the transaction code of the current
transaction To do this, choose the menu path System->Status
Trang 27Basis, in some respects, is like the Windows environment Windows starts up,and while running it provides an environment in which Windows programs canrun Without Windows, programs written for the Windows environment cannotrun
Basis is to ABAP/4 programs as Windows is to Windows programs Basis
provides the runtime environment for ABAP/4 programs Without Basis,
ABAP/4 programs cannot run When the operator starts up R/3, you can think ofhim as starting up Basis Basis is a collection of R/3 system programs that
present you with an interface Using this interface the user can start ABAP/4programs
To install Basis, an installer runs the program r3inst at the command-promptlevel of the operating system Like most installs, this creates a directory structureand copies a set of executables into it These executables taken together as a unitform Basis
Trang 28ABAP/4 programs run within the protective Basis environment; they are notexecutables that run on the operating system Instead, Basis reads ABAP/4 codeand interprets it into operating system instructions
ABAP/4 programs do not access operating system functions directly Instead,they use Basis functions to perform file I/O and display data in windows Thislevel of isolation from the operating system enables ABAP/4 programs to be
ported without modification to any system that supports R/3 This buffering is
built right into the ABAP/4 language itself and is actually totally transparent tothe programmer
Basis makes ABAP/4 programs portable The platforms that R/3 can run on areshown in Table 1.1
Table 1.1 Platforms and Databases Supported by R/3 Operating
Systems
Supported Hardware
Supported Front-Ends
Supported Databases
AIX SINIX IBM SNI SUN Win 3.1/95/NT DB2 for AIX
Windows NT AT&T Compaq Win 3.1/95/NT Oracle 7.1
Trang 29Windows 95 interface Or, it could run on an AS/400 with a DB2 database usingOS/2 as the front-end
SAP also provides a suite of tools for administering the Basis system Thesetools perform tasks such as system performance monitoring, configuration, andsystem maintenance To access the Basis administration tools from the mainmenu, choose the path Tools->Administration
Here are some examples of Basis administration tools:
To see a list of the servers currently running in your R/3 system, choose themenu path Tools->Administration, Monitoring->System Monitoring-
minutes (look at Av Response Time)
Basis is designed to run in a client/server configuration
Trang 30Figure 1.16 shows the three standard client/server configurations R/3 can betailored to run in any of these configurations
The client/server configuration enables the R/3 system to spread its load acrossmultiple computers This provides the customer with the ability to scale theprocessing power of the system up or down by simply adding another computer
to an existing configuration, instead of replacing a single computer that performs
Trang 31all of the processing, such as that which occurs in the mainframe world.
Trang 32SAP based the architecture of R/3 on a three-tier client/server model The R/3system architecture appears in Figure 1.17
Figure 1.17: The R/3 system architecture.
Presentation Server
The presentation server is actually a program named sapgui.exe It is usuallyinstalled on a user's workstation To start it, the user double-clicks on an icon onthe desktop or chooses a menu path When started, the presentation server
displays the R/3 menus within a window This window is commonly known as
the SAPGUI, or the user interface (or simply, the interface) The interface
accepts input from the user in the form of keystrokes, mouse-clicks, and functionkeys, and sends these requests to the application server to be processed Theapplication server sends the results back to the SAPGUI which then formats theoutput for display to the user
single configuration file called the application server profile.
Each application server has a profile that specifies its characteristics when itstarts up and while it is running For example, an application sever profile
specifies:
Trang 33Amount of memory each process may use
Length of time a user is inactive before being automatically logged off
The application server exists to interpret ABAP/4 programs, and they only runthere-the programs do not run on the presentation server An ABAP/4 programcan start an executable on the presentation server, but an ABAP/4 program
cannot execute there
If your ABAP/4 program requests information from the database, the applicationserver will format the request and send it to the database server
Discovering the Database Server
The database server is a set of executables that accept database requests from
the application server These requests are passed on to the RDBMS (RelationDatabase Management System) The RDBMS sends the data back to the
database server, which then passes the information back to the application server.The application server in turn passes that information to your ABAP/4 program
There is usually a separate computer dedicated to house the database server, andthe RDBMS may run on that computer also, or may be installed on its own
common configuration for large systems, and is common in production
In the distribution presentation configuration, the application and database
servers are combined on one computer and the presentation servers run
separately This is used for smaller systems, and is often seen on a development
Trang 34In the two-tier client/server configuration, the presentation and application
servers are combined and the database server is separate This configuration isused in conjunction with other application servers It is used for a batch serverwhen the batch is segregated from the online servers A SAPGUI is installed on
it to provide local control
When all servers are combined onto a single machine, you have a central
configuration This is rarely seen because it describes a standalone R/3 systemwith only a single user
Defining an R/3 System
The simplest definition of an R/3 system is "one database." In one R/3 system,
there is only one database To expand the definition, R/3 is considered to be all
of the components attached to that one database One R/3 system is composed ofone database server accessing a single database, one or more application servers,and one or more presentation servers By definition, it is all of the componentsattached to one database If you have one database, you have one system If youhave one system, you have one database During an implementation, there isusually one system (or one database) assigned to development, one or moresystems designated for testing, and one assigned to production
The term R/3 system landscape denotes a description of the number of systems
within an SAP installation and how they are designated, such as development,test, or production
Defining an R/3 Instance
When you hear someone say the word instance, most of the time, that person
will be referring to an application server The term instance is synonymous with
application server.
Trang 35The term central instance refers to the database server If an application server and database server both reside on the same machine, the term central instance
refers to the computer on which both reside
In the most general terms, an instance is a server It is a set of R/3 processes
providing services to the R/3 system
Trang 36Understanding a User Context
A user context is memory that is allocated to contain the characteristics of a user
that is logged on the R/3 system It holds information needed by R/3 about theuser, such as:
The user's current settings
The user's authorizations
The names of the programs the user is currently running
When a user logs on, a user context is allocated for that logon When they logoff, it is freed It is used during program processing, and its importance is
described further in the following sections
Understanding a Roll Area
Trang 37program It holds information needed by R/3 about the program's execution,such as:
The values of the variables
The dynamic memory allocations
The current program pointer
Each time a user starts a program, a roll area is created for that instance of theprogram If two users run the same program at the same time, two roll areas willexist-one for each user The roll area is freed when the program ends
Trang 38A dialog step is the processing needed to get from one screen to the next It
includes all processing that occurs after the user issues a request, up to and
including the processing needed to display the next screen For example, whenthe user clicks the Enter key on the Change Vendor: Initial Screen, he initiates adialog step and the hourglass appears, preventing further input The sapmf02k
program retrieves the vendor information and displays it on the Change Vendor:Address screen, and the hourglass disappears This marks the end of the dialogstep and the user is now able to make another request
Understanding Roll-In/Roll-Out Processing
An ABAP/4 program only occupies a work process for one dialog step At the
beginning of the dialog step, the roll area and user context are rolled in to the work process At the end of the dialog step, they are rolled out This is illustrated
in Figure 1.21
Figure 1.21: Roll-in/roll-out processing.
During the roll-in, pointers to the roll area and user context are populated in thework process This enables the work process to access the data in those areas and
so perform processing for that user and that program Processing continues untilthe program sends a screen to the user At that time, both areas are rolled out.Roll-out invalidates the pointers and disassociates these areas from the workprocess That work process is now free to perform processing for other requests
Trang 39When the next request is sent from the user to continue processing, the
dispatcher allocates that request to the first available work process It can be thesame or a different work process The user context and roll area for that programare again rolled in to the work process, and processing resumes from the point atwhich it was left off Processing continues until the next screen is shown, or untilthe program terminates If another screen is sent, the areas are again rolled out.When the program terminates, the roll area is freed The user context remainsallocated until the user logs off
In a system with many users running many programs, only a few of those
programs will be active in work processes at any one time When they are notoccupying a work process, they are rolled out to extended memory and onlyoccupy RAM This conserves CPU and enables the R/3 system to achieve hightransaction throughput
information sent from the application server and formats it appropriately for theplatform it is running on This enables different end-user hardware platforms toconnect to a single application server For example, an OS/2 PC and a Windows
PC can both connect to the same application server at the same time
Trang 40interpreters: the ABAP/4 interpreter and the screen interpreter There are actuallytwo dialects of ABAP/4 One is the full-blown ABAP/4 data processing
language and the other is a very specialized screen processing language Each isprocessed by its own interpreter
The database interface handles the job of communicating with the database
Understanding the Types of Work Processes
There are seven types of work processes Each handles a specific type of request.The type of work processes and the types of requests that they handle are shown