46
Introduction to ABAP/4.

6 ABAP Introduction

Embed Size (px)

DESCRIPTION

6 ABAP Introduction

Citation preview

Page 1: 6 ABAP Introduction

Introduction to ABAP/4.

Page 2: 6 ABAP Introduction

SAP was founded in 1972 by five people: Wellenreuther, Hopp, Hector, Plattner and Tchira.

Wellenreuther , while working at IBM , developed a financial accounting package running in batch for an IBM customer – Naturin. SAP bought rights from Naturin and started to design and implement the real-time finance system as a standard package based on Wellenreuther ’s experience in the application. They sold the first copy of the standard system to ICI.

Simultaneously, they developed a Materials management system as a bespoke software for ICI by reserving all property rights.

HISTORY OF SAP

Page 3: 6 ABAP Introduction

Strategic Thinking SAP may be part of a larger change project

Process Design Expertise in the design, change and documenting of business processes

Project Management Essential throughout the project lifecycle

Change Management Expertise is required in changing the organization

System Architect Overall responsibility for feasibility of the design and integration issues

Application Experts People with skills in configuring specific SAP modules

Business Analysts Involved in piloting and must be trained

Trainers Training must be given to the users and team members new to SAP

SAP Developers People who can design and build bolt-on functionality

Operations Staff Responsible for administration, performance and transition

Staffing of SAP Projects

Page 4: 6 ABAP Introduction

SAP Products and People

SAP Application Functionality

SAP Development Environment

AnalyzerSAP

ManualsConfiguration

MenuImplementation

Guide

BasisSystem Database Hardware

ConfigurationTeam

BusinessEnd Users

DevelopmentTeam

OperationsStaff

Page 5: 6 ABAP Introduction

STAGES OF SAP IMPLEMENTATION.

Scoping: 1 - 2 Months Decision making.Understanding the Organization.

Analysis 3 - 6 Months Documentation, Discussions

Design 2 - 3 Months Modules, Sub Modules, Interfaces, Databases, Dataflow.Servers, Terminals & Back up.

Development Parallel with Design.ABAP/4, Configuration,Applications, Transactions,Reports.

Configuration 3 - 4 days Settings to be done.( IT department of Customer is involved)

Implementation/Testing/Training

Post Implementation Support.

Page 6: 6 ABAP Introduction

Data Base Changes Batch Processing

Central DBCentral DB

User Interaction

Application Logic

(Stores all Data and Application Programs)

Reading DataBase and Updating Buffer

CentralDB buffer

CentralDB buffer

Output Data to User

Output Data to User

Input Data From User

Client Server Structure – Three Levels

Page 7: 6 ABAP Introduction

After SAP installed , Analysts experienced in Business Process Re-engineering (BPR) , who are also configuration experts, customize the modules to meet the Corporation's need, or help the corporation change it's business practices to achieve the most efficiency out of SAP.

This configuration does not usually involve programmers, but is instead done by Business Analysts. When the configuration process is nearing completion, the programmers ( Called ABAPers - specialists in ABAP/4) are brought in to extend any part of SAP that can not be configured to meet the needs of the corporation.

Where you fit in!

Page 8: 6 ABAP Introduction

OK. Lets’ get straight into ABAP/4

Page 9: 6 ABAP Introduction

ABAP/4

• Advanced Business Application Programming - 4 th generation Language.

• ABAP/4 is the backbone of SAP R/3.

• All the R/3 applications and parts of Basis system were developed in ABAP/4.

Page 10: 6 ABAP Introduction

ABAP/4 Dictionary

Transactions

ABAP/4 Editor

Menu Painter

Screen Painter

Translation menu

Object Browser

Function LibraryABAP/4

Page 11: 6 ABAP Introduction

When you login to a SAP serverthe following screen appears

Page 12: 6 ABAP Introduction

Enter the user name & password

Page 13: 6 ABAP Introduction

This is the screen you work !

Page 14: 6 ABAP Introduction

Select TOOLS ABAP/4 Workbench

for going into programming area.

Enter SE38 in the space and click on ‘tick’ icon on extreme left for EditorArea - Initial Screen.

Or Use the other Procedure like

This

Page 15: 6 ABAP Introduction

This is the famous workbench they talk about

ABAP/4 Development Workbench !

Click on ABAP/4 Editor buttonor enter the windowfor writing progrmas.

Page 16: 6 ABAP Introduction

You are in the Editor area

Page 17: 6 ABAP Introduction

Enter the Name of theProgram you want toStart.

Without giving a nameyou can not proceed.

The name shall start with Y or Z

Page 18: 6 ABAP Introduction

This screen prompts you to enter data

Page 19: 6 ABAP Introduction

ATTRIBUTESABAP/4

development

Attribute

ABAP/4 program attributes

Type .......................

Status .....................

Application ...........

Class ......................

Reporting

Test

System

Training

1

T

S

SCHU

F4 TypeReportModule pool, interactive programUpdate programInclude

F4 StatusTestProductive useCustomer programSystem program

1:M:V:I:

T:P:K:S:

Page 20: 6 ABAP Introduction

Enter the following:

Title for the report Type 1Application *

Page 21: 6 ABAP Introduction

Press F11 for saving

Page 22: 6 ABAP Introduction

Select Local Object and press the icon on the left side.

Page 23: 6 ABAP Introduction

You Come back to this screen

Press F3 to go back or use Back arrow.

Page 24: 6 ABAP Introduction

Click on Change

Page 25: 6 ABAP Introduction
Page 26: 6 ABAP Introduction

To insert more lines for writing program.

Place the cursor at theend of first line and pressF7 or click on 5th icon fromLeft on toolbar.

Page 27: 6 ABAP Introduction

Now you have completed your first program.

Press CTRL + F2 for checking whether the syntax is right. ( 2 nd Icon from left)

Press F11 or click on open book icon to save.

Press F8 to execute the program you just wrote.

Page 28: 6 ABAP Introduction
Page 29: 6 ABAP Introduction

Congrats!

You have just become an ABAPer.

Page 30: 6 ABAP Introduction

Lets’ take a bigger program

Take data from a table called

TABNA

and print the following fields

NAME1, STREET, CITY.

contents on the screen

Page 31: 6 ABAP Introduction

Sy-tvar0 to sy-tvar9 aresystem variables. You can assign any value. They are used in header in this program. Ignore them for now.

Page 32: 6 ABAP Introduction
Page 33: 6 ABAP Introduction

Screen Attributes

REPORT B170D034.

FORMAT INTENSIFIED OFF.WRITE : ‘*********************************’.SKIP 2.FORMAT INTENSIFIED.WRITE : /5 ‘Date’.WRITE: 20 SY-DATUM DD/MM/YYYY.FORMAT INTENSIFIED OFF.WRITE: /5 ‘Time’, (8) SY-UZEIT UNDER SY-DATUM.

1

**************************************************** Date 31/01/1992 Time 09:06:51

31.01.1992

Writes in BOLD Letters

Turns Off BOLDLetters

Page 34: 6 ABAP Introduction

COMMENTSFull line Comment.• A Star ( * ) is placed in the first position of the Line.

Partial line comment.• Double quote ( " ) is placed before you start a comment

Full Line Comment.

Partial Line Comment.

Page 35: 6 ABAP Introduction

Key Words

• Declaratives (DATA,.)• Events (GET,...)• Control (IF,...)• Operational (WRITE,)

Page 36: 6 ABAP Introduction

STATEMENTS*ABAP/4 Programs is built of Statements.* A Statement is a sequence of Words which always start with a ABAP/4 reserved keyword

like Report, Data, Write etc.* All statements ( except comments ) shall terminate with a period (.)* A word in a statement is delimited by blank spaces on both sides.* Statements can begin anywhere on a line* Multiple statements can be placed on a single line* Single statement may be stretched across multiple lines

Page 37: 6 ABAP Introduction

Colon Notation

OUT PUT ON SCREEN

For readability Colon ( : ) can be used.Note the ( : ) after WRITE, ( , ) after first two lines and ( . ) at the end of the statement.

Page 38: 6 ABAP Introduction

CHAIN STATEMENTS

WRITE ‘XYZ’.WRITE NAME.WRITE COUNTER.

WRITE : ‘XYZ’ , NAME, COUNTER.

ADD 1 TO COUNTER1.ADD 1 TO COUNTER2.ADD 1 TO COUNTER3.

ADD 1 TO : COUNTER1, COUNTER2, COUNTER3.

Page 39: 6 ABAP Introduction

* Variables must be declared in the program.

* Variables can be upto 30 characters.* Key words of ABAP/4 shall not be used as variables.

* The declaration process consists of telling the system what type of data will be stored in the temporary location associated with the

variable.

* These variables persist only during the execution of the program, and the data they contain is lost when execution is complete.

* Variables can be declared at any point in a program. However it is preferable to define at the begining of a program.

* Begin variable with a letter and then a combination of letters & numbers. Hyphen or Dash (-) is allowed. But do not use it.

VARIABLES

Page 40: 6 ABAP Introduction

Type Characteristic Example.

C Character “Any character”D Date "19980701"I Integer 500N Numeric text 00500T Time "223010"

others

F Floating point NUMBER 5e7p PACKED DECIMAL 200.50X Hexadecimal 23 A

DATA TYPES

Page 41: 6 ABAP Introduction

DATA TYPES AND THEIR ATTRIBUTES

Data Type Meaning Initial valueStandardlength

Allowed length

P

F

I

N

C

T

D

X

Packed Number

Integer

Floating point no.

Numeric text

Text

Date YYYYMMDD

Time HHMMSS

Hexadecimal

0 8 1-16

0 4 -

0.000 . . . 8 -

00 . . . 0 1 1-max

Space 1 1-max

00000000 8 8

000000 6 6

X ‘00’ 1 1-max

Page 42: 6 ABAP Introduction

Conditional Operators# CASE# IF# ON CHANGE OF

CASE: The case statement is used to indicate conditions for data that falls in a specific categories.

Syntax:CASE field.

WHEN value1.Command lines.

WHEN value1.Command lines.

WHEN OTHERS.Command lines.

ENDCASE.

Example:

DATA: w_year(4) .W_year = ‘1998’.CASE w_year. WHEN ‘1997’.

WRITE ‘The year is ‘1997’. WHEN ‘1998’.

WRITE ‘The year is ‘1998’. WHEN OTHERS.

WRITE ‘The year is unknown.ENDCASE.

Page 43: 6 ABAP Introduction

SELECT statement I

TableTABNA

Table description TABNASHOW TABNA

TABNA-COUNTRY CHAR C 3

TABNA-ID CHAR C 8

TABNA-NAME1 CHAR C 25

NAME Type Length

DDIC

Table work area TABNA

PROGRAM B170D061.TABLES: TABNA.SELECT * FROM TABNA.

WRITE: / TABNA-COUNTRY, TABNA-ID,TABNA-NAME1, . . . .

ENDSELECT.

Implied Loop

Page 44: 6 ABAP Introduction

SELECT statement II

REPORT B170D062.TABLES: TABNA.SELECT * FROM TABNA

WHERE COUNTRY = ‘USA’.

statements

ENDSELECT.IF SY-SUBRC NE 0.

statements

ENDIF.

Page 45: 6 ABAP Introduction

Internal Tables play major role in SAP.Understand the concept of Internal Tables well before

you do something!

SELECT * FROM <table>

INTO TABLE <internal table>

APPENDING <internal table>

WHERE . . .

ORDER BY . . .

REPORT B180D06B.TABLES: TABNA.DATA: BEGIN OF TAB OCCURS 200.

INCLUDE STRUCTURE TABNA.DATA: END OF TAB.* note the extra DATA: statement required for an INCLUDE.SELECT * FROM TABNA INTO TABLE TAB

WHERE COUNTRY = ‘USA’.LOOP AT TAB.

WRITE: /TAB-COUNTRY,TAB-ID,TAB-NAME1.

END LOOP.

Page 46: 6 ABAP Introduction

I have tried to give some info to take a look at ABAP/4. Go through training or refer books to master ABAP/4.

SAP is difficult to master.Concentrate on what you are good at.

ALL THE BEST !