59

Click here to load reader

News in abap concepts to further increase the power of abap development

Embed Size (px)

Citation preview

Page 1: News in abap  concepts to further increase the power of abap development

Page 1

COMP209News In ABAP –Concepts to Further Increase the Power of ABAP Development

Chris Swanepoel, SAP AG NW F ABAPHorst Keller, SAP AG NW F ABAPSeptember 08

© SAP 2008 / SAP TechEd 08 / COMP209 Page 2

Disclaimer

This presentation outlines our general product direction and should not be relied on in making a purchase decision. This presentation is not subject to your license agreement or any other agreement with SAP. SAP has no obligation to pursue any course of business outlined in this presentation or to develop or release any functionality mentioned in this presentation. This presentation and SAP's strategy and possible future developments are subject to change and may be changed by SAP at any time for any reason without notice. This document is provided without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP assumes no responsibility for errors or omissions in this document, except if such damages were caused by SAP intentionally or grossly negligent.

Page 2: News in abap  concepts to further increase the power of abap development

Page 2

© SAP 2008 / SAP TechEd 08 / COMP209 Page 3

Learning Objectives

After this lecture you will have an overview of some of the many new ABAP features regarding:

ABAP LanguageABAP Workbench ToolsABAP ConnectivityABAP Analysis Tools

© SAP 2008 / SAP TechEd 08 / COMP209 Page 4

Availability (1)

These features are available with the SAP EHP1 for the SAP NetWeaver®Application Server ABAP 7.1, i.e.:

SAP EHP1 for SAP NetWeaver Process Integration 7.1SAP NetWeaver Mobile 7.1Banking services from SAP 7.0SAP Business ByDesign™ solution Feature Pack 2.0

and the rest? ...

Page 3: News in abap  concepts to further increase the power of abap development

Page 3

© SAP 2008 / SAP TechEd 08 / COMP209 Page 5

Availability (2)

... because of the high demand for these new ABAP features:

Most of the features presented in this lecture are being backported toSAP EHP2 for SAP NetWeaver AS ABAP 7.0They will then be available in SAP Business Suite 2009

© SAP 2008 / SAP TechEd 08 / COMP209 Page 6

1. Language2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 4: News in abap  concepts to further increase the power of abap development

Page 4

© SAP 2008 / SAP TechEd 08 / COMP209 Page 7

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 8

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 5: News in abap  concepts to further increase the power of abap development

Page 5

© SAP 2008 / SAP TechEd 08 / COMP209 Page 9

Binary Floating Point Numbers – Shortcomings

ABAP type f (binary floating point number) has a large value range, but cannot represent every decimal number precisely due to the internal binary representation:

Binary floating point arithmetic can be surprising for decimal-orientated humansFor users, binary floating point numbers are not WYSIWYGResults of calculations can depend on the platformNo rounding to a specific number of decimal placesDivision by powers of 10 is inexactNo uniform behavior across database systems

DATA float TYPE f. float = '123456.15' – '123456'.

0.14999999999417923

© SAP 2008 / SAP TechEd 08 / COMP209 Page 10

Decimal Fixed Point Numbers – Shortcomings

ABAP type p (based on BCD encoding) represents a decimal number precisely and enables precise calculations (apart from the unavoidable commercial rounding), but the value range is often too small.

Various units can occur; you don't know them when writing the code, defining DB tables etc.You don't know how many decimal places may be required in a certain country/industry etc.

Example: Convert milliliters to barrels and back*

*1 barrel = 42 gallons = 9702 cubic inches = 158.987295 liters

1500.00000000000000 mL0.00943471615138 bbl

1500.00000000071672 mL

5 decimal places are inexact

Page 6: News in abap  concepts to further increase the power of abap development

Page 6

© SAP 2008 / SAP TechEd 08 / COMP209 Page 11

Decimal Floating Point Numbers

New built-in numeric types decfloat16 and decfloat34 (decimal floating point numbers) based on forthcoming standard IEEE-754r:

decfloat16:8 bytes, 16 digits, exponent -383 to +384 (range 1E-383 through 9.999999999999999E+384 )

decfloat34:16 bytes, 34 digits, exponent -6143 to +6144(range 1E-6143 through 9.999999999999999999999999999999999E+6144)

Exact representation of decimal numbers within range:Range larger than fCalculation accuracy like p

Full support for new types which can be used everywhere where types i, f and p are used. This includes:

New generic type decfloat

New Dictionary types DF16_..., DF34_..., (... = DEC, RAW, SCL)New rounding functions round and rescaleNew methods in CL_ABAP_MATHNew format options in WRITE [TO] and in string templates

© SAP 2008 / SAP TechEd 08 / COMP209 Page 12

Decimal Floating Point Numbers – Examples

DATA df34 TYPE decfloat34. df34 = '123456.15' – '123456'.

0.15

df34 = round( val = '1234.56789' dec = 3 ).1234.568

df34 = round( val = '1234.56789' dec = 3 mode = cl_abap_math=>round_floor ).

1234.567

df34 = rescale( val = '2.0' prec = 4 ).2.000

df34 = '-42'.WRITE df34 TO c12

STYLE cl_abap_math=>sign_as_postfix.

42-

Page 7: News in abap  concepts to further increase the power of abap development

Page 7

© SAP 2008 / SAP TechEd 08 / COMP209 Page 13

Decimal Floating Point Numbers – Exact Calculations

New addition EXACT for the COMPUTE statementThe operations +, - *, / and the built-in function SQRT with decimal floating point numbers are exactly rounded operations:

Error is at most 0.5 unit in the last place (ulp)Relative error is at most 5E-34

In general, rounding is done silently.The EXACT addition lets you detect if an expression cannot be evaluated exactly and if rounding was necessary.In case of rounding (inexactness) an exception is raised:

TRY.

COMPUTE EXACT result = 3 * ( 1 / 3 )....

CATCH cx_sy_conversion_rounding INTO exception.

...result = exception->value.

ENDTRY.

0.9999999999999999999999999999999999

© SAP 2008 / SAP TechEd 08 / COMP209 Page 14

Usage of ABAP Numeric Types –Recommendation

1. Type i

For integers (whole numbers). If the value range of i is not sufficient, use data type p without decimal places. If that value range is not sufficient, use decimal floating point numbers.

2. Type p

For fractional values that have a fixed number of decimal places. If the value range is not sufficient, use decimal floating point numbers.

3. Types decfloat16 and decfloat34

For fractional values that have a variable number of decimal places or a large value range. Data type decfloat16 needs less memory, but not less runtime than decfloat34.

4. Type f

Only for algorithms that are critical with regard to performance (as, e.g., matrix operations) and if accuracy is not important.

Page 8: News in abap  concepts to further increase the power of abap development

Page 8

© SAP 2008 / SAP TechEd 08 / COMP209 Page 15

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 16

Expressions – Before

Two kinds of computational expressions:Arithmetic expressionsBit expressions

that could be used behind COMPUTE onlyLogical expressionsthat could be used in control statements onlyBuilt-in functionsthat could be used in very few operand positions onlyFunctional methodsthat could be used in very few operand positions only

Littering of code with helper variables

Page 9: News in abap  concepts to further increase the power of abap development

Page 9

© SAP 2008 / SAP TechEd 08 / COMP209 Page 17

Expressions – Enhancements

Three kinds of computational expressions:Arithmetic expressionsBit expressionsString expressions

that can be used in various operand positionsEnlarged set of Built-in functionsincluding string functions and predicate functions that can be used in variousoperand positionsFunctional methodsthat can be used in various operand positions especially allowing nested and chained method calls

Slim and efficient code with in-place expressions

© SAP 2008 / SAP TechEd 08 / COMP209 Page 18

Expressions – Examples

v1 = a + b.v2 = c - d.v3 = meth( v2 ).IF v1 > v3.

...

IF a + b > meth( c – d )....

idx = lines( itab ).READ TABLE itab INDEX idx ...

READ TABLE itabINDEX lines( itab ) ...

len = strlen( txt ) - 1.DO len TIMES.

...

DO strlen( txt ) – 1 TIMES....

regex = oref->get_regex( ... ). FIND REGEX regex IN txt.

FIND REGEX oref->get_regex( ... )IN txt.

CONCATENATE txt1 txt2 INTO txt.CONDENSE txt. txt = condense( txt1 && txt2 ).

DATA oref TYPE REF TO c1.oref = c2=>m2( ).oref->m1( ).

c2=>m2( )->m1( ).

Page 10: News in abap  concepts to further increase the power of abap development

Page 10

© SAP 2008 / SAP TechEd 08 / COMP209 Page 19

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 20

Internal Tables – Generic Programming

Until now, support for generic programming with internal tables was limited:

Program generation was necessary

LOOP AT itabINTO <fs_any>WHERE col1 ... AND col2 ...

No dynamic token specification!

MODIFY itab FROM <fs_any>TRANSPORTING ('col3')WHERE col1 ... AND col2 ...

DELETE itab WHERE col1 ... AND col2 ...

Page 11: News in abap  concepts to further increase the power of abap development

Page 11

© SAP 2008 / SAP TechEd 08 / COMP209 Page 21

Internal Tables – Dynamic WHERE Clause

Now you can effectively circumvent the static typing requirements for internal table statementsby specifying the WHERE clause dynamically

DATA cond_syntax TYPE string.cond_syntax = `col1 ... AND col2 ... `.

LOOP AT <fs_any_table> INTO <fs_any>WHERE (cond_syntax).

...

Dynamic token specificationlike for other statements!

MODIFY <fs_any_table> FROM <fs_any>TRANSPORTING ('col3')WHERE (cond_syntax).

DELETE <fs_any_table> WHERE (cond_syntax).

© SAP 2008 / SAP TechEd 08 / COMP209 Page 22

Dynamic WHERE Clause – Examples

LOOP AT itabWHERE (`col2 < ( i2 + 3 ) AND col3 CP 'Joshua'`).

Relational operators and expressions

LOOP AT itab WHERE (`table_line NOT IN seltab`).

Boolean operators

LOOP AT itab WHERE (`table_line = ceil( f1 )`).

Built-in functions

LOOP AT itabWHERE (`col1 < oref->get_val( ) OR col1 = if=>const`).

Functional methods

Page 12: News in abap  concepts to further increase the power of abap development

Page 12

© SAP 2008 / SAP TechEd 08 / COMP209 Page 23

Internal Tables – Key Access

Until now:Three kinds of internal tables:

Standard tablesSorted tablesHashed tables

All kinds of internal tables have a primary table key... UNIQUE | NON-UNIQUE KEY cols ...

Problems: Key access is optimized for sorted (O(logn)) and hashed (O(1)) tablesKey access is always linear (O(n)) for standardtablesOnly one kind of optimization per internal table

size

time

O(n) O(log n) O(1)

Large performanceproblems in productive systems

© SAP 2008 / SAP TechEd 08 / COMP209 Page 24

Internal Tables – Secondary Keys

Additional to the primary key, secondary keys can be defined for all kinds of internal tables

You can define either sorted or hashed secondary keys

Sorted secondary keys can be unique or non-unique, while hashed secondary keys are always unique

In the statements for accessing internal tables, you can explicitly specify the key to be used

Secondary keys can be specified dynamically

Syntax warnings are issued if:Duplicate or conflicting secondary keys are definedBetter-suited keys are identified

Using secondary keys allows:Different key accesses to one internal table Real key access to standard tablesIndex access to hashed tables

Page 13: News in abap  concepts to further increase the power of abap development

Page 13

© SAP 2008 / SAP TechEd 08 / COMP209 Page 25

Secondary Keys – Examples With READ

DATA spfli_tab TYPE SORTED TABLE OF spfliWITH NON-UNIQUE KEY cityfrom citytoWITH UNIQUE HASHED KEY dbtab_key COMPONENTS carrid connid.

FIELD-SYMBOLS <spfli> TYPE spfli.

SELECT *FROM spfliINTO TABLE spfli_tab.

LOOP AT spfli_tab ASSIGNING <spfli>....

ENDLOOP.

READ TABLE spfli_tabWITH TABLE KEY dbtab_keyCOMPONENTS carrid = 'LH' connid = '0400'ASSIGNING <spfli>.

Primarynon-uniquesorted key

Secondaryunique

hashed key

Usage ofsecondary key

Primary key isused implicitly

Uniqueness of secondary key is

checked

© SAP 2008 / SAP TechEd 08 / COMP209 Page 26

Secondary Keys – Examples With LOOP

REPORT demo_loop_at_itab_using_key.

DATA spfli_tab TYPE HASHED TABLE OF spfliWITH UNIQUE KEY primary_key COMPONENTS carrid connidWITH NON-UNIQUE SORTED KEY city_from_to COMPONENTS cityfrom citytoWITH NON-UNIQUE SORTED KEY city_to_from COMPONENTS cityto cityfrom.

SELECT *FROM spfliINTO TABLE spfli_tabORDER BY carrid connid.

LOOP AT spfli_tab ......

ENDLOOP.

LOOP AT spfli_tab ... USING KEY city_from_to....

ENDLOOP.

LOOP AT spfli_tab ... USING KEY city_to_from....

ENDLOOP.

Primary key canalso be named

explicitly

Secondary keys

Default loopprocessing

Usage ofsecondary keys

Sequence of loopprocessing is

different

Page 14: News in abap  concepts to further increase the power of abap development

Page 14

© SAP 2008 / SAP TechEd 08 / COMP209 Page 27

Usage of Secondary Keys – Recommendation

Secondary keys introduced for boosting internal table performance

But caution:Internal management can use a lot of memoryKey updates can negatively affect performance– Unique secondary keys updated directly– Non-unique secondary keys created/updated when key is used (lazy create/update)

Main rules for using secondary keys:Very large internal table that is constructed only once in the memory and whose content is rarely modifiedIf mainly fast read access is required non-unique sorted secondary keys Only use unique (hashed) secondary keys if unique table entries with reference to particular components are a semantic issue

© SAP 2008 / SAP TechEd 08 / COMP209 Page 28

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 15: News in abap  concepts to further increase the power of abap development

Page 15

© SAP 2008 / SAP TechEd 08 / COMP209 Page 29

Pragmas – Motivation

ABAP developers receive information about problems in their code fromthe syntax check (the ABAP compiler)the extended syntax check (SLIN)the Code Inspector (CI)

Only the syntax check is fully integrated in the development process; other messages are easily overlooked

Many new syntax warning introduced with secondary keysMust be able to suppress warnings if developer recognizes a construction to be unproblematic

As many checks as possible in compiler (syntax warnings)

Provide constructs for influencing compiler's behaviour (pragmas)

© SAP 2008 / SAP TechEd 08 / COMP209 Page 30

Pragmas – Usage

Pragmas:Begin with two characters and can have parameter tokens: ##PRAGMA[PAR1][PAR2]Pragmas can only occur:– At the start of a line; only preceded by optional whitespaces– At the end of a line; possibly followed by a sentence delimiter ( . , : ) and/or an end-

of-line comment– But not after a statement delimiterParameter tokens matched against syntax warningsAre case insensitiveApplicable pragmas documented in long texts of syntax warnings

DATA: spfli_tabTYPE HASHED TABLE OF spfliWITH UNIQUE KEY carrid connidWITH NON-UNIQUE SORTED KEY k_cityfrom COMPONENTS cityfrom.

...LOOP AT spfli_tab ... WHERE cityfrom = city ##PRIMKEY[K_CITYFROM].

Suppress warning:"Secondary keyk_cityfrom is ...[better-suited]"

Page 16: News in abap  concepts to further increase the power of abap development

Page 16

© SAP 2008 / SAP TechEd 08 / COMP209 Page 31

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 32

Boxed Components – Motivation (1)

Memory wasted for sparsely filled structures:TYPES: BEGIN OF address,

...END OF address.

TYPES: BEGIN OF order,...post_addr TYPE address,alt_post_addr TYPE address, "alternative postal address

END OF order.

. . . post_addr alt_post_addr

Memory chunk

Often not used

Page 17: News in abap  concepts to further increase the power of abap development

Page 17

© SAP 2008 / SAP TechEd 08 / COMP209 Page 33

Boxed Components – Motivation (2)

Data references are cumbersome:

Developer must ensure that data object exists before it is accessed (CREATE DATA ... ).Special dereferencing operator (->*) must be used to access data objectComponents behind data references cannot be part of a table keyStructures with data references cannot be passed to RFC or be EXPORTed

TYPES: BEGIN OF order,...alt_post_addr TYPE REF TO address,

END OF order.

Must be created by developer

alt_post_addr. . . post_addr

© SAP 2008 / SAP TechEd 08 / COMP209 Page 34

Boxed Components – Concept

Boxed components optimize memory consumption for initial structured componentsand initial structured attributes of classes by:

Storing the components separately (not in place)Only allocating memory on demand, i.e.:

Write accessReferencing the boxed structure (ASSIGN / GET REFERENCE)Passing the boxed structure as a parameter

Sharing initial values

alt_post_addr

alt_post_addr

Initial recordin type load

alt_post_addr

. . . post_addr

Initial boxed component

. . . post_addr

Page 18: News in abap  concepts to further increase the power of abap development

Page 18

© SAP 2008 / SAP TechEd 08 / COMP209 Page 35

Boxed Components – Concept

Boxed components optimize memory consumption for initial structured componentsand initial structured attributes of classes by:

Storing the components separately (not in place)Only allocating memory on demand, i.e.:

Write accessReferencing the boxed structure (ASSIGN / GET REFERENCE)Passing the boxed structure as a parameter

Sharing initial values

alt_post_addr

Initial recordin type load

alt_post_addr

. . . post_addr

Allocated boxed component

. . . post_addr alt_post_addr

© SAP 2008 / SAP TechEd 08 / COMP209 Page 36

Boxed Components – Language Integration

Structured components and attributes can be defined as boxed.

Example for classes:

The boxed feature is also supported for dictionary structures and global classes.

TYPES: BEGIN OF order,...post_addr TYPE address,alt_post_addr TYPE address BOXED,

END OF order.

CLASS lcl_order DEFINITION.PUBLIC SECTION....DATA: post_addr TYPE address,

alt_post_addr TYPE address BOXED.ENDCLASS.

Page 19: News in abap  concepts to further increase the power of abap development

Page 19

© SAP 2008 / SAP TechEd 08 / COMP209 Page 37

Boxed Components – Advantages

Boxed components offer all the advantages of data references, but:

Memory is allocated automatically on demandThey can be accessed like normal substructures or attributes using component selectorThey can be part of a table keyThey can be EXPORTed and passed to RFC (only with basXML)

Boxed components:

Must be structuresAre deep structures with all the consequences (comparable to TYPE c vs. TYPE string)Are also supported for dictionary structures

© SAP 2008 / SAP TechEd 08 / COMP209 Page 38

DEMO

Page 20: News in abap  concepts to further increase the power of abap development

Page 20

© SAP 2008 / SAP TechEd 08 / COMP209 Page 39

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 40

On Demand Loading – Motivation

Until now, the ABAP compiler could only load external definitions (e.g. TYPE-POOLs, classes and interfaces) at certain times:

Definitions loaded "as soon as possible" to minimize compilation errorsIf definitions refer to other definitions, further definitions had to be loaded

Consequence:Significant amount of the loaded definitions in ABAP sources not neededVery costly dependency administrationHigh recompilation frequency (e.g. changes of DDIC types affected many ABAP loads that didn't really use the type)Code instability (syntax errors in definitions "far away" affected many programs that didn't really need these definitions)Workarounds to avoid dependencies bypassed static checks and negatively affected coderobustness and maintainability:

Unnecessary use of dynamic callsUse of unsafe types, e.g. parameter typed REF TO OBJECT

Page 21: News in abap  concepts to further increase the power of abap development

Page 21

© SAP 2008 / SAP TechEd 08 / COMP209 Page 41

On Demand Loading – Benefits

External definitions are only loaded when actually required (on demand):

Consequences for ABAP language:

TYPE POOLS statement is obsolete CLASS ... DEFINITION LOAD statement is obsoleteINTERFACE ... LOAD statement is obsolete

These statements are now ignored by the ABAP Compiler and can be deleted.

...DATA: obj TYPE REF TO iface....var = iface=>const....

Definition not loaded

Definition loaded

© SAP 2008 / SAP TechEd 08 / COMP209 Page 42

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 22: News in abap  concepts to further increase the power of abap development

Page 22

© SAP 2008 / SAP TechEd 08 / COMP209 Page 43

String Processing – Before

Set of statementsFIND SUBSTRING|REGEX ...REPLACE SUBSTRING|REGEX ...CONCATENATE ...SPLIT ...

...

Set of logical operatorsCS, NSCA, NA CP, NP

...

Set of built-in describing functionsstrlen( ... )charlen( ... )

...

Substring access via offset/length specification... text+off(len) ...

© SAP 2008 / SAP TechEd 08 / COMP209 Page 44

String Processing – Enhancements

New string expressionsConcatenations ... txt1 && txt2 ... andString Templates ... |...{ txt format = ... }...| ...

Can be used in expression positions

New built-in string functionsdistance, condense, concat_lines_of, escape, find, find_end, find_any_of, find_any_not_of, insert, repeat, replace, reverse, segment, shift_left, shift_right, substring, substring_aftersubstring_from, substring_before, substring_to, to_upper, to_lower, to_mixed, from_mixed, translate

Can be used in functional positions

New built-in predicate functions for stringscontains, contains_any_of, contains_any_not_of

Can be used as logical expressions

Page 23: News in abap  concepts to further increase the power of abap development

Page 23

© SAP 2008 / SAP TechEd 08 / COMP209 Page 45

String Expressions – Concatenation Operator

Concatenation operator

... txt1 && txt2 ...

Replaces CONCATENATE statement and many auxiliary variables

DATA text TYPE string.

text = `Hello`.

CONCATENATE text ` world!` INTO text.

DATA text TYPE string.

text = `Hello`.

text = text && ` world!`.

© SAP 2008 / SAP TechEd 08 / COMP209 Page 46

String Expressions – String Templates

Very powerful, replaces WRITE TO statement and many auxiliaries

... |...{ txt format = ... }...| ...

Literal Text EmbeddedExpression

Format Options Literal Text

result = |{ txt width = 20align = left pad = pad }<---|.

WRITE / result.result = |{ txt width = 20

align = center pad = pad }<---|.WRITE / result.result = |{ txt width = 20

align = right pad = pad }<---|.WRITE / result.

Text „OOO“ and pad „x“ give

Page 24: News in abap  concepts to further increase the power of abap development

Page 24

© SAP 2008 / SAP TechEd 08 / COMP209 Page 47

String Functions – Examples

result = condense( val = ` Rock'xxx'Roller` del = `re ` from = `x` to = `n` ).

gives "Rock'n'Roll"

html = `<title>This is the <i>Title</i></title>`. repl = `i`.

html = replace( val = html regex = repl && `(?![^<>]*>)` with = `<b>$0</b>` occ = 0 ).

gives "<title>Th<b>i</b>s <b>i</b>s the <i>T<b>i</b>tle</i></title>"

IF matches( val = emailmatch = `\w+(\.\w+)*@(\w+\.)+(\w{2,4})` ).

true if email contains a valid e-mail address

© SAP 2008 / SAP TechEd 08 / COMP209 Page 48

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 25: News in abap  concepts to further increase the power of abap development

Page 25

© SAP 2008 / SAP TechEd 08 / COMP209 Page 49

12h Time Format – Motivation

Number and date output formatted according to language environment:

Until now, only 24 hour format for time output:

* 'DE' in user master recordsWRITE sy-datum TO c10 DD/MM/YYYY.

SET COUNTRY 'US'.WRITE sy-datum TO c10 DD/MM/YYYY.

04/13/2008

13.04.2008

* 'DE' in user master recordsWRITE sy-uzeit TO c8.

SET COUNTRY 'US'.WRITE sy-uzeit TO c8.

14:55:00

14:55:00

© SAP 2008 / SAP TechEd 08 / COMP209 Page 50

12h Time Format – Usage

Four additional 12 hour formats have been introduced:12-hour format (1 to 12) or (1 to 11), e.g. 12:59:59 PM or 00:59:59 PMam/pm or AM/PM, e.g. 01:00:00 AM or 01:00:00 am

Default format can be specified in the user master records

New:Addition ENVIRONMENT TIME FORMAT to the WRITE TO and WRITE statementFormating options COUNTRY and environment for string templatesClass CL_ABAP_TIMEFM for converting between external and internal time

* 'DE' in user master recordstime = |{ sy-uzeit time = environment }|.

SET COUNTRY 'US'.time = |{ sy-uzeit time = environment }|.

02:55:00 PM

14:55:00

Page 26: News in abap  concepts to further increase the power of abap development

Page 26

© SAP 2008 / SAP TechEd 08 / COMP209 Page 51

1. Language1.1. Decimal Floating Point Numbers1.2. Expressions1.3. Internal Tables1.4. Pragmas1.5. Boxed Components1.6. ABAP Compiler – On Demand Loading1.7. String Processing1.8. 12h Time Format1.9. Strings in Database Tables

2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 52

Strings in Database Tables – Shortcomings

You can use Open SQL to store character strings and binary data in databasecolumns, but:

Short strings:Only available for character strings (DDIC type SSTRING)Length restricted to 255 charactersCan not be used as key columns

Long strings (LOBs):CLOBs (for character strings) and BLOBs (for binary data)No maximum length; can be very large

How to store internal tables with string components in primary key?

How to process LOBs quickly and efficiently without exhausting session memory?

Page 27: News in abap  concepts to further increase the power of abap development

Page 27

© SAP 2008 / SAP TechEd 08 / COMP209 Page 53

Strings in Database Tables – Short Strings

New:

Short strings can be used as key columns of database tablesCan be used in database indexesMaximum length 1333

© SAP 2008 / SAP TechEd 08 / COMP209 Page 54

Strings in Database Tables – Long Strings

Locators and database streams to access LOBs in database tables:

Locators:Linked to LOBs for read and write access (LOB handles)Access sub-sequences of LOBs or properties of LOBs on databaseCopy LOBs within the database without first copying data to application serverHigher resource consumption on database server

Database streams:Read and write streams linked to LOBs for read and write access respectively (LOB handles)LOB data can be sequentially processed using methods of streamsNo increased resource consumption

No unnecessary data transports

Page 28: News in abap  concepts to further increase the power of abap development

Page 28

© SAP 2008 / SAP TechEd 08 / COMP209 Page 55

Locators – Usage

Copy a LOB column

DATA: locator TYPE REF TO cl_abap_db_c_locator.

SELECT SINGLE longtext FROM lob_tableINTO locatorWHERE key = key1.

UPDATE lob_tableSET longtext = locatorWHERE key = key2.

locator->close( ).

Create locator

Access data using locator

Close locator

© SAP 2008 / SAP TechEd 08 / COMP209 Page 56

Database Streams – Usage

Read GIF picture from database and write to file

DATA: reader TYPE REF TO cl_abap_db_x_reader.

SELECT SINGLE picture FROM blob_tableINTO readerWHERE name = pic_name.

...

WHILE reader->data_available( ) = 'X'.TRANSFER reader->read( len ) TO pict_file.

ENDWHILE.

reader->close( ).

Create stream reader

Write data to file

Close stream reader

Page 29: News in abap  concepts to further increase the power of abap development

Page 29

© SAP 2008 / SAP TechEd 08 / COMP209 Page 57

1. Language2. Workbench Tools

2.1. Overview2.2. Splitter Control for Classical Dynpro

3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 58

1. Language2. Workbench Tools

2.1. Overview2.2. Splitter Control for Classical Dynpro

3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 30: News in abap  concepts to further increase the power of abap development

Page 30

© SAP 2008 / SAP TechEd 08 / COMP209 Page 59

Workbench Tools – Overview

The Workbench contains some hardly known tools and some new, very useful tools:

New ABAP Editor:Code completionConfigurable (font size, general options, formatting options, etc.)Code outliningBookmarksSplit viewExtended cut & pasteAdvanced navigationPattern insertion by drag & dropCode templates

Refactoring assistant

Source code based class editor

Splitter control for classical Dynpro

© SAP 2008 / SAP TechEd 08 / COMP209 Page 60

Workbench Tools – Source Code Based Class Editor

Page 31: News in abap  concepts to further increase the power of abap development

Page 31

© SAP 2008 / SAP TechEd 08 / COMP209 Page 61

DEMO

© SAP 2008 / SAP TechEd 08 / COMP209 Page 62

1. Language2. Workbench Tools

2.1. Overview2.2. Splitter Control for Classical Dynpro

3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 32: News in abap  concepts to further increase the power of abap development

Page 32

© SAP 2008 / SAP TechEd 08 / COMP209 Page 63

Workbench Tools – Splitter Control for Classical Dynpro

© SAP 2008 / SAP TechEd 08 / COMP209 Page 64

1. Language2. Workbench Tools3. Connectivity

3.1. Overview3.2. bgRFC & LDQ3.3. Class Based Exceptions

4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 33: News in abap  concepts to further increase the power of abap development

Page 33

© SAP 2008 / SAP TechEd 08 / COMP209 Page 65

1. Language2. Workbench Tools3. Connectivity

3.1. Overview3.2. bgRFC & LDQ3.3. Class Based Exceptions

4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 66

Connectivity – Overview

Background RFC (bgRFC) replacing transactional RFC (tRFC) and queued RFC (qRFC): Delivered with SAP NetWeaver 7.0 EhP1

Local Data Queue (LDQ) replacing qRFC No-Send:Delivered with SAP NetWeaver 7.0 EhP1

New, additional RFC serialization in basXML:Delivered for all RFC types (ABAP ABAP)

SAP NetWeaver RFC LibraryDelivered since April 2007

RFC support in SAP JEE 7.1New JCo APIJava Resource Adapter for SAP JCoJava IDoc Class Library

New standalone JCo 3.0

Class based exceptions EHP1 SAP NW AS ABAP 7.1

SAP NW AS ABAP 7.1

Page 34: News in abap  concepts to further increase the power of abap development

Page 34

© SAP 2008 / SAP TechEd 08 / COMP209 Page 67

1. Language2. Workbench Tools3. Connectivity

3.1. Overview3.2. bgRFC & LDQ3.3. Class Based Exceptions

4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 68

bgRFC – Asynchronous Processing

ABAP Program* Create bgRFC unit

Function Modules

Scheduler

Target SystemFetch Unit

Process Unit

SAP NetWeaver AS ABAP

SAP NetWeaver AS ABAP

Destinationand Function

Calls

Save Unit

Sender System

Page 35: News in abap  concepts to further increase the power of abap development

Page 35

© SAP 2008 / SAP TechEd 08 / COMP209 Page 69

bgRFC – RFC Types

Transactional bgRFC (Type T) replaces tRFC:Units executed "Exactly Once" (EO)Units executed in no guaranteed orderFunction modules in unit are executed in specified order

Queued bgRFC (Type Q) replaces qRFC (not No-Send)Units executed "Exactly Once In Order" (EOIO):FIFO Queues used to order units; Function modules executed in specified orderPutting same unit in different queues synchronizes queues

1

2 3

4

5 69

8

7

10

Same units several queues Processing order

Queue1

Queue2

Queue3

45

23569

8 5

9 7

10

10

1

in out

© SAP 2008 / SAP TechEd 08 / COMP209 Page 70

bgRFC – Example

Create bgRFC unit type qSend the unit to a remote system

DATA: dest TYPE REF TO if_bgrfc_destination_outbound,unit TYPE REF TO if_qrfc_unit_outbound.

...dest = cl_bgrfc_destination_outbound=>create( 'DEST_NAME' ).

unit = dest->create_qrfc_unit( ).

unit->add_queue_name_outbound( 'QUEUE_NAME' ).

CALL FUNCTION 'FUNC1' IN BACKGROUND UNIT unit.

COMMIT WORK.

Create outbound destination

Create unit andspecify queue

Add funtioncall to unit

Page 36: News in abap  concepts to further increase the power of abap development

Page 36

© SAP 2008 / SAP TechEd 08 / COMP209 Page 71

bgRFC – Advantages

For the developer:Object-oriented and easy to use APIClear programming model, no implicit assumptions

For the administrator:Effective tools support monitoring and error analysisEasy to apply load balancingEasy to configure system resources for bgRFC

For the system workload:Lean and well-structured designDependency handling optimizedSupport of load balancingConfigurable number of schedulersConfigurable load on system

© SAP 2008 / SAP TechEd 08 / COMP209 Page 72

bgRFC vs. qRFC

Free System Capacity Measured for bgRFC and qRFC

0

10

20

30

40

50

60

0 50 100 150 200

processing time in minutes

num

ber o

f fre

e w

orkp

roce

sses

Classic RFC

bgRFC

Average ± 1 std. dev.

Page 37: News in abap  concepts to further increase the power of abap development

Page 37

© SAP 2008 / SAP TechEd 08 / COMP209 Page 73

Local Data Queue (LDQ)

Allows applications to record data that can be read by a receiving application (pull principle)Replaces qRFC No-SendData storage in local queuesCharacter and binary data compressed before storageEach application has its own queues Applications do not affect each otherSame data written to different queues only stored onceObject-orientated API

Q-A

Q-B

Q-C

Local queues

write read

© SAP 2008 / SAP TechEd 08 / COMP209 Page 74

1. Language2. Workbench Tools3. Connectivity

3.1. Overview3.2. bgRFC & LDQ3.3. Class Based Exceptions

4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 38: News in abap  concepts to further increase the power of abap development

Page 38

© SAP 2008 / SAP TechEd 08 / COMP209 Page 75

Class Based Exceptions

With SAP EHP1 for SAP NetWeaver AS ABAP 7.1 class based exceptions can bespecified in the interfaces of remote enabled function modules

Old-style exceptions can now be handled in TRY ... CATCH blocks:Predefined exceptions, e.g. SYSTEM_FAILURE, can be handled by catchingCX_REMOTE_EXCEPTION

Other old-style exceptions can be handled by catching CX_CLASSIC_EXCEPTION

TRY.CALL FUNCTION 'FUNC1' DESTINATION 'NONE'.

CATCH cx_my_exception INTO my_exception.msg = my_exception->get_text( )....

CATCH cx_remote_exception INTO remote_exception.msg = remote_exception->get_text( )....

ENDTRY.

Catch classbased exception

Catch predefinedold-style exceptions

© SAP 2008 / SAP TechEd 08 / COMP209 Page 76

1. Language2. Workbench Tools3. Connectivity4. Analysis Tools

4.1. ABAP Debugger4.2. ABAP Runtime Analysis4.3. SQL Stack Trace

5. ABAP Labs – Ideas That Work

Agenda

Page 39: News in abap  concepts to further increase the power of abap development

Page 39

© SAP 2008 / SAP TechEd 08 / COMP209 Page 77

1. Language2. Workbench Tools3. Connectivity4. Analysis Tools

4.1. ABAP Debugger4.2. ABAP Runtime Analysis4.3. SQL Stack Trace

5. ABAP Labs – Ideas That Work

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 78

ABAP Debugger - Overview

New Dynpro analysis toolNew Web Dynpro analysis toolSimple transformation debuggingAutomated debugging via debugger scriptingEnhancement debuggingDebugger consoleLayer debugging Miscellaneous:

Upload internal tablesTable View: view and configure sub-components of embedded structuresDebug expressions and of multiple statements within one line Change long fieldsCall stack of the internal session of the callerException stack

Page 40: News in abap  concepts to further increase the power of abap development

Page 40

© SAP 2008 / SAP TechEd 08 / COMP209 Page 79

Debugger Scripting – Overview

Motivation

Have you ever dreamt of a debugger which:Debugs a problem on its own – in a (semi-) automated way?Allows you to write all kinds of information to a trace file?

The new scripting engine of the ABAP debugger allows you to

Control the debugger by simply writing a small ABAP programAccess the same information about the debuggee as the debugger itselfWrite various information to a trace file

Standalone transaction for script trace analysis: SAS

© SAP 2008 / SAP TechEd 08 / COMP209 Page 80

Debugger Scripting – Architecture (1)

Session 1 - Debuggee

ABAP VM

Session 2 - Debugger

UI

Debugger Engine

ADI

…doDebugStep( SingleStep )setBreakpoint ( )setWatchpoint( )

getValue( ‘SY-SUBRC’ )getStack ( )…

Page 41: News in abap  concepts to further increase the power of abap development

Page 41

© SAP 2008 / SAP TechEd 08 / COMP209 Page 81

Debugger Scripting – Architecture (2)

Session 1 - Debuggee

ABAP VM

Session 2 - Debugger

UI

Debugger Engine

ADI

ABAP-Script

…“doDebugStep( )”“setBreakpoint ( )”“setWatchpoint( )”“getValue( ‘SY-SUBRC’ )”“getStack ( )”“writeTrace( )”…

© SAP 2008 / SAP TechEd 08 / COMP209 Page 82

Debugger Scripting – Automated Debugging

Debuggeris running application

ABAP-Script

Script-Trace

Trigger

VALUE SY-SUBRC = 5, NEXT WER DAS LESEN KANN IST ZU NAHE, WER DAS KLESEN KANN

IST ZU NAHE, SY-SUBRC = 5, NEXT WER DAS LESEN KANN IST ZU NAHE, WER DAS KLESEN

KANN IST ZU NAHE,

VALUE SY-SUBRC = 5, NEXT WER DAS LESEN KANN IST ZU NAHE, WER DAS KLESEN KANN

IST ZU NAHE, SY-SUBRC = 5, NEXT WER DAS LESEN KANN IST ZU NAHE, WER DAS KLESEN

KANN IST ZU NAHE,

VALUE SY-SUBRC = 5, NEXT WER DAS LESEN KANN IST ZU NAHE, WER DAS KLESEN KANN

IST ZU NAHE, SY-SUBRC = 5, NEXT WER DAS LESEN KANN IST ZU NAHE, WER DAS KLESEN

KANN IST ZU NAHE,

Page 42: News in abap  concepts to further increase the power of abap development

Page 42

© SAP 2008 / SAP TechEd 08 / COMP209 Page 83

Debugger Scripting – Usage

Statement trace

Conditional break-points

„Stop only for special programs“

Whatever you can imagine …

Use standard ABAP for a debugger script, which controls the debugger during the running

application

© SAP 2008 / SAP TechEd 08 / COMP209 Page 84

Layer Debugging – Motivation

Kernel (C/C++)

(ABAP / Dynp core functionality)

Business applications(ABAP)

System services (ABAP, system program)

( update, printing, controls …)

Application framework layer I

Application framework layer II

System stuff – irrelevant for ABAP application developer

My codeSome other stuff

My code …

Debugging is a nightmare!

My code is hidden under all the other stuff !

WEB Dynpro(ABAP)

Page 43: News in abap  concepts to further increase the power of abap development

Page 43

© SAP 2008 / SAP TechEd 08 / COMP209 Page 85

Layer Debugging – Concept

Solution: Layer Debugging

Define your "layer" of interest and hide the rest during debugging

Jump from layer to layer or from component to component instead of single stepping through the code

ApplicationUI

DB

© SAP 2008 / SAP TechEd 08 / COMP209 Page 86

Layer Debugging – Defining Layers

Selection SetS2

Class: CL_1, CL_2

Selection SetS1

Packages: P1, P2, P3

Expression

„S1 AND ( NOT S2 )“

Object Set („Layer“)

L1 S1 S2

Expr

Selection Set Criteria:Selection Set Criteria:•• Packages (w/ or w/o subPackages (w/ or w/o sub--packages)packages)•• Programs / ClassesPrograms / Classes•• Function ModulesFunction Modules•• Implementing interfaceImplementing interface

Expression:Expression:

•• Use selection set names as operandsUse selection set names as operands•• Use any logical operand, ABAPUse any logical operand, ABAP--likelike

Object Set (Layer)Object Set (Layer)

•• Transport ObjectTransport Object•• Global, Local, FavoritesGlobal, Local, Favorites

Page 44: News in abap  concepts to further increase the power of abap development

Page 44

© SAP 2008 / SAP TechEd 08 / COMP209 Page 87

Layer Debugging – Defining Debugger Behaviour

L1

<<REST>>

L2

L3

Visible Point ofEntry

Point ofExit

Incl.System

Code

S2Expr S1

S1Expr S6

S2Expr S1

„Rest code“, not covererd by any other

layer, can be excluded

Normal debugger stepping: not visible = „system code“,

line breakpoints not hidden„Layer stepping“:

Stop at layer entry

„Layer stepping“:Stop at layer exit

What to do withsystem codeinside layer

© SAP 2008 / SAP TechEd 08 / COMP209 Page 88

Layer Debugging – Usage

Change Profile

After activating a debugger profile:Debugger will only stop in visible layersNew button “Next object set” to jump from layer to layer

Page 45: News in abap  concepts to further increase the power of abap development

Page 45

© SAP 2008 / SAP TechEd 08 / COMP209 Page 89

Expression Debugging

After activating expression stepping:Step from one sub condition to the nextDisplay the result of functional methods

-> Understand which sub condition fails

© SAP 2008 / SAP TechEd 08 / COMP209 Page 90

Web Dynpro Analysis Tool

Use the brand new

Web Dynpro tool

to analyze your Web Dynpro application

in the ABAP debugger

Page 46: News in abap  concepts to further increase the power of abap development

Page 46

© SAP 2008 / SAP TechEd 08 / COMP209 Page 91

DEMO

© SAP 2008 / SAP TechEd 08 / COMP209 Page 92

1. Language2. Workbench Tools3. Connectivity4. Analysis Tools

4.1. ABAP Debugger4.2. ABAP Runtime Analysis4.3. SQL Stack Trace

5. ABAP Labs – Ideas That Work

Agenda

Page 47: News in abap  concepts to further increase the power of abap development

Page 47

© SAP 2008 / SAP TechEd 08 / COMP209 Page 93

ABAP Runtime Analysis – As You Know It

Users. . .

SAP System

SAP NW AS ABAP

VM

Trace file

. . .

SAP NW AS ABAP

VM

Trace file

Execute measurement Analyze resultsR R

© SAP 2008 / SAP TechEd 08 / COMP209 Page 94

ABAP Runtime Analysis – What´s New?

Users. . .

SAP System

SAP NW AS ABAP

VM

Trace file

. . .

Trace container Trace container. . .

SAP NW AS ABAP

VM

Trace file

Execute measurement Analyze results

Database

R R

SATAnalyze results

Page 48: News in abap  concepts to further increase the power of abap development

Page 48

© SAP 2008 / SAP TechEd 08 / COMP209 Page 95

ABAP Runtime Analysis – Analysis tools

The new SAT (previously SE30) features:Modern and flexible UIEasy navigation between different tools (e.g. from call hierarchy to hit list etc.)Profile tool to find which package, layer, program consumes most of the timeCall stack for each call hierarchy trace itemProcessing blocks tool is provided to get an aggregated view of the program flowHotspot analysis to find performance and memory hotspotsDiff tools to compare two hit lists and call hierarchiesCentral trace containers which can be accessed from all servers in the system

© SAP 2008 / SAP TechEd 08 / COMP209 Page 96

1. Language2. Workbench Tools3. Connectivity4. Analysis Tools

4.1. ABAP Debugger4.2. ABAP Runtime Analysis4.3. SQL Stack Trace

5. ABAP Labs – Ideas That Work

Agenda

Page 49: News in abap  concepts to further increase the power of abap development

Page 49

© SAP 2008 / SAP TechEd 08 / COMP209 Page 97

SQL Stack Trace – New ST05

With SAP EHP1 for SAP NetWeaver AS ABAP 7.1 the new Performance Analysis (ST05) offers:

New accessible transactionImproved usability

Layouts can be stored as user specific defaultSorting, filtering, totals, subtotals, etc. on all fields

Selections can be stored as report variantNew operation LOBSTA (Large Object Statement)

Set when DB manipulates BLOBs

New SQL Stack Trace . . .

© SAP 2008 / SAP TechEd 08 / COMP209 Page 98

SQL Stack Trace – Usage

::

:

Page 50: News in abap  concepts to further increase the power of abap development

Page 50

© SAP 2008 / SAP TechEd 08 / COMP209 Page 99

1. Language2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

5.1. Layer Awareness5.2. Request Based Debugging

Agenda

© SAP 2008 / SAP TechEd 08 / COMP209 Page 100

1. Language2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

5.1. Layer Awareness5.2. Request Based Debugging

Agenda

Page 51: News in abap  concepts to further increase the power of abap development

Page 51

© SAP 2008 / SAP TechEd 08 / COMP209 Page 101

Layer Awareness

Many tools are already "layer aware":

ABAP DebuggerABAP Runtime Analysis (SAT)

Many will follow:

ABAP Memory Inspector (under development)...

© SAP 2008 / SAP TechEd 08 / COMP209 Page 102

1. Language2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

5.1. Layer Awareness5.2. Request Based Debugging

Agenda

Page 52: News in abap  concepts to further increase the power of abap development

Page 52

© SAP 2008 / SAP TechEd 08 / COMP209 Page 103

Breakpoints In ABAP

How many different breakpoint kinds exist ?

Debugger breakpointsScope: debugging sessionset in : debugger

Session breakpointsScope: logon sessionSet in : development workbench

External breakpointsScope: all logon sessions (for one user on one server)Set in : development workbench

Other breakpoints:break <User-Name>.

break-point.

break-point ID … .

© SAP 2008 / SAP TechEd 08 / COMP209 Page 104

External Breakpoints – Problem With "One Server" Scope

System XYZ

HTTP Req. Hndl......

...

...

RFC Fct. Module......

...

...

RFC Fct. Module......

...

...

RFC

Server 1

Server 2RFC

HTTP Request

Requests on other servers

Load-balancing

Page 53: News in abap  concepts to further increase the power of abap development

Page 53

© SAP 2008 / SAP TechEd 08 / COMP209 Page 105

External Breakpoints – Solution to "One Server" Scope

External breakpointsScope: all logon sessions (for one user on all servers)Set in : development workbench

Network Enabled TPDA(Two Process Debugging Architecture)

Debugger & Debuggeeon two different servers (of two different systems)

© SAP 2008 / SAP TechEd 08 / COMP209 Page 106

External Breakpoints – Problem With "One User" Scope

ABAP Program......

...

...

System ABC System XYZ

HTTP Req. Hndl......

...

...

RFC Fct. Module......

...

...

RFC Fct. Module......

...

...

RFC

Server 1

Server 2RFC

HTTP

STOECK

ANZEIGERINET_USER

Page 54: News in abap  concepts to further increase the power of abap development

Page 54

© SAP 2008 / SAP TechEd 08 / COMP209 Page 107

External Breakpoints – Solution to "One User" Scope

Sending “terminal ID” with EPP(Extended PassPort)

“Terminal ID” represents windows logon sessionStored in windows registry

Tag breakpoint with “terminal ID”Send “terminal ID” with request

SAP HTTP PlugIn for MS IE (SAP Solution Manager & stand-alone, note 1041556)

SAP GUI (OK-Code: ”/htid”)

External breakpointsscope: all logon sessions (for one request on all servers)set in : development workbench

© SAP 2008 / SAP TechEd 08 / COMP209 Page 108

External Break-Points – Terminal ID

System XYZ

HTTP Req. Hndl......

...

...

RFC Fct. Module......

...

...

RFC Fct. Module......

...

...

RFC

Server 1

Server 2RFC

HTTP Request

& tID

tID

tID

& tIDtID

tID

Page 55: News in abap  concepts to further increase the power of abap development

Page 55

© SAP 2008 / SAP TechEd 08 / COMP209 Page 109

DEMO

© SAP 2008 / SAP TechEd 08 / COMP209 Page 110

1. Language2. Workbench Tools3. Connectivity4. Analysis Tools5. ABAP Labs – Ideas That Work

Agenda

Page 56: News in abap  concepts to further increase the power of abap development

Page 56

© SAP 2008 / SAP TechEd 08 / COMP209 Page 111

Summary

The new features in:ABAP Language offer:

Decimal floating point numbersExtended expression handlingSecondary keys for internal tables and pragmasBoxed componentsEnhanced string processing12h time formatLocators and database streams

ABAP Workbench and Tools offer:New ABAP editorSplitter control for classical DynproDebugger scripting and layer debuggingSQL stack trace

ABAP Connectivity offer:bgRFC and LDQClass based exceptionsJCO 3.0

© SAP 2008 / SAP TechEd 08 / COMP209 Page 112

SDN Subscriptions offers developers and consultants like you, an annual license to the complete SAP NetWeaver platform software, related services, and educational content, to keep you at the top of your profession.

SDN Software Subscriptions: (currently available in U.S. and Germany)A one year low cost, development, test, and commercialization license to the complete SAP NetWeaver software platform Automatic notification for patches and updatesContinuous learning presentations and demos to build expertise in each of the SAP NetWeaver platform componentsA personal SAP namespace

SAP NetWeaver Content Subscription: (available globally)An online library of continuous learning content to help build skills.

Starter Kit

Building Your Business with SDN Subscriptions

To learn more or to get your own SDN Subscription, visit us at the Community Clubhouse or at www.sdn.sap.com/irj/sdn/subscriptions

Page 57: News in abap  concepts to further increase the power of abap development

Page 57

© SAP 2008 / SAP TechEd 08 / COMP209 Page 113

Fuel your Career with SAP Certification

What the industry is saying

“Teams with certified architects and developers deliver projects on specification, on time, and on budget more often than other teams.”2008 IDC Certification Analysis

“82% of hiring managers use certification as a hiring criteria.”2008 SAP Client Survey

“SAP Certified Application Professional status is proof of quality, and that’s what matters most to customers.”*Conny Dahlgren, SAP Certified Professional

Take advantage of the enhanced, expanded and multi tier certifications from SAP today!

© SAP 2008 / SAP TechEd 08 / COMP209 Page 114

Further Information

Related Workshops/Lectures at SAP TechEd 2008COMP106, Next Generation: ABAP Performance and Trace

Analysis, LectureCOMP267, ABAP Troubleshooting, Hands-onCOMP269, Efficient Database Programming, Hands-onCOMP271, Effective Utilization of bgRFC, Hands-onCOMP272, Memory Efficient ABAP Programming, Hands-onCOMP273, Test-Driven and Bulletproof ABAP Development, Hands-onCOMP274, State-of-the-Art ABAP – Modern Business Programming

with ABAP Objects, Hands-onCOMP360, Enhancement and Switch Framework, Hands-onCOMP361, Advanced ABAP Programming, Hands-on

Related SAP Education and Certification Opportunitieshttp://www.sap.com/education/

SAP Public Web:SAP Developer Network (SDN): www.sdn.sap.comBusiness Process Expert (BPX) Community: www.bpx.sap.com

Page 58: News in abap  concepts to further increase the power of abap development

Page 58

© SAP 2008 / SAP TechEd 08 / COMP209 Page 115

Thank you!

© SAP 2008 / SAP TechEd 08 / COMP209 Page 116

Please complete your session evaluation.Be courteous — deposit your trash,

and do not take the handouts for the following session.

Thank You !

Feedback

Page 59: News in abap  concepts to further increase the power of abap development

Page 59

© SAP 2008 / SAP TechEd 08 / COMP209 Page 117

Copyright 2008 SAP AGAll Rights Reserved

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

SAP, R/3, xApps, xApp, SAP NetWeaver, Duet, SAP Business ByDesign, ByDesign, PartnerEdge and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned and associated logos displayed are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG. This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended strategies, developments, and functionalities of the SAP® product and is not intended to be binding upon SAP to any particular course of business, product strategy, and/or development. Please note that this document is subject to change and may be changed by SAP at any time without notice. SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.

SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence.

The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages.

Weitergabe und Vervielfältigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form auch immer, ohne die ausdrückliche schriftliche Genehmigung durch SAP AG nicht gestattet. In dieser Publikation enthaltene Informationen können ohne vorherige Ankündigung geändert werden.

Einige von der SAP AG und deren Vertriebspartnern vertriebene Softwareprodukte können Softwarekomponenten umfassen, die Eigentum anderer Softwarehersteller sind.

SAP, R/3, xApps, xApp, SAP NetWeaver, Duet, SAP Business ByDesign, ByDesign, PartnerEdge und andere in diesem Dokument erwähnte SAP-Produkte und Services sowie die dazugehörigen Logos sind Marken oder eingetragene Marken der SAP AG in Deutschland und in mehreren anderen Ländern weltweit. Alle anderen in diesem Dokument erwähnten Namen von Produkten und Services sowie die damit verbundenen Firmenlogos sind Marken der jeweiligen Unternehmen. Die Angaben im Text sind unverbindlich und dienen lediglich zu Informationszwecken. Produkte können länderspezifische Unterschiede aufweisen.

Die in dieser Publikation enthaltene Information ist Eigentum der SAP. Weitergabe und Vervielfältigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form auch immer, nur mit ausdrücklicher schriftlicher Genehmigung durch SAP AG gestattet. Bei dieser Publikation handelt es sich um eine vorläufige Version, die nicht Ihrem gültigen Lizenzvertrag oder anderen Vereinbarungen mit SAP unterliegt. Diese Publikation enthält nur vorgesehene Strategien, Entwicklungen und Funktionen des SAP®-Produkts. SAP entsteht aus dieser Publikation keine Verpflichtung zu einer bestimmten Geschäfts- oder Produktstrategie und/oder bestimmten Entwicklungen. Diese Publikation kann von SAP jederzeit ohne vorherige Ankündigung geändert werden.

SAP übernimmt keine Haftung für Fehler oder Auslassungen in dieser Publikation. Des Weiteren übernimmt SAP keine Garantie für die Exaktheit oder Vollständigkeit der Informationen, Texte, Grafiken, Links und sonstigen in dieser Publikation enthaltenen Elementen. Diese Publikation wird ohne jegliche Gewähr, weder ausdrücklich noch stillschweigend, bereitgestellt. Dies gilt u. a., aber nicht ausschließlich, hinsichtlich der Gewährleistung der Marktgängigkeit und der Eignung für einen bestimmten Zweck sowie für die Gewährleistung der Nichtverletzung geltenden Rechts. SAP haftet nicht für entstandene Schäden. Dies gilt u. a. und uneingeschränkt für konkrete, besondere und mittelbare Schäden oder Folgeschäden, die aus der Nutzung dieser Materialien entstehen können. Diese Einschränkung gilt nicht bei Vorsatz oder grober Fahrlässigkeit.

Die gesetzliche Haftung bei Personenschäden oder Produkthaftung bleibt unberührt. Die Informationen, auf die Sie möglicherweise über die in diesem Material enthaltenen Hotlinks zugreifen, unterliegen nicht dem Einfluss von SAP, und SAP unterstützt nicht die Nutzung von Internetseiten Dritter durch Sie und gibt keinerlei Gewährleistungen oder Zusagen über Internetseiten Dritter ab.

Alle Rechte vorbehalten.