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

AB0001-ABAP Overview v1.

India SAP CoE, Slide 1

AB0001-ABAP overview
1 2

PrepareMe TellMe
3

ShowMe
LetMe HelpMe

5
India SAP CoE, Slide 2

AB0001-ABAP Overview
1 2

PrepareMe TellMe
3

ShowMe
LetMe HelpMe

5
India SAP CoE, Slide 3

Introduction
ABAP stands for Advanced Business Application Programming language. It is a fourth-generation language (4GL), first developed in the 1980s, geared towards the creation of simple, yet powerful programs . It is derived from PASCAL and COBOL. It is the programming language of SAP used for developing applications for the SAP R/3 system. Good Programming skills, including knowledge of relational database design and preferably also of object-oriented concepts, are required to create ABAP programs.

India SAP CoE, Slide 4

Layers of the R/3 Architecture


R/3 stands for 3-tier architecture: A Presentation Layer or client, interfaces the R/3 and the user. This layer contains the software components that make up the SAP GUI. The Application Layer, houses all the business-specific logic. This layer consists of one or more application servers or message servers. The Database Layer, records and stores all the information about the system, including transaction and configuration data. All the data of entire R/3 is stored in the database.

SAP R/3 is a client/server based application, utilizing a 3tier model.

India SAP CoE, Slide 5

Database Insights
Relational Database Management Systems (RDBMS) are generally used to manage large sets of data.

Within the ABAP programming language, SAP uses OPEN SQL to access data in the database regardless of the DBMS.
Data that is frequently required by the applications is stored in buffers so that the system does not have to access the database every time it needs data. In particular, all technical data, such as ABAP programs, screens, and ABAP Dictionary information, as well as a number of business administration parameters, usually remain unchanged in a running system and are therefore ideally suited to buffering.
India SAP CoE, Slide 6

ABAP/4 Development Workbench Architecture


The R/3 Repository contains all the development objects, for example: programs, definitions of database tables, or central data type definitions. Development objects are therefore also known as Repository objects

ABAP/4 Editor

Reporting

Screen Painter

ABAP/4 Dictionary

Menu Painter

R/3 Repository
Data Modeller Function Modules

India SAP CoE, Slide 7

AB0001-ABAP Overview
1 2

PrepareMe TellMe
3

ShowMe
LetMe HelpMe

5
India SAP CoE, Slide 8

R/3 Repository
The R/3 Repository is the centralized storage location of development components in the ABAP Workbench. It is subdivided according to application components (i.e. MM, SD, FI etc). Each application component is further divided into logical subdivisions called Development class.

When an Repository object is created, it is assign to a development class.

India SAP CoE, Slide 9

Tools in ABAP Workbench

The ABAP workbench consists of tools for creating and editing Repository objects.
a) ABAP Editor: for writing and editing program code (transaction code SE38). ABAP Dictionary: for processing database table definitions and retrieving global types (transaction code SE11/SE12).

b)

India SAP CoE, Slide 10

Tools in ABAP Workbench


c) Menu Painter: for designing the user interface (menu bar, standard toolbar, application toolbar, function key assignment) (transaction code SE41). Screen Painter: for designing screens (Modal Dialogue Box) for user dialogs (transaction code SE51). Function Builder: for displaying and processing function modules (routines with defined interfaces that are available throughout the system) (transaction code SE37). Class Builder: for displaying and processing ABAP Objects classes (transaction code SE24).

d)

e)

f)

India SAP CoE, Slide 11

Accessing ABAP Workbench Tools using Object Navigator

The Object Navigator can be used to access all Workbench tools from a single Transaction Code. Transaction code SE80. The Object Navigator screen is divided into two areas: - Navigation area for displaying the object list in a hierarchy tree. - Tool area for displaying and editing a development object using the correct tool.
India SAP CoE, Slide 12

Organizing the developments in ABAP Workbench

Development projects are always implemented in a development system and then transported to the next system using a transport request. Repository objects are automatically assigned to a transport route based on which development class they belong to and what is their functionality.

India SAP CoE, Slide 13

AB0001-ABAP Overview
1 2

PrepareMe TellMe
3

ShowMe
LetMe HelpMe

5
India SAP CoE, Slide 14

ABAP/4 Dictionary
Transaction Code : SE11. ABAP dictionary is the central repository for the creation and management of data definitions in ABAP. It includes the creation of data types, domains, data elements, tables, views, etc.

Data definitions (metadata) are created and managed in the ABAP Dictionary

India SAP CoE, Slide 15

Information stored in ABAP Dictionary


The most important object types in the ABAP dictionary are : a) Tables: are defined in the ABAP Dictionary independently of the database. - A table having the same structure is then created from this table definition in the underlying database. Views: are logical views on more than one table. - The structure of the view is defined in the ABAP Dictionary. - A data for the view is fetched at run time. Types: are used in ABAP program. - The structure of a type can be defined globally in ABAP programs. - Changes to a type automatically take effect in all the programs using the type. Lock Objects: are used to synchronize access to the same data by more than one user. - Function modules that can be used in application programs are generated from the definition of a lock object in the ABAP Dictionary.
India SAP CoE, Slide 16

b)

c)

d)

Functions of the Dictionary

Type-definitions. Database objects. Services of the dictionary.

India SAP CoE, Slide 17

Type Definitions
Analogous to the predefined ABAP types such as C or I , one may define user-defined types in the dictionary. The following user-defined types are allowed: Data elements: Describe an elementary type by defining the data type, length and possibly decimal places. Structures: Consist of components that can have any type.

a)

b)

c)

Table types: Describe the structure of an internal table.

India SAP CoE, Slide 18

Type Definitions

Any complex user-defined type may be built using the previously mentioned basic types.

India SAP CoE, Slide 19

Database Objects

India SAP CoE, Slide 20

Standard Help available across SAP

F1 -> Documentation for the data element. F4 -> Input help for screen fields.

India SAP CoE, Slide 21

Tables in the Dictionary

Database table and its components. Various definitions of a table in the database.

Technical settings of a table.

India SAP CoE, Slide 22

Database Table and its Components

A database table is the central data structure of the ABAP/4 data dictionary.

Fields: - A transparent table contains different columns, to allow you to manage data records in a structured way. These are the fields of the table.

India SAP CoE, Slide 23

Database Table and its Components


The fields make up the columns of the transparent table. A check mark in the Key column indicates that the corresponding field is a key field. The values in the key fields allow the system to identify all data records uniquely. These key fields are called Primary key fields. Fields that link to other tables are called foreign key fields. When you create entries into the tables, each corresponding entry is called the row of the table.

India SAP CoE, Slide 24

Database Table and its Components

Describes the business context of a field Determines technical characteristics of a field

India SAP CoE, Slide 25

Database Table and its Components

A Domain defines a field technically and therefore it may be used at different business levels. (field type and length)
A Data Element is the semantic definition of a field. Therefore, although a take-off airport (data element S_FROMAIRP) would have a different business meaning from an airport where a plane lands (data element S_TOAIRP), they could still have the same domain (here S_AIRPID) because technically we could assign the same number of characters whether the airport is a take-off or a landing airport.
India SAP CoE, Slide 26

Definitions of Table in Database


In SAP R/3 tables are defined as: A) Transparent tables: - All of the fields of a dictionary table correspond to a field in the real database table. B) Pooled tables: - Different tables which are not linked to each other with a common key are combined into a TABLE POOL. - Several logical tables thus exist as a single real database table. C) Cluster tables: - Several tables linked by a common key may sometimes be combined by the data dictionary and made to exist on the database schema as a single table.

India SAP CoE, Slide 27

Technical Settings of a Table

a)

Data Class: The data class logically defines the physical area of the database (for ORACLE the table space) in which your table should be created.

India SAP CoE, Slide 28

Technical Settings of a Table


b) c) d) Size Category: The size category describes the expected storage requirements for the table on the database. Logging: Modifications to the entries of a table can be recorded and stored using logging. Buffering: Buffering allows to access data quickly, by access it from the application server instead of the database.

India SAP CoE, Slide 29

Views

A view can be used in ABAP programs for data selection. Types of Views:- Database views : are implemented with an equivalent view on the database. - Projection views : are used to hide fields of a table (only projection). - Help views : can be used as selection method in search helps. - Maintenance views : permit you to maintain the data distributed on several tables for one application object at one time.

India SAP CoE, Slide 30

Search Helps

Standard search help.


Types of search helps. Search Help Interface.

India SAP CoE, Slide 31

Standard Search Help

The input help (F4 help) is a standard function of the R/3 System. It permits the user to display a list of possible values for a screen field. A value can be directly copied to an input field by list selection.

India SAP CoE, Slide 32

Types Of Search Helps


a) Elementary search helps : - The elementary search help define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help). Collective search help : - Combine several elementary search helps. - A collective search help thus can offer several alternative search paths.

b)

India SAP CoE, Slide 33

Lock Objects
SAP data dictionary provides with a locking mechanism to synchronize simultaneous data access by different users.

India SAP CoE, Slide 34

Lock Objects
Lock objects are created in SE11. Customer lock objects must begin with EY or EZ . Lock Mode Three possible lock modes exist for lock objects.
Lock Mode E (Extensible) X (Exclusive) S (Shared) Meaning Lock for data change (accumulative exclusive lock) Lock for data change (exclusive write lock) Lock for protected data display (shared lock)

Lock mode E: This sets a lock for changing data for single user. This lock can be accumulated. Lock mode X: This mode is used like mode E for changing data. The only technical difference from mode E is that the respective lock does not allow accumulation. Lock mode S: This mode ensures that data displayed in your program cannot be changed by other users during the entire display time. Here you do not want to change the data yourself (allows read only access for data).
SAP AG 2002

India SAP CoE, Slide 35

Internal Tables
Internal tables provides a means of taking data from a fixed structure and storing it in working memory in ABAP. In case of internal table, the data is stored line by line in memory, and each line has the same structure. An internal table is a temporary storage in the program memory which lasts only till the execution of the program. Internal tables are run time tables used to data manipulations after fetching data into them from the standard tables. Internal tables are dynamic data objects. A particularly important use for internal tables is for storing and formatting data from a database table within a program.

India SAP CoE, Slide 36

Types of Internal Tables


a) Standard tables: - Standard table have a linear index. Sorted tables: - Sorted tables are always saved correctly sorted by key.

b)

c)

Hashed tables: - Hashes tables have no internal linear index. - These tables use Hash algorithm.

Note: Internal tables are not DataBase tables.


India SAP CoE, Slide 37

Internal Tables
Predefine ABAP Types
Fixed length Data type Numeric i f p Description Integer Float. point number Packed number Length in bytes 4 8 1 .. 16 1 .. 65535 1 .. 65535 8 6 1 .. 65535 Attributes

Differ in: Rules for storage Value range Arithmetic used


Character string operations (allowed for all types) + date calculations + time calculations Bit operations Runtime system adjusts length dynamically

Character string type n Number sequence c Character sequence d Date t Time


Variable length Hexadecimal x Hexadecimal code

Character string type / hexadecimal string Character sequence xstring Hexadecimal code
SAP AG 2002

ABAP types d, t, i, f, string, and xstring are used directly to type data objects and are therefore called fully specified types. ABAP Types c, n, and x must include additional information before using them to define data objects:
India SAP CoE, Slide 38

Selection-Screen

Selection-Screen are special screens which allow the user to restrict the amount of data selected from database. Selection screens are one of the three types of screen in the R/3 System, along with dialog screens and lists.
India SAP CoE, Slide 39

Introduction of ABAP/4 Reports


Transaction Code : SE38. 1) Definition: Reports are Programs that read data from the database, processes the data and displays the data in the required format. 2) Use:

Reports are uses in day to day business environment. For eg Displaying the purchase orders information. Displaying the balance of vendors to be paid till a particular date. etc. Enhance the efficiency & transparency of Business Processes.
Sound Decision making with the control of master data and accurate reporting. Relevant Documents immediately available for in case of drill down reports.

Multiple angles of Data representing and Forecasting Values.


India SAP CoE, Slide 40

Types of ABAP/4 Reports.


1) Classical Reports:a) Classical reports are the most simple reports. b) It is just an output of data using the Write statement inside a loop. c) These reports are not having any sub reports. d) It has only one screen for output. 2) Interactive reports:a) As the name suggests, the user can Interact with the report. b) In Interactive Reporting user can Navigate up to 1 Basic List and 20 Secondary Lists. 3) ALV:a) ALV stands for ABAP list viewer. b) The ALV is a flexible tool for displaying lists. c) The ALV control provides typical list functions as sorting, filtering, summing, etc.

India SAP CoE, Slide 41

Events in ABAP Report


Load of-Program

ABAP/4 report programs are event driven programs. When an executable program is run, the program flow is controlled by the events in the ABAP runtime environment.

INITIALIZATION

AT SELECTION-SCREEN TOP-OF-PAGE

START-OF-SELECTION

END-OF-PAGE

END-OF-SELECTION

TOP-OF-PAGE DURING LINE-SELECTION AT LINE-SELECTION AT USER-COMMAND AT PF<nn>

INTERACTIVE EVENTS India SAP CoE, Slide 42

Events used in Classical Reports


The different events in a report Program are: Load-of-Program:- It is the first event that is triggered in the program. - It is used to initialize the local variables. Initialization:- This event is used to initialize the selection screen variables. At Selection-Screen:- Validation & Checks of User input happen here. At Selection-Screen Output:- This event is used to modify the selection screen fields at run time.

India SAP CoE, Slide 43

Events used in Classical Reports.


Start-of-Selection:- This event is used to select data from the database.. End-of-selection:- After all the data has been selected this event writes the data to the screen. Interactive Events:- Used for interactive reporting. - It is used to create a detailed list from a basic list.

Top-of-Page:- This is triggered by the first write statement in the program. - It is used to have a standard header in the program for all the pages.

India SAP CoE, Slide 44

Events used in Classical Reports.


At user-command:- Event triggered by user pressing a function key. At Line -Selection:- This event is used to process interactive reporting.

India SAP CoE, Slide 45

Select Statement.
a) b) To extract data from the Database tables, use the Open SQL statement SELECT. The SELECT statement contains a series of clauses, each of which has a different task:The SELECT clause describes, among other things, whether the result of the selection will be several lines or a single data record and which fields of the table are to be read. The FROM clause names the source (database table or view) from which the data is to be selected. The INTO clause determines the internal data objects into which the selected data is to be placed.

The WHERE clause specifies the conditions that the selection results must fulfill. It thus controls the number of records to be selected from the table.

India SAP CoE, Slide 46

Select Statement .
To program database read access, use the Open SQL statement SELECT. The SELECT statement contains a series of clauses :

India SAP CoE, Slide 47

Types of Select.
a)
Reading by single record access: The SELECT SINGLE * statement allows you to read a single record from the database table. In the INTO clause, enter the destination where the database interface is to copy the data. When the CORRESPONDING FIELDS OF clause is used, addition in the INTO clause, fill the target area component by component.

India SAP CoE, Slide 48

Types of Select.
b) Reading several lines using a loop: If you do not use the addition SINGLE with the SELECT statement, the system reads multiple records from the database. The field list determines the columns whose data is to be read from the database.

The ABAP runtime system copies the data records to the target area line by line using a loop.

It also enables sequential processing of all the statements between SELECT and ENDSELECT.

India SAP CoE, Slide 49

Types of Select
c) Reading several lines using array fetch: The addition INTO TABLE itab causes the ABAP runtime system to copy the contents of the database interface directly to the internal table itab. This is called an array fetch. Since the array fetch is not executed as a loop, do not program any ENDSELECT statement. If you want to add lines to the end of an internal table that is already filled, instead of overwriting it, use the APPENDING TABLE itab addition.

India SAP CoE, Slide 50

Messages
Transaction Code : SE93. When the screen input is entered, the transaction must check the validity of the input information before using it. The SAP System provides error-handling features that simplify field checking as much as possible.

MESSAGE statement (in ABAP/4) (a) The MESSAGE statement (in ABAP/4) lets the messages be put from an ABAP/4 program. (b) An ABAP/4 program notifies the system of errors by putting out an error message or warning.

India SAP CoE, Slide 51

Messages Types
There are five different types of messages : S - Success,

- Information,

W - Warning, E - Error

- ABORT messages.

Message Syntax:
MESSAGE ID <id> TYPE <t> NUMBER <n> [WITH <f1> ... <f4>] [RAISING <exc>]. where <id>, <t>, and <n> are fields containing the message class, message number, and message type respectively.

India SAP CoE, Slide 52

What is a Transaction Code?


To call an execution of an ABAP program SAP uses a transaction code. Transaction codes is created in the Repository Browser in the ABAP Workbench or using Transaction SE93. A transaction code is linked to an ABAP program and an initial screen. A transaction is started by entering the transaction code in the input field on the standard toolbar or by means of the ABAP statements like CALL TRANSACTION or LEAVE TO TRANSACTION.

India SAP CoE, Slide 53

Function Modules
Transaction Code : SE37.

Function modules are actively integrated modularization units with an interface.


Function modules can, therefore, be called specifically from within programs or function modules. The interface of a function module can contain the following elements: Import parameters are passed to the function module. In general, these parameters are assigned standard ABAP Dictionary types. Import parameters can also be optional.

a)

India SAP CoE, Slide 54

Function Modules
b) Export parameters are received from the function modules. Export parameters are always optional. c) Changing parameters are passed to the function module and can be changed by it. d) Tables are used to pass multiple records to / from the function module. e) Exceptions provide information about error situations. If a function module initiates an exception, processing of the function module is interrupted. It is possible to set a return code, if necessary, in the calling program.
India SAP CoE, Slide 55

Function modules
Calling Function Modules CALL FUNCTION <module> [EXPORTING f1 = a 1.... f n = a n] [IMPORTING f1 = a 1.... f n = a n] [CHANGING f1 = a 1.... f n = a n] [TABLES f1 = a 1.... f n = a n] [EXCEPTIONS e1 = r 1....en = rn [ERROR_MESSAGE = r E] [OTHERS = ro]]. Creating Function Modules (SE37) - Attributes - Parameter Interface - Tables - Exceptions - Source Code
India SAP CoE, Slide 56

Subroutines

This e.g. shows a subroutine that calculates a percentage. This subroutine is called several times, even though different data objects are passed to the interface in each case.

A subroutine is an internal module within a program.

It represents a set of code lines that are to be repeated within a program.


A subroutine, lift the parts of a program out of the main programming block and put them somewhere else.
India SAP CoE, Slide 57

Subroutines

This makes the program easier to read and allows to use these code segments more than once. The data can be passed to the subroutine and back through its interface. This allows to call the same function for different data objects. Using subroutines makes the program more function oriented: it splits the program's task into sub functions so that each subroutine is responsible for one sub-function.

India SAP CoE, Slide 58

Structure of Subroutines

The structure of a subroutine includes the following: - Each subroutine starts with FORM and ends with ENDFORM. - The name of the subroutine is followed by the interface definition.

The statements that the subroutine executes come between FORM and ENDFORM.
India SAP CoE, Slide 59

Passing Data to Subroutines


Interface Parameters specify how the data is passed from the main program (actual parameters) to the subroutine (formal parameters) in the interface of the subroutine.

This is done in three ways:a) Call-by-value:- A local copy of the actual parameter is passed to the subroutine. This means that value assignments to the formal parameter have absolutely no effect on the actual parameters. b) Call-by-reference: A de-referenced address of the actual parameter is passed to the subroutine. This means that value assignments to the formal parameter directly affect the actual parameter. The value of the actual parameter is physically changed by the subroutine through the address.
c) Call-by-value-and-result: A local copy of the actual parameter is passed to the subroutine and a value is passed back to the main program only if the ENDFORM statement is executed. This means that value assignments to the formal parameter affect the actual parameter only after they have left the subroutine.

India SAP CoE, Slide 60

Calling Subroutines
A subroutine is called using the PERFORM statement. When the subroutine is called, parameters are passed to it in strict sequence. For this reason, the subroutine should be defined first and then call it. The Object Navigator supports in this respect: the PERFORM statement can be generated by dragging the subroutine from the navigation area to the editor area.

India SAP CoE, Slide 61

Data upload
Data Upload in SAP can be done using BDC or LSMW. 1. BDC:It stands for BATCH DATA COMMUNICATION. Transaction Code : SHDB. BDC basically uses Batch Input Sessions and CALL TRANSACTION method..
Data

Legacy System

R/3 System

BATCH INPUT

Batch input is used to transfer large amounts of data into the SAP system. BDC works by simulating the user input from transactional screen via an ABAP program. The input data file will come in the form of a flat file.
India SAP CoE, Slide 62

Data upload
2. LSMW :It stands for Legacy System Migration Workbench. Transaction Code : LSMW. The LSM Workbench is an R/3-based tool, that supports the one-time or periodic transfer of data from non-SAP systems ("legacy systems") to SAP systems. It offers different technique for migrating data: Direct input, BAPI, IDoc, Batch input recording. It helps to organize the data migration project and guides through the process by using a clear sequence of steps.
India SAP CoE, Slide 63
Structur e relations Convert data Field mapping Batch Input processing Direct Input processing IDoc inbound processing

.
Legacy data on PC

Read data

Read data

Legacy data on application server

Conversi on rules

Converte d data

Dialog Programming

Transaction Code : SE41. Screens allow user to enter and display the data. One of their strengths is that they combine with the ABAP Dictionary to allow to check the consistency of the data that has been entered. Module pool programs are also called Dialog programs.

India SAP CoE, Slide 64

Dialog Programming

A dialog program allows to work interactively with the system and to change the contents of the database tables. Each dialog program has a certain sequence of screens that are processed by the system one after the other.
India SAP CoE, Slide 65

Structure of a Dialog Program


A dialog program consists of the following basic components: Screens (dynpros):- Each dialog in an SAP system is controlled by dynpros. - A dynpro (Dynamic Program) consists of a screen and its flow logic and controls exactly one dialog step. - The flow logic determines which processing takes place before displaying the screen (PBO-Process Before Output) and after receiving the entries which is made on the screen (PAI-Process After Input).
India SAP CoE, Slide 66

Structure of a Dialog Program


ABAP/4 module pool:- Each dynpro refers to exactly one ABAP/4 dialog program. - Such a dialog program is also called a Module Pool, since it consists of interactive modules.

India SAP CoE, Slide 67

Important components of Dialog Program

Table Control.

Tab Strip Control .

India SAP CoE, Slide 68

Table Control

A Table control is used to display the contents of an internal table in a tabular format on a screen.
Within a table control, the table elements, key words, templates, checkboxes, radio buttons, radio button groups, and pushbuttons can be used.

A line may have up to 255 columns; each column may have a title.

India SAP CoE, Slide 69

Table Control

Table control on a screen.


India SAP CoE, Slide 70

Tabstrip Control

(a ) Tabstrip controls provide with an easy, user-friendly way of displaying different components of an application on a single screen and allowing the user to navigate between them. (b ) Tabstrip controls are a useful way of simplifying complex applications. Tabstrip controls can be used wherever there are different components of an application that form a logical unit.

India SAP CoE, Slide 71

SAP Script
SAP SAP Docume nt Document
Read Data

ABAP Program

Use

SAP Script

Prints

Form (Output)

Transaction Code : SE70. SAP Script is used to print forms e.g: Printing Cheques, Invoice. SAP Script focuses on the design and use of Layout sets in ABAP programs to generate beautified output in SAP.

SAP Script is a tool that SAP provides for creating layout sets.
India SAP CoE, Slide 72

SAP Script
The standard SAP system come with all the standard sap scripts for printing invoices, delivery orders or sales order etc.. A Layout Set is a template designed in SAP to place the stream of data coming from a SAP program on different parts of a physical page. The ABAP Programmer needs to lay out the various elements that need to be printed on the page and store it as an object in the SAP system.

India SAP CoE, Slide 73

Smart Forms
.
Transaction Code : Smartforms Smart Forms are used in SAP to create and maintain forms for mass printing. SAP Smart Forms allow to execute simple modifications to the form and in the form logic by using simple graphical tools.
Function module call DB selection Later selection Output

Smart Form
activate

Application program

ABAP function module (generated)

Output (printer) Database Data retrieval Form description

India SAP CoE, Slide 74

Smart Forms
SAP Smart Forms are directly integrated into the applications, no time is lost due to data exchange with external systems.

SAP Smart Forms allow to include graphics, which can be displayed either as part of the form or as background graphics.

India SAP CoE, Slide 75

BAPI -

Business Application Programming Interfaces.

Transaction Code : BAPI. A BAPI can be viewed as the door to the SAP system; this interface provides access to business data and processes in the SAP system from the outside.

Each object in the BOR can have several methods, one or more of which can be implemented as BAPI s.

India SAP CoE, Slide 76

BAPI - Business Application Programming Interfaces.


BAPI s usually exist for basic functions of a business object, such as: - Creating objects, - Querying the attributes of an object, - Changing the attributes of an object. BAPI is remotely enabled function module i.e it can be invoked from remote programs like standalone JAVA programs, web interface etc.. and they are part of Business Object Repository (BOR). BAPI are standard SAP function modules provided by SAP for remote access, which means this function module can be accessed remotely by other systems. Business objects are created and those are then registered in your BOR which can be accessed outside the SAP system by using some other applications (Non-SAP applications).

India SAP CoE, Slide 77

RFC -

Remote Function Call.

RFC is the standard SAP interface for communication between SAP systems and the RFC calls a function to be executed in a remote system . RFC is the call of a function module that runs in a different system to the calling program. RFCs are requests that an SAP component sends to invoke functions on remote systems, or calls that remote systems to invoke functions on an SAP component.

India SAP CoE, Slide 78

Enhancements - Overview

India SAP CoE, Slide 79

Enhancements

The R/3 System is adjusted to meet the customer needs in the following ways:
Customizing: Setting up specific business processes and functions for the system according to an implementation guide. The need for these changes has already been foreseen by SAP and an implementation procedure has been developed. Personalization: Making changes to certain fields' global display attributes (setting default values or hiding fields) as well as creating user-specific menu sequences.
India SAP CoE, Slide 80

Enhancements

Modifications: Changes to SAP Repository objects made at the customer site. If SAP delivers a changed version of the object, the customer's system must be adjusted to reflect these changes. Prior to Release 4.0B these adjustments had to be made manually using upgrade utilities. From Release 4.5A, this procedure has been automated with the Modification Assistant.

Enhancements: Creating Repository objects for individual customers that refer to objects that already exist in the SAP Repository.
Customer Developments: Creating Repository objects unique to individual customers in a specific namespace reserved for new customer objects.

India SAP CoE, Slide 81

Enhancements

An object is original in only one system. In the case of objects delivered by SAP, the original system is at SAP itself. In customer systems, these objects are then only available as copies. This applies to the development system and all other systems that come after it.

If the applications are not the original Objects, the objects created are original in your development system. Than the developments are assigned to a change request, which has the type Development/Correction.
This request ensures that the objects are transported from the development system into the subsequent systems.
India SAP CoE, Slide 82

Enhancements

Changes to an original are called corrections. They are recorded in a change request whose tasks have the type Development/correction.

If, on the other hand, if the change is done to a copy (an object outside its own original system), the change is recorded in a task with the type Repair. Repairs to SAP objects are called modifications.

India SAP CoE, Slide 83

Enhancements
When the repair is done to not to the original objects (for example, if something goes wrong in your production system), correct the original in the development system straight away. When you change copies, you must correct the original immediately! However, this cannot be done this SAP objects, because they are not original in any of your systems. You should only modify the SAP standard if the modifications you want to make are absolutely necessary for optimizing workflow in your company. Be aware that good background knowledge of application structure and flow are essential prerequisites for deciding what kind of modifications to make and how these modifications should be designed.

India SAP CoE, Slide 84

Enhancements

Whenever you upgrade your system, apply a Support Package, or import a transport request, conflicts can occur with modified objects.

India SAP CoE, Slide 85

Enhancements
Conflicts occur when you have changed an SAP object and SAP has also delivered a new version of it. The new object delivered by SAP becomes an active object in the Repository of your system. If you want to save your changes, you must perform a modification adjustment for the objects. If you have a lot of modified SAP objects, your upgrade can be slowed down considerably. To ensure consistency between your development system and subsequent systems, you should only perform modification adjustments in your development system. The objects from the adjustment can then be transported into other systems.

India SAP CoE, Slide 86

ABAP Dictionary Enhancements


Table Enhancements: There are two ways to add additional fields to tables without modifying the system. Append Structures: - Append structures allows to enhance tables by adding fields to them that are not part of the SAP standard. With append structures,customers can add their own fields to any table or structure they want. - Append structures are created for use with a specific table. However, a table can have multiple append structures assigned to it.

Customizing Includes: - If it is known in advance that one of the tables or structures delivered by SAP needs to have customer-specific fields added to it, an SAP application developer can include these fields in the table using a Customizing include statement. - The same Customizing include can be used in multiple tables or structures. This provides for consistency in these tables and structures whenever the itself include is altered.
India SAP CoE, Slide 87

ABAP Dictionary Enhancements


Append Structures and Customizing Includes

India SAP CoE, Slide 88

ABAP Dictionary Enhancements

Text Enhancements: Possible text enhancements include customer keywords and customer documentation of data elements.

Text enhancements differ from other application enhancements in that they take effect globally in all related SAP applications after activation (global enhancements).

India SAP CoE, Slide 89

SAP Application Enhancement

Application enhancements allow customers to enhance their application functions. Customer exits are preplanned by SAP and generally consist of several components.

India SAP CoE, Slide 90

Customer Enhancement Projects

SAP application programmers create SAP enhancements in transaction SMOD using function module exits, menu exits, and screen exits. Customers are given a catalog containing an overview of existing SAP enhancements. The ABAP developers combine the SAP enhancements that is required into an enhancement project using transaction CMOD.
India SAP CoE, Slide 91

Customer Exits

Function Module Exits.


Menu Exits.

Screen Exits

India SAP CoE, Slide 92

Function Module Exit

Function module exits are exits developed by SAP. The exit is implemented as a call to a function module. The code for the function module is written by the developer. The code is not written directly in the function module, but in the include that is implemented in the function module. Function module exits allow to implement functions that are not SAP standard functions and processing logic in standard SAP programs.
India SAP CoE, Slide 93

Menu Exits

Menu enhancements permit to add additional menu entries to an SAP standard menu.

India SAP CoE, Slide 94

Screen Exits

Screen exits are a type of customer exit.


They allow to display additional objects in an SAP application program screen.
India SAP CoE, Slide 95

Business Add-Ins (BADI)

What is BADI? - BADI is an Enhancement that works on object-oriented concepts. - It is an anticipated point of extension these points act like sockets and exist in the original source code. - It is based on ABAP Objects. BADI defines an interface that can be implemented by BADI- implementations that are transport objects of their own. In the Business Add-In, the interfaces for program enhancements are defined in the form of interface methods. This interface is used to implement the enhancement.
India SAP CoE, Slide 96

ABAP Objects
The object-oriented approach, focuses on objects that represent abstract or concrete things of the real world.

These objects are first defined by their character and their properties which are represented by their internal structure and their attributes is described by data and the behaviour of these objects is described by methods (functionality).
Object-oriented programming, is a problem-solving method in which the software solution reflects objects in the real world . ABAP Objects is a programming language and part of the ABAP Workbench that allows developers to create and run applications that contain program objects.

India SAP CoE, Slide 97

Benefits of Object Orientation ABAP


Encapsulation: Encapsulation means that the implementation of an object is hidden from other components in the system, so that they cannot make assumptions about the internal status of the object and therefore dependencies on specific implementations do not arise. Polymorphism: Polymorphism (ability to have multiple forms) in the context of object technology signifies that objects in different classes react differently to the same messages. Inheritance: Inheritance defines the implementation relationship between classes, in which one class (the sub-class) shares the structure and the behavior defined in one or more other classes (super-classes).

India SAP CoE, Slide 98

Advantages of Object Orientation ABAP


Compatibility and Design Aims
* * ABAP ABAP Objects Objects Programm Programm DATA: DATA: counter counter TYPE TYPE i, i, wa type KNA1. wa type KNA1. ... ... CLASS CLASS lcl_car lcl_car DEFINITION. DEFINITION. ... ... ENDCLASS. ENDCLASS. *--*--- main main program program ----------------CREATE CREATE OBJECT OBJECT ... ... counter counter = = counter counter + + 1. 1. MOVE MOVE wa wa TO TO ... ...

Compatibility: ABAP Objects is a true, compatible extension of ABAP ABAP Objects statements can be used in procedural ABAP programs Objects (classes) themselves contain classic ABAP statements

Design aims were: As simple as possible Only object-oriented concepts that have proved useful Increased use of type checks

SAP AG 2002

India SAP CoE, Slide 99

ALE-IDOCS
SAP Business units (Sales Unit & Production Unit) can use ALE for internal data exchange.
Supplier Idoc Production (SAP) Idoc Idoc

Idoc

ALE is SAP Technology to send and receive business data in SAP Systems and non-R/3 systems.
Customer

Head Quarters (SAP)

Idoc

Sales Office (SAP)

Container for the data is IDoc. When communicating with Business Partners (customers/suppliers on non-SAP platforms) SAP business units can exchange data through EDI using IDocs. ALE - Application Link Enabling. IDoc - Intermediate document.

India SAP CoE, Slide 100

ALE-IDOCS
IDoc acts as a standard SAP interface to exchange business data through ALE. From an SAP system, an IDoc can be sent to and received from An SAP R/3 system An SAP R/2 system An EDI subsystem Any third-party application software.

IDoc is the container for the business data and ALE is the technology which builds the road for data transfer.
Message type is a name given , that tells us what type of business data is being exchanged. Message type is always linked to an IDoc type. Where the IDoc Type represents the data format. While the message tells us the purpose of data being sent.
India SAP CoE, Slide 101

Memory Management in ABAP


Memory management in SAP from programs point of view consists of internal and external sessions. 6 external sessions, each containing, upto 9 internal sessions, can be opened per terminal. External sessions are connected to an R/3 window and can be opened as System -> New Session or by entering /o<T_CODE> in the command field. Internal sessions are placed on a stack. Each program occupies an internal session. Data for a program is visible in the internal session.
India SAP CoE, Slide 102

Calling an executable program


There are 3 methods of calling an executable program:a) CALL TRANSACTION TCODE or SUBMIT PROGRAM AND RETURN : This causes a new internal session to be created on top of the existing stack. After the called program has been completed, the new internal session is deleted and processing is continued for the calling program.

India SAP CoE, Slide 103

Calling an executable program


b) SUBMIT PROGRAM: b) The context of the calling program is removed from the current internal session and the called program is loaded for processing. c) Any other internal sessions, in the stack remain unaffected.

c)

LEAVE TO TRANSACTION TCODE: In this case all internal sessions except the context of the newly called program are deleted.
India SAP CoE, Slide 104

Sap Query
An ABAP Workbench tool that enables users without knowledge of the ABAP programming language to define and execute their own reports. The purpose of the SAP Query are for users with no programming knowledge. In ABAP Query, you enter texts and select fields and options to determine the structure of the reports. Fields are selected from functional areas and can be assigned a sequence by numbering. SAP queries are used to retrieve the information from different tables. A functional area is where the group selected tables together to be reported on. For User groups, sections to build queries in. A SAP query is the report.
India SAP CoE, Slide 105

AB0001-ABAP Overview
1 2

PrepareMe TellMe
3

ShowMe
LetMe HelpMe

5
India SAP CoE, Slide 106

Steps for creating a Report

Click on the CREATE' push button .

Enter the program name starting with 'Z' or 'Y'.

1. 2. 3. 4.

Go to SAP easy access. Go to TCODE SE38. Enter the program name starting with 'Z' or 'Y'. Click on the 'CREATE' push button .

India SAP CoE, Slide 107

Steps for creating a Report

Type the Title

Select the TYPE of the program you want to create from the drop down list. Click here

5. 6. 7.

In a dialog box, enter the description for the program you have created. Then you need to select what 'type' of program. Then click on the SAVE Button.
India SAP CoE, Slide 108

Steps for creating a Report

Select the package.

Then click on the Save Button.

8.

Give the package name and then save it.

India SAP CoE, Slide 109

Steps for creating a Report

9. 10. 11. 12.

On the ABAP editor write:write 'Hello world. Then click on check Button to check for errors. Then active the program. And then click on Execute button or press F8 Key.

India SAP CoE, Slide 110

Steps for creating a Report

This is the Output of report.


India SAP CoE, Slide 111

Steps for creating a Selection-Screen


Click on the CREATE' push button .

Enter the program name starting with 'Z' or 'Y'.

1. 2. 3. 4.

Go to SAP easy access. Go to TCODE SE38. Enter the program name starting with 'Z' or 'Y'. Click on the 'CREATE' push button .

India SAP CoE, Slide 112

Steps for creating a Selection-Screen

Type the Title.

Select the TYPE of the program you want to create from the drop down list.

Click here

5. 6. 7.

In a dialog box, enter the description for the program you have created. Then you need to select what 'type' of program. Then click on the SAVE Button.
India SAP CoE, Slide 113

Steps for creating a Selection-Screen

Select the package.

Then click on the Save Button.

8. 9.

Give the package name and then save it. Write the code as shown in the screen above.

India SAP CoE, Slide 114

Steps for creating a Selection-Screen

10. 11. 12.

Then click on check Button to check for errors. Then activate the program. And then click on Execute button or press F8 Key.
India SAP CoE, Slide 115

Steps for creating a Selection-Screen

13. 14. 15.

Display of the Selection - Screen . Then click on Execute Button or press F8 Key. Pass the Values on the screen.
India SAP CoE, Slide 116

Steps for creating a Selection-Screen

16.

This is the Output.

India SAP CoE, Slide 117

AB0001-ABAP Overview
1 2

PrepareMe TellMe
3

ShowMe
LetMe HelpMe

5
India SAP CoE, Slide 118

Code Analysis and Inspection


Transaction Code : SE30. 1) Code Analysis: The Code analysis provides an overview of the duration and performance of the source code, from individual statements up to complete transactions. SE30 is a Transaction to start the runtime analysis.

2) Code Inspection: During an inspection, individual objects or sets of objects are checked as to whether certain programming guidelines have been adhered to.

The result of an inspection run is a list of the individual checks made with errors, warnings, or information messages.

India SAP CoE, Slide 119

Debugger
The Debugger is a tool that is used to execute ABAP programs, by line or by section. With this tool, display data objects and check the flow logic of programs. At the moment, two types of debugging are possible: - Debugging with the classic Debugger for release levels prior to 6.40 or debugging with - the New Debugger, which is available for all releases after 6.40.

India SAP CoE, Slide 120

Execution Types in Debugging Mode


Single step (F5) - Use this option to step through the program statement by statement. - This allows you to branch to other programs. Execute (F8) - Use this option to process a program line by line. - All of the statements on the current line are processed in a single step. - This allows you to process the whole program. Return (F7) - The Debugger returns to the point at which control returns to the main program. - Use this option to return from other programs. Continue (F6) - Use this option to process the program up to the next breakpoint. - If there are no more breakpoints in the program, the system exits debugging mode and executes the rest of the program normally.

India SAP CoE, Slide 121

Breakpoint
Apart from being able to execute an ABAP program in the Debugger, the Debugger call by the choosing a breakpoint. This is achieved by setting one or more of these breakpoints in the program. A breakpoint is a signal at a particular point in the program that tells the ABAP runtime processor to interrupt processing and start the Debugger. The Debugger is activated when the program reaches this break point.

India SAP CoE, Slide 122

Breakpoint

To set a breakpoint, double-click in front of a line of source code. To set a breakpoint for a specific ABAP statement, choose: Breakpoint Breakpoint at - Statement.

India SAP CoE, Slide 123

Breakpoint

Choose Continue, the program is executed up to the next breakpoint. Save the breakpoints, they remain intact while logged on to the system. With breakpoints, the ABAP Workbench switches to debugging mode only for the developer who set the breakpoints. All other users can execute the program directly or set their own breakpoints.

India SAP CoE, Slide 124

Steps in Debugging a Code


Display the source code.

Position the cursor at the place in the source code where execution is to be stopped.
Choose the external breakpoint icon from the toolbar. The following Screen will be displayed:

India SAP CoE, Slide 125

Steps in Debugging a Code


Display of the screen :

India SAP CoE, Slide 126

Watchpoints
Like a breakpoint, a watchpoint is an indicator in a program that tells the ABAP runtime processor to interrupt the program at a particular point. Unlike breakpoints, however, watchpoints are not activated until the contents of a specified field change.

Watchpoints, like dynamic breakpoints, are user-specific, and so do not affect other users running the same program.

India SAP CoE, Slide 127

Watchpoints

Watchpoints are breakpoints that depend on the field content.

You can create the following types of watchpoints:(a) Field name: The program is executed until the content of the field has changed.
India SAP CoE, Slide 128

Watch-Points
(b) Field name, relational operator, comparison value:The program is executed until the content of the field has changed so that the defined logical condition, relative to a value, is met. (c) Field name, relational operator, comparison value:The program is executed until the content of the field has changed so that the defined logical condition, relative to the content of a field, is met. WE can set up to 10 watchpoints and link them using the logical operators AND or OR.

India SAP CoE, Slide 129

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