Top Banner
ASUG Upgrade Symposium June 2007 Thomas Jung SAP NetWeaver Product Management Getting Back to Standard How to Address Your Modification
48
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Upgrade for ABAP team

ASUG Upgrade SymposiumJune 2007

Thomas JungSAP NetWeaver Product Management

Getting Back to

Standard – How to

Address Your

Modification

Page 2: Upgrade for ABAP team

Modification Adjustment

Unicode Enablement

Enhancement Framework

Page 3: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 3

Introduction

Today we will focus on an upgrade from 4.6C to SAP ERP 6.0

(Formerly mySAP ERP 2005) from the view of the ABAP

development team. We will look at the tasks and challenges your

developers will face, showing some of the program changes that will

need to be made. Also we will see some of the new ABAP features

that you will be able to leverage once you are upgraded.

Page 4: Upgrade for ABAP team

Modification Adjustment

Unicode Enablement

Enhancement Framework

Page 5: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 5

Program Adjustments - Experiences

Made the Unicode Adjustments to programs during the Upgrade

Must adjust Customer Functions for Unicode

Of the 2000 Objects approx 200 needed to be “touched”

Dev System adjustments – 3 developers for 3 days

Used the Sandbox system and Standalone Netweaver system to

fix difficult problems in advance

Polish HR Add-in was messy

Page 6: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 6

SPAU – Modification Adjustment During Upgrade

The upgrade

process stops and

provides the

opportunity to make

Modification

Adjustments

Only Objects

“touched” by the

upgrade are listed

Split Screen Editor

for before and after

view of source code

SPAU

Page 7: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 7

DEMODemo -

SPAU

Page 8: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 8

SE95 – Modification Browser

Allows you to view

ALL modifications

regardless of how

they may or may not

have been touched by

the Upgrade

Note Corrections are

also listed (separately

if made via Note

Assistant)

SE95

Page 9: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 9

DEMODemo -

SE95

Page 10: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 10

SAMT – Extended Program Check

General Tool for

performing multiple

types of system wide

program scans

Can create separate

scan sets broken

down by Object

Name, Package, etc.

Large Scans can be

ran in the

background

Stops scanning an

object upon finding

the first syntax error

SAMT

Page 11: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 11

DEMODemo -

SAMT

Page 12: Upgrade for ABAP team

Modification Adjustment

Unicode Enablement

Enhancement Framework

Page 13: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 13

UTF-16 – Unicode Transformation Format, 16 bit encoding

Fixed length, 1 character = 2 bytes (surrogate pairs = 2 + 2 bytes)

Platform dependent byte order

2 byte alignment restriction

UTF-8 – Unicode Transformation Format, 8 bit encoding

Variable length, 1 character = 1...4 bytes

Platform independent

no alignment restriction

7 bit US ASCII compatible

E3 91 B979 3434 79U+3479

CE B1B1 0303 B1U+03B1

C3 A4E4 0000 E4U+00E4ä

6161 0000 61U+0061a

UTF-8UTF-16

little endian

UTF-16

big endian

Unicode

code point

Character

Representation of Unicode Characters

F0A081BB00DA7BDCDA00 DC7BU+2007B

Page 14: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 14

Unicode-Enabled ABAP Programs

Program attribute „Unicode checks active“

Required to run on a Unicode system

If attribute is set, additional restrictions:

– apply at compile and at run time

– apply in Unicode systems and in non-Unicode systems

– ensure that program will run on non-Unicode and Unicode systems with

(almost) identical behavior

not allowed ok

Attribute not set

(not Unicode

enabled)

okokAttribute set

(Unicode enabled)

Unicode

system

Non-Unicode

system

Page 15: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 15

Program Attribute „Unicode Checks Active“

Page 16: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 16

UCCHECK – Unicode Scan

Similar tool to SAMT,

except it is

specifically designed

for Unicode

Compatibility Checks

Does NOT stop

scanning an object

after the first problem

is found

Can be used to set

the Unicode Attribute

on a group of objects

UCCHECK

Page 17: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 17

DEMODemo -

UCCHECK

Page 18: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 18

Unicode Enabled ABAP – Overview

Design Goals

Platform independence

– Identical behavior on Unicode and non-Unicode systems

Highest level of compatibility to the pre-Unicode world

– Minimize costs for Unicode enabling of ABAP Programs

Improved security, maintainability, and readability of ABAP programs

Main Features

Clear distinction between character and byte processing

1 Character ≠ 1 Byte

Enhanced checks prevent programming based on memory layout

assumptions

Improved conversion facilities

Improved dataset interface

Improved support for dynamic programming

Page 19: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 19

Character Processing

String operations are only allowed for character-like operands

– ABAP types C, N, D, and T, STRING

– Structures consisting only of characters (C, N, D, T)

– X and XSTRING are no longer considered character-like types

Byte Processing

Variants of string operations for byte processing

– Addition „IN BYTE MODE“ for statements

– Prefix „BYTE-“ for comparison operations

Only operands of type X or XSTRING allowed

CONCATENATE cf1 cf2 TO cf3.

IF cf1 CS cf2. ...

CONCATENATE xf1 xf2 TO xf3 IN BYTE MODE.

IF xf1 BYTE-CS xf2. ...

Unicode Restrictions – String Processing

Page 20: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 20

Unicode Restrictions – Length And Distance

Determining the Length and Distance

Counted in bytes or in characters? Specify!

DESCRIBE FIELD...LENGTH... IN (BYTE | CHARACTER) MODE

DESCRIBE DISTANCE BETWEEN ... AND ... INTO ...

IN (BYTE | CHARACTER) MODE.

Example

FORM write3 USING fld TYPE c.

DATA: fldlen TYPE i.

DESCRIBE FIELD fld LENGTH fldlen IN CHARACTER MODE.

IF fldlen >= 3.

WRITE: / fld(3).

ENDIF.

ENDFORM.

Page 21: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 21

Unicode Restrictions – MOVE

MOVE Between Incompatible Structures

Matching data layout („fragment views“) required

Example

C(4) C(3) X(3) C(4) I

C(6) N(4) X(3) N(4) I P(8)

C(3)

C(10) X(3) C(4) I P(8)

struc1

struc2

fragments

cstru = xstru. "Unicode error!

DATA:

BEGIN OF cstru,

first(10) TYPE c,

tab(1) TYPE c,

last(10) TYPE c,

END OF cstru.

DATA:

BEGIN OF xstru,

first(10) TYPE c,

tab(1) TYPE x VALUE '09',

last(10) TYPE c,

END OF xstru.

Page 22: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 22

Unicode Restrictions – Access With Offset or Length

Access To Structures With Offset/Length

Structure must begin with characters

Offset/length counted in characters

Access only allowed within the character type prefix of a structure

ASSIGN fld+off(len) TO ...

Access must not exceed field boundaries

If ASSIGN fails, field-symbol is set to „unassigned“

New ... RANGE addition allows the permissible boundaries

to be expanded

N(6) C(4) X(3) C(5)

+off(len)

Page 23: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 23

New ABAP Features – Character Utilities

Class CL_ABAP_CHAR_UTILITIES

Constant attributes with system specific values

charsize length of 1 character in bytes

newline

cr_lf

form_feed

horizontal_tab

vertical_tab

backspace

minchar X‟00„ in non-Unicode systems, U+0000 in Unicode systems

maxchar X„FF„ in non-Unicode systems, U+FFFD in Unicode systems

Example

CLASS cl_abap_char_utilities DEFINITION LOAD.

DATA: text TYPE string.

REPLACE cl_abap_char_utilites=>horizontal_tab

WITH space INTO text.

Page 24: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 24

New ABAP Features – Extended File Interface

Reading / Writing Different Text Formats

Only character-like fields allowed for reading / writing text files

Explicit open required in Unicode enabled programs

Reading / Writing Legacy Formats

Reading or writing data in a format compatible to non-Unicode systems

Not character-like structures allowed

OPEN DATASET dsn IN TEXT MODE

ENCODING (DEFAULT | UTF-8 | NON-UNICODE).

TRANSFER text TO dsn.

READ DATASET dsn INTO text.

OPEN DATASET dsn IN LEGACY (TEXT | BINARY) MODE

... (LITTLE | BIG) ENDIAN

... CODEPAGE cp.

Page 25: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 25

Conversion classes

Code page conversion

– Unicode / non-Unicode code pages

Endian conversion

– little endian / big endian byte order

Character conversion

– Unicode code point / ABAP character

system code page any code pageCL_ABAP_CONV_OUT_CE

any code page any code page CL_ABAP_CONV_X2X_CE

any code page system code pageCL_ABAP_CONV_IN_CE

ConversionABAP Class

New ABAP Features – Conversion Classes

Page 26: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 26

New ABAP Features – Includes With Group Names

Symbolic Access to Includes of Structures

skey = stru-key.

srest = stru-rest.

WRITE: stru-r2.

skey = stru(4).

srest = stru+4(20).

WRITE: stru-r2.

Pre-Unicode Unicode enabled with group names

DATA: BEGIN OF stru.

INCLUDE TYPE t_key as key.

INCLUDE TYPE t_rest as rest.

DATA: END OF stru.

DATA: skey TYPE t_key,

srest TYPE t_rest.

TYPES: BEGIN OF t_key,

k1(2) TYPE x,

k2(2) TYPE c,

END OF t_key.

TYPES: BEGIN OF t_rest,

r1(10) TYPE c,

r2(10) TYPE c,

END OF t_rest.

stru

k1 k2 r1 r2

key rest

Page 27: Upgrade for ABAP team

Modification Adjustment

Unicode Enablement

Enhancement Framework

Page 28: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 28

Evolution of SAP Enhancement Technology

User

Exits

Form

routines

Application

Workbench

Kernel

Customer

Exits

Function

modules

Business

Transaction

Events

Industries

Business

Add Ins

Filters

Classe

s

Kernel based

Business

Add Ins

Enhancement Framework

Page 29: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 29

Enhancement Browser

Search for

Enhancements possibilities (Definitions – typically provided by SAP)

Enhancement Implementations (typically done by Customer)

Integrated into Object Navigator (SE80)

Page 30: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 30

Source Code Enhancements Overview

Modification-free enhancement of source code

Implicit Enhancement Option

At common enhancement places, implicit Enhancement options are

available. Examples:

– End of Executable Program, Include, Function group, Dialog module

– Begin/End of Form routine / Function module / Method

– End of a structure

– End of Private/Protected/Public Section of a local class

– ...

Explicit Enhancement Option

Predefined enhancement options can be defined in source code.

They are additionally stored inside Enhancement Spots.

Page 31: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 31

Implicit Enhancement Options

Page 32: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 32

Explicit Enhancement Options

Page 33: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 33

Source Code Plugin Technology - Example

PROGRAM p1.

WRITE ‘Hello World’.

ENHANCEMENT-POINT ep1 SPOTS

s1.

..

..

..

ENHANCEMENT-SECTION ep2

SPOTS s1.

WRITE ’Original’.

END-ENHANCEMENT-SECTION.

ENHANCEMENT 1.

WRITE ’Hello

Paris’.

ENDENHANCEMENT.ENHANCEMENT 2.

WRITE ’Hello

London’.

ENDENHANCEMENT.

ENHANCEMENT 3.

WRITE ’Enhanced’.

ENDENHANCEMENT.

Page 34: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 34

Editor Modes for Enhancements

Use Change Mode for creating enhancement points &

sections.

use button „Display <-> Change“ to switch to change

mode.

Use Enhancement Mode for creating enhancement

implementations.

use button „Change Enhancements“ to switch to

Enhancement mode

use button „Display <-> Change“ to leave Enhancement

mode

Page 35: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 35

DEMOSource Code Plugin

Page 36: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 36

Class/Interface Enhancements

Class/Interface Enhancements allow addition of:

optional parameters to existing methods

methods

events and event handlers

references to interfaces

Exits to existing methods

– Pre-Exit – Called at the beginning of a method

– Post-Exit – Called at the End of a method

– Overwrite-Exit – Replaces the original method

Page 37: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 37

Adding Methods & Parameters

Adding optional parameters to existing methods

Adding new methods

Page 38: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 38

Pre/Post Exits

Method Hugo.

Endmethod.

Call method instance->hugo( ).

Method Pre.

….

Endmethod.

Method Post.

….

….

Endmethod.

Coding.

Coding.

Coding.

Page 39: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 39

DEMOClass Enhancement

Page 40: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 40

BADIs - Overview

What are BAdIs?

Business Add-Ins

is an anticipated point of extension – these points act like sockets and exist in the original coding

has a well-defined interface in contrast to source code plug-ins and is therefore more stable to changes in the original coding

Kernel BAdIs - New Features

Are integrated directly in the ABAP Language/Runtime

Improved filter support allows non-character filter types (packed, numeric, string) and complex filter conditions

Enable reusable implementation instances (Stateful BAdI)

Control of the lifetime of implementations (BAdI-context)

Allow for inheritance of implementations

Can be switched by the Switch Framework

Page 41: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 41

Comparison: Usage of Old BAdIs vs. new BAdIs

With Classic BAdI

selecting implementations and issuing calls is

mixed up

calls cause DB access

calls are redirected over a proxy class

With New BAdI

selection occurs when the handle is requested

no DB access during runtime

Implementations are called directly (without a proxy)

DATA: bd TYPE REF TO if_intf.

DATA: flt TYPE flt.

CALL METHOD cl_exithandler=>

get_instance

EXPORTING

exit_name = `BADI_NAME`

CHANGING

instance = bd.

flt-lang = `D`.

CALL METHOD bd->method

EXPORTING

x = 10

flt_val = flt.

data bd type ref to badi_name.

get badi bd filters lang = `D`.

call badi bd->method

exporting x = 10.

Old BAdIs are more expensive

than the new ones.

Active implementations are evaluated at compile time

and included in the load of the BAdI-handle.

Page 42: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 42

Definition Implementation

Package A

Package B

Switch_1

Switch_2

New BADI’s and Enhancement Framework

Simple Enhancement Spot

Spot_1

Simple Enhancement Implementation SEI1

Simple Enhancement Implementation SEI2

BAdI Implementation 1

BAdI Implementation 2

BAdI Implementation 3

BAdI Implementation 4

BAdI Implementation 5

BAdI BADI_A

BAdI BADI_B

BAdI BADI_C

Page 43: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 43

Creating BADI in SE80

BADI Definition under Enhancement Spot

BADI Implementation (Creating Filters)

Page 44: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 44

DEMOKernel-BAdI

Page 45: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 45

BAdI Migration (Automatic Migration)

Automatic migration by selecting utilitiesmigration from BAdI

Builder (se18)

Specify Enhancement Spot for BAdI Defintion

Specify Enhancement Implementation for BAdI Implementation

no special knowledge necessary

effort: 5 minutes per BAdI (with some implementations). The migration

can be automated.

Automatic migration by selecting utilitiesmigrate

from BAdI Builder (SE18)

■ Specify Enhancement Spot for BAdI Definition

■ Specify Enhancement Implementation for BAdI

Implementation

no special knowledge necessary

effort: approximately 5 minutes per BAdI.

SE18 -> utilities -> Migrate

ONLY when you have created Custom-BADI “definitions” in old systems

Page 46: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 46

Performance Comparison

Classic BAdI Migrated BAdI New BAdI

1 2-27x faster as classic BAdI

40-600x faster as classic BAdI

The more implementations defined, the

higher is the improvement on performance

200%-2600% 4000%-60000%

Page 47: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 47

Further Information

Public Web

SAP Developer Network: www.sdn.sap.com

NetWeaver Application Server ABAP

SAP Customer Services Network: www.sap.com/services/

Related SAP Education Training Opportunities

http://www.sap.com/education/

Documentation

Transaction ABAPDOCU

Books ABAP Objects and Official ABAP Reference by Horst Keller and Next

Generation ABAP Development by Rich Heilman and Thomas Jung; SAP

Press

Page 48: Upgrade for ABAP team

SAP AG 2007, SAP ERP: Upgrades for ABAP Developers/ Thomas Jung / 48

How to contact me:

Thomas Jung

[email protected]

QUESTIONS