3 ABAP 4 6 Basic Functions

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.1

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.2

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

List of Topics

Objectives

Terminology and GUI Enhancements

ABAP Editor/Debugger

Internal Table Types

Open SQL Enhancements

Runtime Errors

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.3

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Module Map

Objectives

Terminology and GUI Enhancements

ABAP Editor/Debugger

Internal Table Types

Open SQL Enhancements

Runtime Errors

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.4

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Learning Objectives

Review terminology and GUI changes in 4.6

Understand internal table enhancements

Hashed versus Sorted tables

Review changes in Open SQL

Joins

Clauses

Sub-queries

Learn new error catching technique

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.5

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Module Map

Objectives

Terminology and GUI Enhancements

ABAP Editor/Debugger

Internal Table Types

Open SQL Enhancements

Runtime Errors

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.6

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Release 3.0

Release 4.6

Terminology Changes

ABAP/4 Development

Workbench

Object Browser

ABAP/4 Editor

ABAP/4 Dictionary

ABAP/4 Query

Function Library

Field Strings

ABAP Workbench

Object Navigator

ABAP Editor

ABAP Dictionary

ABAP Query

Function Builder

Program Structures

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.7

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Refresh

Object

List

Favorite

s

Close

Browse

r

Object

Menu

Workbench GUI

Enhancements

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.8

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Module Map

Objectives

Terminology and GUI Enhancements

ABAP Editor/Debugger

Internal Table Types

Open SQL Enhancements

Runtime Errors

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.9

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

ABAP Workbench

Enhancements

As of release 4.6 the enjoy

ABAP Workbench is

available

Redesigned with an

emphasis on usability,

and simplified

navigation

The following tools are

displayed within the work

area:

ABAP Dictionary

Class Builder

ABAP Editor

Function Builder

Screen Painter

Menu Painter

Text Element

Maintenance

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.10

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

ABAP Editor Enhancements

As of release 4.0 the following settings are available in the Settings

menu of the ABAP Editor:

Compress/decompress code blocks

Setting case of code to KEYWORD LARGE

The “Edit Locally” option

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.11

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Edit Control Mode

As of release 4.6 the Edit Control Mode allows for

editing in the front-end using the ABAP Editor

ABAP source code is transferred to the front-end

for editing

Edit Control mode can be used to maintain the

following objects:

ABAP programs (ABAP Editor)

Method implementations (Class Builder)

Function module source code (Function

Builder)

Screen flow logic (Screen Painter)

Type groups (ABAP Dictionary)

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.12

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Singl

e

Step

Continu

e

Next Page

Execute

Debugger GUI

Enhancements

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.13

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Create Watchpoint

Debugger

New functions have been added to the debugger in

release 4.0 making it easier to use

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.14

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Breakpoints

Breakpoints

By clicking on the Breakpoints pushbutton, a

scrollable display of the breakpoints defined in the
program is displayed

Can set up to 30 breakpoints

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.15

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Watchpoints

Watchpoint processing in the debugger has been significantly

improved

It is now possible to define multiple watchpoints, attach conditions to

them and link two or more watchpoints using a relational operator

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.16

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Modification Assistant

The Modification Assistant offers support in the

following areas:

Customizing

Personalization

Customer exits

Customer developments

These tools are all supported by

corresponding tools such as the IMG,
Business Add-Ins, transaction CMOD and the
development environment

Modifications made to those ABAP Workbench

objects not supported by the Modification
Assistant are logged and displayed in an overview

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.17

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Module Map

Objectives

Terminology and GUI Enhancements

ABAP Editor/Debugger

Internal Table Types

Open SQL Enhancements

Runtime Errors

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.18

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Summary of Changes

In previous releases there was only one type of

internal table

As of release 4.6 there are three types of

internal tables

Standard

Sorted

Hashed

The type of table used determines the way in

which the entries in the table are accessed by
the system

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.19

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Table Types

Standard tables are the same tables available in release

3.x

The time for key access to entries is in linear relation

to the number of entries in the table

Sorted tables are ones that are always sorted correctly

The time for key access to entries is in logarithmic

relation to the number of entries in the table

Hashed tables contain records that all have a unique key

The time for key access to entries is constant

regardless of the number of entries in the table.

Key access can only be used to read entries in a

hashed table

Index operations are not allowed

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.20

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Line Type

Key Sequence

Uniqueness Attribute

Index Access

Key Access

UA

0007

)

Properties of Internal Tables

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.21

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Table Types

Uniqueness

UNIQUE| NON-UNIQUE

UNIQUE

Access Time
For n Entries

Predominantly
Key

NON-UNIQUE

Predominantly
Index

Remains Constant
(O(1))

Key Only

Increases Logarithmically
(O(log(n))

Increases Linearly
(O(n))

Hash Function

Binary Srch

Table Scan

Access Using

Key Access

Hashed

Sorted

Standard

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.22

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

DATA: <itab> TYPE SORTED TABLE of <linetype>
WITH [UNIQUE | NON-UNIQUE] <keydef>
[INITIAL SIZE <n>] [WITH HEADER LINE].

REPORT …
TYPES: BEGIN OF line_type,
f1, f2,
END OF line_type.
DATA: tab1 TYPE SORTED TABLE OF line_type WITH UNIQUE KEY f1
WITH HEADER LINE.

tab1-f1 = ‘Y’. Tab1-f2 = ‘1’. INSERT TABLE tab1.
tab1-f1 = ‘X’. Tab1-f2 = ‘1’. INSERT TABLE tab1.
tab1-f1 = ‘A’. Tab1-f2 = ‘1’. INSERT TABLE tab1.

READ TABLE tab1 WITH TABLE KEY f1 = ‘A’.

LOOP AT tab1.
WRITE:/ tab1-f1, tab1-f2.
ENDLOOP.

Sorted Table Example

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.23

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

DATA: <itab> TYPE HASHED TABLE of <linetype>
WITH [UNIQUE | NON-UNIQUE] <keydef>
[INITIAL SIZE <n>] [WITH HEADER LINE].

REPORT …
TYPES: BEGIN OF line_type,
f1, f2,
END OF line_type.
DATA: tab1 TYPE HASHED TABLE OF line_type WITH UNIQUE KEY f1
WITH HEADER LINE.

tab1-f1 = ‘Y’. Tab1-f2 = ‘1’. INSERT TABLE tab1.
tab1-f1 = ‘X’. Tab1-f2 = ‘1’. INSERT TABLE tab1.
tab1-f1 = ‘A’. Tab1-f2 = ‘1’. INSERT TABLE tab1.

READ TABLE tab1 WITH TABLE KEY f1 = ‘A’.

SORT tab1 by f1.
LOOP AT tab1.
WRITE:/ tab1-f1, tab1-f2.
ENDLOOP.

Hashed Table Example

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.24

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

TYPES: BEGIN OF line_type,
f1, f2, f3,
END OF line_type.

DATA: tab1 TYPE STANDARD TABLE OF line_type WITH KEY f1 f2,
wa type line_type.

wa-f1 = 'B'.
wa-f2 = '5'.
wa-f3 = '12.45'.

READ TABLE tab1 FROM wa INTO wa.
READ TABLE tab1 WITH TABLE KEY f1 = 'B'

f2 = '5' INTO wa.

WA before read

WA after read

Work area WA

Internal Table tab1

Using the Key in the READ

Statement

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.25

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Summary of Internal Table

Operations

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.26

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Ranges Table Types

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.27

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Module Map

Objectives

Terminology and GUI Enhancements

ABAP Editor/Debugger

Internal Table Types

Open SQL Enhancements

Runtime Errors

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.28

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Summary of Changes

Inner Join: introduced in release 3.1h

SAP creates a temporary table containing

combinations of lines from the database tables whose
values meet the logical condition specified using the
ON<condition>

This uses the where condition to produce a set of

results

Left Outer Join: introduced in release 4.0

LOJ contains combinations of lines from the tables

whose values meet the logical condition specified in
the ON<condition> clause (join condition)

The lines in the left-hand table that do not meet the

condition are appended to the end of the result set

The result depends on whether the condition is

specified in the ON or the WHERE clause

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.29

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

SELECT <fieldlist> INTO <target>
FROM <dbtab1> AS <alias1>
INNER JOIN <dbtab2> AS <alias2>
ON <alias1>~<field1> = <alias2>~<field1>
AND <alias1>~<field2> = <alias2>~<field2>
AND …
WHERE …
ENDSELECT.

REPORT …
SELECT t1~carrid t1~connid t2~customid INTO (carrid, connid, custid)
FROM sflight AS t1
INNER JOIN sbook AS t2
ON t1~carrid = t2~carrid
WHERE t1~connid = t2~connid
AND t1~fldate = t2~fldate.
WRITE:/ carrid, connid, custid
ENDSELECT.

Inner Join

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.30

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Inner Join

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.31

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

SELECT <fieldlist> INTO <target>
FROM <dbtab1> AS <alias1>
LEFT OUTER JOIN <dbtab2> AS <alias2>
ON <alias1>~<field1> = <alias2>~<field1>
AND <alias1>~<field2> = <alias2>~<field2>
AND …
WHERE …
ENDSELECT.

REPORT …
SELECT t1~carrid t1~connid t2~customid INTO (carrid, connid, custid)
FROM sflight AS t1
LEFT OUTER JOIN sbook AS t2
ON t1~carrid = t2~carrid
WHERE t1~connid = t2~connid
AND t1~fldate = t2~fldate.
WRITE:/ carrid, connid, custid
ENDSELECT.

Left Outer Join

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.32

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Having Clause

As of release 4.6 the HAVING keyword provides

new functionality to transfer the selection
criteria from the application program to the
database server

Only information that meets the selection

criteria is returned to the application server
from the database

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.33

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

SELECT <fieldlist> INTO <target>
FROM <dbtab1>
WHERE <field1> = <val1>
GROUP BY <field2>
HAVING <expression>

ENDSELECT.

REPORT …
SELECT connid count(*) SUM( luggweight )
INTO (connid, counter, luggweight) FROM sbook
WHERE carrid = ‘LH’ AND fldate = ‘19991231’
GROUP BY connid.
IF luggweight > 100
WRITE:/ connid, counter, luggweight.
ENDIF.
ENDSELECT.

SELECT connid count(*) SUM( luggweight )
INTO (connid, counter, luggweight) FROM sbook
WHERE carrid = ‘LH’ AND fldate = ‘19971129’
GROUP BY connid.
HAVING SUM( luggweight ) > 100.
WRITE:/ connid, counter, luggweight.
ENDSELECT.

Having Clause

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.34

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

SELECT <field list> INTO <target list>

FROM <dbtab1> AS <alias1>
WHERE <field1> IN
( SELECT <field1> FROM <dbtab2>
WHERE <field1> = <alias1>~<field1> )

ENDSELECT.

Sub-Select Clause

Sub-queries were introduced in release 4.0 to provide

a more efficient method of performing complex select
statements

Select records at database layer

Data transferred to program is significantly

reduced

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.35

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Module Map

Objectives

Terminology and GUI Enhancements

ABAP Editor/Debugger

Internal Table Types

Open SQL Enhancements

Runtime Errors

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.36

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

CATCH Keyword

As of release 4.0 the CATCH keyword is

available for processing runtime errors

The CATCH…ENDCATCH block allows the

programmer to catch ABAP runtime errors and
assign these to a SY-SUBRC

This functionality allows errors to be reported

in a controlled manner (rather than a short
dump)

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.37

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

DATA: int type I,

char(3) type C value ‘ABC’.

[…..]

CATCH SYSTEM-EXCEPTIONS
CONVERSION_ERRORS = 1.
[…..]
MOVE char TO int. “MOVE keyword to trigger CATCH
[…..]
ENDCATCH.

IF SY-SUBRC = 1.
WRITE: / ‘Conversion error has occurred’.
ENDIF.

CATCH Keyword

To code the first part of a CATCH…ENDCATCH block it is necessary to
code CATCH SYSTEM - EXCEPTIONS and specify one of the following:

Error Class
Specific error ID
OTHERS, which traps all catchable runtime errors

background image

ABAP Basic Functions

3-ABAP 4_6 Basic Functions.38

This is PricewaterhouseCoopers PROPRIETARY MATERIAL (hereafter, the Material) intended for internal use only.

You may not rent, lease or distribute the Material to clients or other third parties, but you may transfer the Material to

other employees of PricewaterhouseCoopers.

Module Review

Objectives

Terminology and GUI Enhancements

ABAP Editor/Debugger

Internal Table Types

Open SQL Enhancements

Runtime Errors


Document Outline


Wyszukiwarka

Podobne podstrony:
Sybex Mastering Visual Basic NET VB NET Functions (VBL)
L 3 Complex functions and Polynomials
6 ABAP Objects
Amadeus Basic Podręcznik szkoleniowy
Basic Shed
BASIC MALTESE GRAMMAR AND DIC (G Falzon)
Functional Origins of Religious Concepts Ontological and Strategic Selection in Evolved Minds
basic model
Basic Radiation Physics
BASIC MILITARY REQUIREMENTS 24
MEDC17 Special Function Manual
Verb form and function
Basic Codes HTML

więcej podobnych podstron