Вы находитесь на странице: 1из 26

Introduction to SAP R/3

SAP Pronounce as ESSAYPEE .Never pronounce as sap of a tree. Systems, Applications and Products in Data Processing. R Real Time 3 3 Tier Architecture

What is SAP R/3 ?


It is one of the ERP systems

What is ERP ?
Enterprise Resource Planning

Main Aim of SAP R/3


SAP R/3 is mainly aimed at Business Applications like Finance, S&D, MM etc., Over 25,000 companies rely on this SAP R/3 system.

These Companies include:


Oil & Gas Transport Insurance Pharma Banking & Telecommunications etc.,

Hardware Vendors:
IBM Compaq Bull AT&T & Sun etc.,

Major Implementators:
Price water House & Coopers Anderson Consulting Ernst & Young KPMG & Deloitte & Touche etc.,

History
Company : SAP AG When : 1972 Where : Walldorf, Germany By Whom : 4 former employees. R/3 Introduction : 1992 position in 1995(ISV): 5

IBM

SAP Products
R/2 System R/3 System

R/2 System
It is a main frame system compatible to IBM, Siemens etc., Data intensive and big centralised Industries. It is not open system. (It can not communicate with other systems. But with the help of ALE it can be linked to R/3 and can be made open system)

R/3 system
Client server system Multi Lingual It can be easily customized based on countrys needs. It has OSS (Online Support System) It has other services like Information service and Maintenance service. It has Preventive service (early watch serv.)

SAP R/3 Architecture


Database Server Application Server Application Server Application Server

Presentaion Presentation Presentation Presentation Presentaion Presentation Server Server Server Server Server Server

Database Server : Stores Database. Application Server : Contains Software for Running the Application Logic. Presentation Server : Graphical User Interface

The advantage of having 3 tier or 3 layered Architecture is to reduce traffic on the Database Server. Based on the required degree of distribution, you can combine two servers or all three servers in the same machine (Stand alone).

ABAP/4 Dev Workbench


It contain different tools for development of ABAP/4 objects, checking and analysing programs and finally transportation of objects. 1) ABAP/4 Language 2) Data modeler 3) Object browser 4) Repository 5) Test & Analysing tools 6) The Query and 7) Work Bench Organizer

ABAP/4 Language
It is the Central part of Middle ware layer that eliminates dependencies from Hardware, Operating Systems or database management systems.

Data Modeler
Relation ship between the tables are stored in the form of ER diagrams. (ER = Entity Relation ship)

Object Browser
Hirarcheal representation of Programs, Screens, Menus, Transactions, Tables etc.,

Repository

The ABAP/4 Repository is made up of following Runtime Objects. Programs Screens and Dictionary

Dictionary contains Metadata. Metadata is nothing but description of data and definitions.

Test & Analysing Tools


For testing and analysing performance of Programs and Transactions.

Work Bench Organizer


Transportation systems. of Objects between the

Introduction to ABAP/4
ABAP : Advanced Business Application Programming 4 : Fourth generation Language Multi Lingual Only Tool for developing SAP applications. ABAP Workbench contains all tools, needed to create ABAP/4 Programs. ABAP/4 program contains all usual control structures and modularization concepts. After coding, we will save and generate. During generation, the system creates a Run Time object. When we execute, the system executes this Run Time Object.

Structure of ABAP/4 Programs


ABAP is different from sequential programming languages such as FORTRAN, PASCAL and C.

Instead it shares certain features with event Oriented programming languages such as VB and JAVA. An ABAP/4 program has modular structure. Source text (processing Block) always consists, Collection of One or more programming modules Programming module consists of sequential statements. With in the processing Block, we can use general Control statements such as DO, IF, WHILE and CASE statements.

Execution of ABAP/4 Programs


For Execution of ABAP/4 Programs you need a special Run Time Environment . This Run Time Environment is responsible for calling the individual program modules one after the other . This Run Time Environment is nothing but ABAP/4 Processor .

Characteristics Programming

of

ABAP/4

Declarative Elements for declaring Data. Operational Elements for Manipulating data. Control statements for processing program flow. Functions for processing character strings. Subroutines with or without passing values. Central Library with special type of Subroutines called Function modules. Open SQL (a subset of SQL) to read and change data base tables. Allows you to define and process Internal Tables. Allows you to store data as Sequential files on Application and Presentation Servers. Types of ABAP/4 Programs Executable program (1) INCLUDE program (I) Module pool (M) Function group (F) Subroutine pool (S)

SAP differentiates between two general types of ABAP/4 Programs. Report Programs Dialog Programs
Report Programs
Reports are stand alone programs. We use reports to read data base tables and represent results in Lists Reports are collection of processing blocks, controlled by System calls depending on events. Reports can use LDBs or SELECT STATEMENTS defined by DEVELOPER. Reports can call Dialogue programs and vice versa.

Dialogue Programs
Dialogue programs are not stand alone programs. (we have to link the dialogue programs to at least one or more SCREENS and TRANSACTION CODES) We use Dialogue Programs to read and change Database tables. Dialogue programs are controlled by Screen flow logic. Dialogue program is also called as Module pool program or TRANSACTION. These module pools are separated into PBO and PAI events. Collection of PBO, PAI and a screen is called DYNAMIC PROGRAM (DYNPRO). A module pool must have at least one DYNPRO.

DATA TYPES
System Defined Elementary 1)

2) Structured

User Defined

1) Elementary 2) Structured

1) Elementary - System Defined Data Types


Character (C) Numeric Text (N) Integer (I) Packed (P) Float (F) Date (D) Time (T) Hexadecimal (X)

2) Structured - System Defined Data Types


All Database Tables

3) Elementary - User Defined Data Types


Types

4) Structured User Defined Data Types


Internal Tables Field Strings

DATA DICTIONARY

The ABAP/4 Data Dictionary is the central component of ABAP/4 Repository. It is centralised and structured source of information for business applications It is the source of every definition with in R/3 system. It is totally integrated with other tools of Dev. environment like Screen painter etc.,

Some of the main available functions in the ABAP/4 Dict.


Management of data definitions (Select, Insert, Update and Delete) Preserve data integrity. Information about the defined relationship between two tables or even dictionary tells whether table is active or empty.

Dictionary Objects

Tables Structures View Data element Domain Lock Objects and Match Code Objects

Table
A Table is a two dimensional data matrix. A Table contains Rows and Columns. Rows contain Records while Column contains Fields. A Table contains zero or multiple Records.

Transparent Table, Pooled Table and Clustered Table etc., comes under Tables.

Structures
A Structure is similar to a Table that do not have any contents. It is like Table or View without any records. The basic difference between Structure and the Table is that the Structure does not exist at the underlying data base level. Structure exists as Definition in the Dictionary.

View
A View is an imaginary table. It contains data, which are really stored in other Tables. The contents for the View are dynamically generated when called from program. Projection (fields) and Selection (Records) are Possible using Views also.

Data element
Data element an intermediate Object between Domain and Table field. It is the definition of the Properties and Type for a Table field. A field in R/3 system is always associated with Data element, which at the same time is related to Domain.

Domain
It is the formal definition of data types from Technical point of view. They set attributes such as data type, length, possible value range and so on.

Lock Objects
Used for locking the access to data base. This mechanism is used to enforce data integrity, i.e., two users can not update the same data at the same time. With Lock Objects, you can lock a table field or whole table.

Match Code Objects


A Match Code is a tool to help you in searching for data from the database.

DATA OBJECTS
Data Objects
Cannot exist without Data types. Occupies memory space. Created during Run Time.

Data Object Types


Internal External System Defined Special

Internal Data Objects


Variables

Constants Literals

Variables
Data a type value 1234. During run time, Data Object A is created and its value is 1234. The value of A in this case (declared as variable) can be changed during run time. a = a + 1.

Constants
Constants a type i value 1234. During run time, Data Object A is created and its value is 1234. The value of A in this case (declared as constant) cannot be changed during run time.

Literals
Data a(10) value ABCDEF. During run time, Data Object A is created and its value is ABCDEF.

External Data Objects


All Table fields comes under this category. Data a like sflight-carrid value SQ. During run time, Data Object A is created and its value is SQ.

System defined Data Objects


Space , and System variables comes under this category. Data a like sy-datum.

a = sy-datum. During run time, Data Object A is created and its value is todays date.

Special Data Objects


Parameters Selection Criteria

Parameters
Data : a type i value 123, b type i value 321. You can not assign another set of values to a & b, unless we change these values with in the above code. Hence the need for Parameters. Parameters : a type i, b type i. With parameters declaration a selection screen is created during run time and the user can input any number of sets of values. You can assign default values variables declared under parameters. Parameters : a type i default 123, b type i default 321. During run time, the above default values will appear in the selection screen. User can use the same values or he/she can change the above set of values for later use.

Selection Criteria
Data : a like sflight-carrid. a = SQ. You can not assign another value to a, unless we change this value with in the above code. Hence the need for Selection Criteria.

Select-options a for sflight-carrid.


With select-options declaration a selection screen is created during run time and the user can input any range of values. You can assign default values to variables declared using select-options. Select-options: a for sflight-carrid default SQ. During run time, the above default values will appear in the selection screen. User can use the same value or he/she can change the above value for later use.

CONSTRUCTS
Branching If * Elseif * Else * Endif. Case * Endcase. Looping (System index SYINDEX) Do * Enddo. While * Endwhile. If * Elseif * Else * Endif. If a = 5. write: / five. Elseif a = 10. Write:/ Ten. Else. Endif.

Write:/ Others.

Case ** Endcase.

Case a. When 5. write: / five. When 10. Write:/ Ten. When Others. Write:/ Others. Endcase. Do ** Enddo. Do 2 times. Write:/ ABCD. Enddo. ABCD ABCD

Do ** Enddo contd. A = 5. Do 2 times. times. Write:/ A. A = a + 1. Enddo. Do ** Enddo contd. A = 1. Do 3 times. times. Write:/ A. sy-index. A = a + 1. Enddo.

A = 5. Do

A = a + 1. Write:/ a. Enddo.

Do Write:/ Enddo.

Do ** Enddo contd. Do 5 times. Do times. If sy-index = 3. sy-index. Write:/

Continue. index = 3. Endif. Write:/ sy-index. Enddo. Do ** Enddo contd. Do 5 times. times. If sy-index = 3. sy-index. Exit. index = 3. Endif. Write:/ sy-index. Endif. Enddo. While ** Endwhile. While sy-index <= 5. Write:/ sy-index. Endwhile.

If

sy-

Continue. Endif. Enddo.

Do Write:/ If Exit. Enddo.

sy-

Checkboxes
Parameters : c1 as checkbox, c2 as checkbox. If c1 = X and c2 = . <add 2 numbers > elseif c1 = and c2 = X.<subtract> elseif c1 = X and c2 = X <multiply> else. <divide>. Endif.

Radiobuttons
Parameters : r1 radiobutton group g1,

r2 radiobutton group g1. If r1 = X . <add 2 numbers > else. <subtract> Endif.

OUTPUT STATEMENTS The basic ABAP/4 statement for output on the Screen is WRITE. Syntax : Write f . f can be any data object.

Horizontal Lines Write: / sy-uline. Write:/P sy-uline. Write:/P sy-uline(L). Write:/P(L) sy-uline. Uline. Uline /P. Uline /P(L). Vertical Lines Write:/ sy-vline. Write:/P sy-vline. Blank Lines Skip. Skip 2. Skip to line 5. Formatting Options Write f option. Different Options Left-justified. Centered. Right-justified. No-gap. No-zero. No-sign.

Under g. Using Editmask m. Decimals d. Round r. Exponent e. Left-justified, centered, Right-justified


Data a(50) value ABCD. Write:/ a, / a centered, / a right-justified.

NO-GAP Data : p(4) value ABCD, q(4) value EFGH. Write:/ p no-gap, q. NO-ZERO Data a(5) type n value 123. Write:/ a no-zero. NO-SIGN Data : a type i value 20, b type i value 25, c type i. C = a - b. Write: / c no-sign. Under g. Data : a(4) value ABCD, b(4) value EFGH. Write:/10 a, / b under a.

Using edit mask m.


Data : a like sy-datum. A = sy-datum. Write:/ a, / a using edit mask _ _ / _ _ / _ _ _ _.

Decimals d. Data : a type p decimals 3. a = 123.456. Write:/ a decimals 2.

Round r. Data a type p decimals 3. a = 123.456. Write:/ a round -2, / a round -1, / a round 1. Exponent e Data a type f. a = 123456.789. Write:/ a exponent -2, / a exponent -1, / a exponent 1, / a. Format intensified. (default) Format intensified off. Format inverse. Format inverse off. (default) Format color n.

write:/ a color n. n can be col_background. 1 or col_heading ( Blue) 2 or col_normal (White) 3 or col_total (Yellow) 4 or col_key (Olive green) Write :/ a color n. n can be 5 or col_positive (Green) 6 or col_negative (red) 7 or col_group (violet)

STRING OPERATIONS
Concatenate Split Shift Replace Translate Offset String length String comparision Concatenate data : a(10),b(10),c(10),d(40). A = Apple. B = Orange. C = Banana. Concatenate A B C into D. Write:/ d. Concatenate A B C into D separated by /. Write:/ d. Split data : a(10),b(10),c(10),d(40). D = Apple/Orange/Banana. Split d at / into a b c. Write:/ a / b, / c. Shift Data : a(6) value ABCDEF. Shift a.(by default shifts to left by one place) write: / a. BCDEF A = ABCDEF. Shift a by 2 places.

Write:/ a. CDEF Data : a(6) value ABCDEF. Shift a right. Write:/ a. ABCDE A = ABCDEF. Shift a right by 2 places. Write:/ a. ABCD Data : a(6) value ABCDEF. Shift a up to C. Write:/ a. CDEF a = ABCDEF. Shift a circular. Write:/ a. BCDEFA Data a(6) ABCDEF. Shift a circular by 2 places. Write:/ a. CDEFAB a = ABCDEF. Shift a circular right by 2 places. Write:/ a. EFABCD Replace Data p(6) value ABCABC. Replace ABC with DEF into p. Write:/ p. DEFABC (Replaces first occurrence only) Translate Data p(11) ABC ABC ABC. Translate p using ADBECF. WRITE:/ P. DEF DEF DEF Offset Data p(6) value ABCDEF, q(3). q = p+2(3).

Write :/ q. q = p+0(1). Write:/ q.

CDE A

String Length. Data: a(50) value PQRPQRPQRXYZ, b type i. b = strlen( a ). 15 String Comparison Contains any ca Contains only co Contains string cs and Contains pattern cp. Contains any (ca) [ case sensitive ] If SAP ca ABAP/4. Write:/ True. Else. Write:/ False. Endif. True Contains only (co) [ case sensitive ] If SAP co ABAP/4. Write:/ True. Else. Write:/ False. Endif. False Contains string (cs) [ not case sensitive ] If ABAP/4 cs Ab. Write:/ True.

Else. Write:/ False. Endif. True

Contains pattern (cp) [ not case sensitive ] If ABAP/4 cp *aP++. Write:/ True. Else. Write:/ False. Endif. True

Вам также может понравиться