Programming in ABAP

Post on 26-Dec-2014

266 views 17 download

Transcript of Programming in ABAP

ABAP Training

Programming in ABAPProgramming in ABAP

Basic Program StructureControlling the Flow of an ABAP Program

Programming in ABAP 2

ABAP Training

Objectives

Aim is to introduce concepts associated with creating and executing an ABAP program, including

Defining program attributes Understanding the modular nature of an ABAP program Structure & syntax of ABAP statements

Declarative & operational keywords, & comments Flow control in ABAP

External control - event handling Internal control - IF, CASE, LOOP, ...

Programming in ABAP 3

ABAP Training

Programming in ABAP

basic program structure program attributes

Type Status Application Authorization groups Selection screen Development class

source code Statements and Comments

execution of ABAP programs flow control in ABAP

Programming in ABAP 4

ABAP Training

Creating New Program

Programming in ABAP 5

ABAP Training

Program Attributes

Program Type Executable program

generates lists Include program

contains code that cannot be executed on its own must be called from another program with an

INCLUDE statement

Programming in ABAP 6

ABAP Training

Program Attributes

Program Type Module pool

processing steps for screen module executed with a transaction code or menu function

Function group called from an application program using CALL

FUNCTION Subroutine pool

Programming in ABAP 7

ABAP Training

Program Attributes

Program Type Interface pool

Interfaces for local classes Class pool

Local classes

Programming in ABAP 8

ABAP Training

Program Attributes

Program Status indicate the status of a program development:

SAP Standard production program Customer production program System program Test program

Programming in ABAP 9

ABAP Training

Program Attributes

Application specifies the R/3 application area for which this

program is relevant: Basis or System Program Financial Accounting Human Resources, Planning Materials Management ...

Programming in ABAP 10

ABAP Training

Program Attributes

Authorization groups specifies the group authorized to view and modify

the program

Programming in ABAP 11

ABAP Training

Program Attributes

Development class Describes the area the program belongs to Determines the transport layer and transport

attributes of the program Begins with A..S or u..X

SAP standard objects (customer objects can not be created here)

Changes to objects recorded by workbench organizer

Can be transported

Programming in ABAP 12

ABAP Training

Program Attributes

Development class Begins with Y or Z

Customer objects Changes recorded in workbench organizer Can be transported

Begins with $ Local class Changes not recorded in workbench organizer Cannot be transported

Programming in ABAP 13

ABAP Training

Source Code

An ABAP program has a modular structure All programs consist of a series of modules

Simplest is just one module Syntax clearly separates individual processing blocks Sequential execution of code lines within processing

blocks

Programming in ABAP 14

ABAP Training

ABAP Modules

SubroutinesForm....ENDFORM

FunctionsFunction....ENDFUNCTION

Processing blocks for events<Event keyword>

Event statements<Event keyword>

Event statements Modules of a module pool

Module....ENDMODULE

Programming in ABAP 15

ABAP Training

ABAP Modules

Sequential coding within processing blocks General control flow statements

IF, DO, WHILE, (no GOTO) Reports

Collections of processing blocks that the system calls depending on events

Dialog programs Collections of processing blocks (module pool) that are

called by screen flow logic

Programming in ABAP 16

ABAP Training

Syntax Elements

Statements Each statement begins with a keyword and ends with a

periodWRITE ‘my first ABAP’.

Comments Flagged by * at the beginning of the line or ‘‘ anywhere

along the line Keywords

Determines the meaning of the entire statement

Programming in ABAP 17

ABAP Training

Syntax Elements - Keywords

Types Declarative keywords

Define data types or declare data objects the program can access

Data types tables constants parameters Control keywords

Control the flow of a program within a processing block

If, while, case

Programming in ABAP 18

ABAP Training

Syntax Elements - Keywords

Types Operational keywords

Process the data (as defined by the declarative keywords)

Move, add, write Calling keywords

Call processing blocks in the same or other program

Perform, call, submit, leave to

Programming in ABAP 19

ABAP Training

Syntax Elements - Keywords

Types Modularisation keywords

Define processing blocks in a program Event keywords

Associated processing blocks are executed when the relevant even t occurs

At selection screen, start-of-selection,... Defining keywords

Associated processing blocks are executed as soon as they are called by an explicit statement or in screen flow logic

Form, function, module, ...

Programming in ABAP 20

ABAP Training

Execution of ABAP Programs

A special runtime environment is required to execute an ABAP program

ABAP processor which communicates with the list processor and the dialog processor

Calls the individual modules according to established rules

Programming in ABAP 21

ABAP Training

Conclusion

Examined concepts associated with the creation and execution of an ABAP program

Program attributes Includes, type, application, development class

Basic program structure Modular nature of ABAP programs

Forms, functions