Professional Documents
Culture Documents
40 Feature Show
Contributing Speakers
Andreas Blumenthal
SAP AG
Karsten Bohlmann
SAP AG
Boris Gebhardt
SAP AG
Christoph Stoeck
SAP AG
Agenda
Generic Programming
Checkpoints in ABAP
ABAP Debugger
Shared Objects
ABAP Unit
Simple Transformations
Memory Inspector
ABAP Unit
ABAP Developer Mr. Dummy Development request from Controlling: Please sort the flights in our flight booking system by price (ascending) so that all employees will most likely choose the cheapest flight.
SAP AG 2004, SAP TechEd / ABAP201 / 5
What is an Unit?
An unit can be considered as a non-trivial, accessible code portion (method, function or form) where a given input or action causes a verifiable effect. Ideally it is the smallest code part which can be tested in isolation.
Thank you
Checkpoints in ABAP
Checkpoints in ABAP
Task: Create utility for reversing strings
Examples:
'ABC' 'OTTO' -> 'CBA' -> 'OTTO' '12345' -> '54321'
Checkpoints in ABAP
Demo
Checkpoints in ABAP
system state
normal termination
Checkpoints in ABAP
system state
unexpected behavior
normal termination
Checkpoints in ABAP
system state
system state
unexpected behavior
normal termination
Checkpoints in ABAP
system state
system state
: assertion
normal termination
runtime error
Checkpoints in ABAP
ASSERT - Statement:
ASSERT ID SUBKEY FIELDS CONDITION group subkey dobj1 dobj2 ... log_exp.
BREAK-POINT - Statement:
BREAK-POINT ID group.
Checkpoints in ABAP
Demo
Checkpoints in ABAP
Activation method
dynamic, while system is running
Activation granularity
Logical checkpoint groups Compose variants from Checkpoint groups, variants, All checkpoints in programs, function groups, classes Extract checkpoint groups from programs, function groups, classes, packages, development components User, server
Assertion mechanism
Abort, debug or protocol
Checkpoints in ABAP
Memory Inspector
T1
T2
T3
T4
T1
Memory Inspector
Demo
In Stand-Alone TA
Analyzing memory snapshots Comparing memory snapshots
Growth of memory objects in different views
Shared Objects
Common data
DB computed and/or copied for each user session Common Data User X Session Common Data User Y Session
Shared Memory
DB
Common Data
Common data
computed once exported (copied) to shared memory imported (copied) into each user session
IMPORT
DB
Common Data
Common data
computed once written in place in shared memory accessed without copying by a read attach
User X Session
User Y Session
Instance Root
Instance Root
Attach for write Fill the contents Commit changes Attach reader1
Instance Root
Attach for write Fill the contents Commit changes Attach reader1 Attach reader2
Instance Root
Attach for write Fill the contents Commit changes Attach reader1 Attach reader2 Detach reader1
Instance Root
Attach for write Fill the contents Commit changes Attach reader1 Attach reader2 Detach reader1 Detach reader2
Instance Root
Shared Objects
Demo
Additional Features Versioning Auto-Build (e.g. at 1st read attach) Transactionality Propagation of area invalidation across AppServer instances Client dependency Displacement Customizable memory and lifetime restrictions Multi-Attach to different areas at once
Generic Programming
Problem Analysis
Selecting the Data from the database: e.g. Join of SPFLI and SCARR SELECT SPFLI~MANDT SPFLI~CARRID SCARR~CURRCODE SCARR~URL FROM SPFLI join SCARR ON SPFLI~MANDT = SCARR~MANDT AND SPFLI~CARRID = SCARR~CARRID
Problem Analysis
Selecting the Data from the database: e.g. Join of SFLIGHT and SBOOK SELECT SFLIGHT~MANDT SFLIGHT~CARRID SBOOK~BOOKID SBOOK~CUSTOMID FROM SFLIGHT join SBOOK ON SFLIGHT~MANDT = SBOOK~MANDT AND SFLIGHT~CARRID = SBOOK~CARRID AND SFLIGHT-CONNID = SBOOK-CONNID.
Dr. ABAP
Use RTTS:
struct_type ?= cl_abap_typedescr=>describe_by_name( dbtable ). components = struct_type->get_components( ).
CL_ABAP_DATADESCR CL_ABAP_DATADESCR
CL_ABAP_OBJECTDESCR CL_ABAP_OBJECTDESCR
CL_ABAP_COMPLEXDESCR CL_ABAP_COMPLEXDESCR
CL_ABAP_STRUCTDESCR CL_ABAP_STRUCTDESCR
CL_ABAP_TABLEDESCR CL_ABAP_TABLEDESCR
Perfect, but now we are lost ! For each DB table combination I need a result table ITAB with totally different components!
Dr. ABAP
CL_ABAP_DATADESCR CL_ABAP_DATADESCR
CL_ABAP_OBJECTDESCR CL_ABAP_OBJECTDESCR
method CREATE
CL_ABAP_COMPLEXDESCR CL_ABAP_COMPLEXDESCR
CL_ABAP_STRUCTDESCR CL_ABAP_STRUCTDESCR
CL_ABAP_TABLEDESCR CL_ABAP_TABLEDESCR
method CREATE
SAP AG 2004, SAP TechEd / ABAP201 / 48
method CREATE
struc
name age
o o
TYPES: BEGIN OF struc, name TYPE string, age TYPE i, END OF struc.
struc
name age
o o
TYPES: BEGIN OF struc, name TYPE string, age TYPE i, END OF struc.
CREATE DATA ... TYPE HANDLE ... ASSIGN ... CASTING TYPE HANDLE ...
Demo
Simple Transformations
XS LT
ABAP Data
in ew n 6.40
XML Doc
.. . . .. .. . . .. . .. ..
LT XS
Simple Transformations
Network
XSLT
XS LT
DB
L XS T
.. . . .. .. . . ..
HTML / Text
Both
symmetric: no generation of ABAP code / XML schemas integrated in workbench (maintenance / transport) integrated in ABAP: CALL TRANSFORMATION
Simple Transformations
Demo
Simple Transformations
Complex mappings, limited throughput
XSLT
ABAP Debugger
Premium Developer
SAP AG 2004, SAP TechEd / ABAP201 / 58
Please note that this document is subject to change and may be changed by SAP at any time without notice. The document is not intended to be binding upon SAP to any particular course of business, product strategy and/or development.
SAP AG 2004, SAP TechEd / ABAP201 / 59
Further Information
Public Web:
www.sap.com SAP Developer Network: www.sdn.sap.com Search for ABAP Knowledge Center SAP Customer Services Network: www.sap.com/services/
Further Information
Related Workshops/Lectures at SAP TechEd 2004
Shared Objects ABAP251, ABAP Shared Objects, Shared Memory Programming Made Easy, 4h Hands on Simple Transformations ABAP252, ABAP - XML Mapping, 4h Hands-on Generic Programming ABAP351, Advanced & Generic Programming in ABAP, 4h Hands-on ABAP Troubleshooting ABAP253, ABAP Troubleshooting, 4h Hands on
Questions?
Q&A
SAP AG 2004, SAP TechEd / ABAP201 / 63
Feedback
Please complete your session evaluation. Be courteous deposit your trash, and do not take the handouts for the following session.
Thank You !