Learn about ABAP4 - First ABAP

xiaoxiao2021-03-06  21

ABAP / 4 development environment

The surface of ABAP / 4 looks very simple, in fact, is a complex language. Beginners often feel confused. Only know, you can master this language. Only knowing it and knows it, you can understand this exciting knowledge of the content of others.

As the skilled programmer knows, beginners will soon know that creating ABAP / 4 programs is not just a program. It often involves creating development objects to support the created programs.

What is R / 3?

R / 3 is a set of integrated applications designed for large company data processing. It is developed by SAP, Germany (SAP: Systems Applications and Products for Data Processing). R / 3 is composed of an operating environment and a set of applications written in SAP 4GL language ABAP / 4. Designing these applications is to meet the needs of large commercial application data processing. R / 3 and its previous version R / 2 are very popular in the manufacturing industry.

What is the purpose of R / 3?

The sole purpose of R / 3 is to provide a set of closely integrated large business applications. These applications are:

Production Plan (PP, Production Planning) Material Management (MM, MATERIALS Management) Sales and Distribution (SD, SALES AND DISTRIBUTION) Financial Accounting (CO, Controlling) Fixed Asset Management (AM, Fixed Assets Management) Project Management (PS, Project System) WF, Workflow IS (IS, Industry Solutions) Human Resources (HR, Human Resources) Factory Maintenance (PM, Plant Maintenance) Quality Management (QM, Quality Management)

These applications are sometimes referred to as a functional module of R / 3.

Traditionally we evaluated a single module that purchased these individual modules from multiple software vendors, assembled into data processing applications. This requires an interface between these separate modules. For example, material management needs to be associated with sales and financial, and workflow needs to obtain information from human resources. A lot of time and money takes a lot of time and money in implementing and maintaining these interfaces.

R / 3 presets the core business applications that most large companies need. These applications coexist in the same environment. They use a single database and a set of data sheets. The size of the database is between 12g to 3T. The standard R / 3 is configured with approximately 8,000 data sheets.

Why do we need to know these functional modules?

As an ABAP / 4 programmer, you know that these functional modules are important. This is because these function modules are all written in ABAP / 4. To be a skilled R / 3 developer, you must understand these functional modules.

For example, assuming that you are familiar with ABAP / 4, ask you to write a financial statement to summarize the annual borrowing of each supplier of the company. You may know how to write ABAP code, do you know how to meet this demand?

Or your job is to undertake new applications with ABAP / 4. Ask you to design a system, provide stock market to potential customers. If you don't know financial and sales systems, you don't know if you will create something already in R / 3. You don't know if there is a R / 3 data sheet, which contains data similar to or even the same type with the data you want to store. These functional modules are highly integrated. "I want to build my own data sheet, save my own data copy", and developers who have such an idea will soon find that his data is redundant, and must be synchronized with the existing data of the database. This created application does not take advantage of the highly integrated characteristics of the R / 3 environment. I pointed out that this is because many developers who wish to become an independent consultant believe that R / 3 applications can be developed only by learning ABAP / 4. Learning ABAP / 4 is of course a good start, but just a start. Those who are interested in becoming a ABAP / 4 consultant often ignore the importance of knowledge training in functional modules. Although functional module knowledge can be learned in actual work, I hope that it is that learning ABAP / 4 language is just the first step towards SAP. If you want to be a successful independent consultant, you need to master the functional module knowledge.

Learn about Basis

Basis is like a R / 3 operating system, which is between the ABAP / 4 code and the computer operating system. Therefore, SAP likes to be called middleware.

The ABAP / 4 program cannot be run directly on the operating system, requiring a group of programs (this group is Basis) to load, interpret, and buffer its input and output.

Basis is a bit like a Windows environment in some way. Windows provides a running environment for Windows programs after Windows. Without Windows, programs written for Windows Environments cannot run.

Basis is like Windows for Windows for the ABAP / 4. Basis is ABAP / 4

The program provides a running environment. Without BASIS, ABAP / 4 programs cannot run. When you start R / 3, you can think that Basis is started. Basis is a set of R / 3 system programs with interfaces, using these interfaces, users can start ABAP / 4 programs.

To install Basis, the installer runs the R3Inst program at the operating system command prompt. Like most installation processes, this will produce a directory structure and copy a set of executables to this directory structure. These executables have formed Basis as a whole.

To start the R / 3 system, simply enter the command startsap. Basis is activated, in operation, accepts user request, run ABAP / 4 programs.

The ABAP / 4 program runs in a protective Basis environment that cannot be run in the operating system environment. Basis reads the ABAP / 4 code and explains the ABAP / 4 code to the operating system instruction.

The ABAP / 4 program cannot directly access the functionality of the operating system, but using the Basis function for file I / O and display data in the window. Separation from the operating system allows the ABAP / 4 program to run on any support R / 3 system without modification. The platform that runs R / 3 is as follows:

Table 1.1 R / 3 supported platforms and databases

Operating system supported hardware support for front-end support for database AIX Sinix IBM SNI Sun 3.1 / 95 / NT DB2 for Aix Solaris HP-UX DIGITAL HP OSF / MOTIF INFORMIX-ONLINE DIGITAL-UNIX BULL OS / 2 Oracle 7.1 Macintosh Adabas D Windows NT AT & T Compaq Win 3.1 / 95 / NT Oracle 7.1 Bull / Zenith OSF / Motif SQL Server 6.0 HP (Intel) SNI OS / 2 Adabas D IBM (Intel) Macintosh Digital (Intel) Data-General OS / 400 AS / 400 WIN95 OS / 2 DB2 / 400SAP provides a set of tool management Basis systems.

Basis supports client / server mode. R / 3 is a three-layer client / server mode, which is:

Representation layer server: actually is a program Sapgui.exe, providing a user interface.

Application Server: A set of executables, they explain the ABAP / 4 program, manage input / output. Profile Application Server Profile defines the program that started when the application server is started.

Database server

These three layers can be located on one computer, or on two computers, it is generally located on three computers.

Data table related to Client and data sheets that are not related to Client

The data table of R / 3 is divided into two categories: data table related to Client and data sheets that are not related to the client. A data table is related to Client if it's the first field type is CLNT. This type of field length is always 3, and the appointment is the name of MANDT.

R / 3 has three systems: development, testing and products. By default, each system has three clients: 000, 001 and 066. Development and test systems typically have 3-6 clients. The product system generally has only one client.

SAP Open SQL

Open SQL is a subset of ANSI SQL. The Open SQL using Open SQL in the ABAP / 4 program allows the code to run in different database environments without modification.

First recognition ABAP / 4

Developments include Programs, Screens, Tables, Views, Structures, Data Models, Messages, and Includes.

There are two main types of ABAP / 4 programs:

Reports Dialog Programs

The purpose of Report is to read data from the database, and output data. It consists only of two screens: Selection Screen and Output Screen.

Selection Screen: It mainly contains the input field, allowing the user to enter the condition of the report.

Output Screen: Final report.

Selection Screen is optional.

Dialog Program is more flexible than Report. It can contain any number of Screen. Screen Sequence can change during runtime. In each Screen, you can have Input Fields, Output Fields, PushButtons, and multiple scrollable areas.

All development objects and their components are stored in the R / 3 database, for example, the source code of Report is stored in the Data Table DD010S. The program name consists of 2-8 characters, and the user program name begins with Y or Z. The program at the beginning of A ~ X is the system program.

Select three characters as the prefix of your program name, for example, zkg. In the following narrative, "Input Program Name ABC", you should enter zkgabc.

The sample program is named ZTXCCNN, and the CC is the chapter number, NN is the serial number. The program used in the exercise is named ZTYCCNN, and the program in the answer is named ztzccnn. The utility is named Y-xxxxx.

The system variable starts with SY, so DATUM represents the current system date, SY-Uzeit indicates the current system time. All system variables are in Ddic Structure Syst. In the SELECT statement, two system variables SY-SUBRC and SY-DBCNT are often used. When the record is found, SY-SUBRC is 0; otherwise 4. SY-DBCNT represents the serial number of the recorded record, the first record is 1, the second record is 2, and the last record is also the number of records.

Use Chain Operator

The colon (:) becomes chain operator, for example to define two tables, you can use the following code:

Tables ZTXLFA1.

Tables ZTXLFB1.

You can also use the following code:

Tables: ZTXLFA1, ZTXLFB1.

SELECT has two forms.

The first form is:

SELECT * from T1 [INTO WA] [Where F1 OP V1 and / OR F2 OP V2 ...]

[ORDER BY F1].

(Other ABAP / 4 STATEMENTS)

Endselect.

The second form is:

Select * from T1 [INTO WA] [WHERE F1 OP V1 and / OR F2 OP V2 ...].

The first form can extract a plurality of records, press the primary key to find, can use the second form, and the second form can only be extracted, and the second form is faster than the first form.

Note Walk is an asterisk (*) and double quotes ("), as shown below:

* This is a comment

Tables ZTXLFA1. "this is also a comment

The statement of the ABAP / 4 program ends in English.

Data Dictionary

Most ABAP / 4 programs have been used in Data Dictionary (DDIC) objects. The interlocking mechanism of the ABAP / 4 program and the DDIC object makes in-depth understanding of the R / 3 data dictionary is basic programming skills. Therefore, from now on, we will learn how to create DDIC objects such as Table, Data Element, and Domain.

Type of Table

In R / 3, there are three types of Table: Transparent Table, Pooled Table, and Cluster Table.

Transparent Table has a one-to-one relationship with tables in the database. They have the same name, the same number of fields, the field name is also the same. Transparent table is used to store application data, while Pooled Table and Cluster Table are used to store system data.

Pooled Table and Cluster Table are multi-to-one relationship with tables in the database. They can have different names, different quantities of fields, and the field name can also be different.

Table pool and pooled table

Table pool is a table in the database, which is stored in the Pooled Table. R / 3 stores a large number of (tens of thousands) small Table with Table Pool (10-100 rows). Table Pool reduces the database resources you need to open multiple little Table. Pooled Table is mainly used to store custom data. When installing a large system, it usually needs to be customized to meet the company's specific needs. In R / 3, this is made by custom Table. Customized Table includes encoding, field authentication, numerical range, and parameters for R / 3 applications. For example, custom Table contains such data, national coding, regional code, exchange rate, discount method, etc.

When the system is initially implemented, the function analyst sets the data in the custom TABLE.

Table Cluster and Cluster Table

Cluster Table is similar to the Pooled Table. They are used to store a few (about 2-10) very large Table. These tables have the same primary key, and they need to be accessed at the same time.

Table Cluster contains less than Table Pool. Unlike Table Pool, each table in Table Cluster has the same primary key, and there are a row of the same primary key in multiple different tables to form a line in the Table Cluster. Cluster Table reduces the number of read databases, thereby improving performance.

Table consists of Field, and create a Data Element. Data Element contains the Field tag and online document (also known as F1 Help). The Field tag is a text description of the field. On the screen, it is usually displayed on the left of the field. When the cursor is pressed in the F1 button, the F1 Help is displayed when the cursor is pressed in the FIELD input field.

Data ELEMENT definition requires Domain. Domain contains the technical characteristics of Field, namely field length and data type.

Domain and Data Element are reusable. A domain can be used in multiple Data Element, a Data Element can be used for multiple fields and multiple TABLE.

R / 3 presets more than 13,000 Domain.

Table 3.1 TABLE, FIELD, DATA Element, and Domain naming agreement

Object Type Max Name Length 10 Y, Z Data Element 10 Y, Z Domain 10 y, z Field 10 Any Character

Field can be used in addition to any character other than the reserved word, and the Ddic Table Trese contains these reserved words.

The object created must be activated (activate) can be used, and the object must be reactivated after the change is valid.

The transactions of browsing data sheet data have four SE16, SE17, SM30, and SM31.

转载请注明原文地址:https://www.9cbs.com/read-40213.html

New Post(0)