t wenner abap

35
7/14/2019 t Wenner Abap http://slidepdf.com/reader/full/t-wenner-abap 1/35 ABAP Finding Appropriate Abstractions for Business Application Programming Horst Keller, SAP AG Tobias Wenner, SAP AG

Upload: fathi-ibo

Post on 19-Oct-2015

11 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/14/2019 t Wenner Abap

    1/35

    ABAPFinding Appropriate Abstractions for

    Business Application Programming

    Horst Keller, SAP AGTobias Wenner, SAP AG

  • 7/14/2019 t Wenner Abap

    2/35

    SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 2

    ABAPFinding Appropriate Abstractions for

    Business Application Programming

    Business Application Programming

    ABAP Runtime Environment

    ABAP Essential Concepts at one Glance

    ABAP Development

    ABAP Strong Points

    Conclusion

  • 7/14/2019 t Wenner Abap

    3/35

    SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 3

    ABAPFinding Appropriate Abstractions for

    Business Application Programming

    Business Application Programming

    ABAP Runtime Environment

    ABAP Essential Concepts at one Glance

    ABAP Development

    ABAP Strong Points

    Conclusion

  • 7/14/2019 t Wenner Abap

    4/35

    SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 4

    Business Application Programming Big Picture

    Data in Tables of a Central

    Relational Database

    UI

    Application Programs

    App Server 1 App Server 2

    Presentation Layer

    Application Layer

    Persistence Layer

    Application Programs

  • 7/14/2019 t Wenner Abap

    5/35

    SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 5

    Business Application Programming The ABAP Way

    Data in Tables of a Central

    Relational Database

    UI

    ABAP Programs

    Presentation Layer

    Application Layer

    Persistence Layer

    ABAP Runtime Environment

  • 7/14/2019 t Wenner Abap

    6/35

    SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 6

    ABAPFinding Appropriate Abstractions for

    Business Application Programming

    Business Application Programming

    ABAP Runtime Environment

    ABAP Essential Concepts at one Glance

    ABAP Development

    ABAP Strong Points

    Conclusion

  • 7/14/2019 t Wenner Abap

    7/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 7

    Business Application Programming

    The ABAP Runtime Environment

    ABAP Program

    SAP GUI, HTTP(S)

    Native Database Commands

    ABAP Runtime EnvironmentHardware-, operating-system-, and

    database-independent platform

    (virtual machine) that provides

    Interfaces

    Server Management (Memory,

    Process, Task Handling) Text Environment

    Locking and Transaction

    Services

    for ABAP programs.

  • 7/14/2019 t Wenner Abap

    8/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 8

    ABAP Runtime Environment Past to PresentClassical ABAP - Reporting

    R/3-System

    SAP Basis

    Report Program

    Classical Lists

    (Screen/Spool)

    _________________

    _________________

    __________________________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    _________________

    REPORTabap_intro_classic_report.

    TABLESflight_plan.

    ULINE.

    SELECT * FROM flight_plan.

    WRITE: flight_plan-carrid, |,

    flight_plan-connid, |,

    flight_plan-cityfrom, |,

    flight_plan-cityto, |.

    ULINE.

    ENDSELECT.

    ABAP

    Allgemeiner Berichts Aufbereitungs Prozessor

  • 7/14/2019 t Wenner Abap

    9/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 9

    ABAP Runtime Environment Past to PresentModern ABAP ABAP Objects

    Services

    Services

    Application

    PROGRAMmodern_abap_example.

    CLASSflight_app.

    METHOD get_flights.

    ...

    ENDMETHOD.

    METHOD book_flight.

    ...

    ENDMETHOD.

    ENDCLASS.

    ABAP

    Advanced Business Application Programming

  • 7/14/2019 t Wenner Abap

    10/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 10

    ABAPFinding Appropriate Abstractions for

    Business Application Programming

    Business Application Programming

    ABAP Runtime Environment

    ABAP Essential Concepts at one Glance

    ABAP Development

    ABAP Strong Points

    Conclusion

  • 7/14/2019 t Wenner Abap

    11/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 11

    ABAP LanguageABAP Essential Concepts at one Glance, Part 1

    CLASSget_and_display_flightsDEFINITION.

    PUBLIC SECTION.

    CLASS-METHODSmain.

    PRIVATE SECTION.

    TYPEScarrid_t TYPEint4.

    CLASS-DATAselfTYPE REF TOget_and_display_flights.

    METHODS: get_flights

    IMPORTINGcarrierTYPEcarrid_tRETURNING value(flights)TYPEsflight

    RAISINGcx_no_flights,

    display_flights

    IMPORTINGflightsTYPEflight_tab.ENDCLASS.

    Class Definition

    Static Methods

    Type declaration

    Static Attributes

    Instance Methods

    PROGRAMabap_intro_essentials.

    CLASScx_no_flightsDEFINITIONINHERITING FROM cx_static_check.

    ENDCLASS.

    Exception Class

  • 7/14/2019 t Wenner Abap

    12/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 12

    ABAP LanguageABAP Essential Concepts at one Glance, Part 2

    CLASSget_and_display_flightsIMPLEMENTATION.

    METHODmain.

    DATA: carrier TYPEsflight-carrid,

    my_flights TYPEsflight.

    CREATEOBJECT self.CALL FUNCTION'REQUEST_CARRIER'

    IMPORTING

    carrier = carrier.

    TRY.

    my_flights = self->get_flights( carrier ).

    CATCHcx_no_flights.

    MESSAGE text-nofTYPE'I'DISPLAYLIKE'E'.

    RETURN.

    ENDTRY.self->display_flights( my_flights ).

    ENDMETHOD.

    Class Implementation

    Method Implementation

    Local Data

    Object Instantiation

    Function Call

    Method Call

    Exception Handling

  • 7/14/2019 t Wenner Abap

    13/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 13

    ABAP LanguageABAP Essential Concepts at one Glance, Part 3

    METHODget_flights.

    SELECT*

    FROMsflight

    INTO TABLEflights

    WHEREcarrid = carrier.

    IFsy-subrc 0.

    RAISEEXCEPTIONTYPEcx_no_flights.

    ENDIF.

    ENDMETHOD.

    METHODdisplay_flights.

    DATA: display_tabTYPE STANDARD TABLE OFsflight,

    alvTYPE REF TOcl_salv_table,

    excTYPE REF TOcx_salv_msg.

    TRY.

    display_tab = flights.

    cl_salv_table=>factory(

    IMPORTINGr_salv_table = alv

    CHANGING t_table = display_tab ).alv->display( ).

    CATCHcx_salv_msgINTOexc.

    MESSAGEexcTYPE'I'DISPLAYLIKE'E'.

    RETURN.

    ENDTRY.

    ENDMETHOD.ENDCLASS.

    Open SQL

    Exception Raising

    Global Classes

    Method Call

    Internal Table

  • 7/14/2019 t Wenner Abap

    14/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 14

    ABAPFinding Appropriate Abstractions for

    Business Application Programming

    Business Application Programming

    ABAP Runtime Environment

    ABAP Essential Concepts at one Glance

    ABAP Development

    ABAP Strong Points

    Conclusion

  • 7/14/2019 t Wenner Abap

    15/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 15

    ABAP DevelopmentABAP Workbench

    ABAP Workbench

    Integrated Tool

    Environment for all

    Development

    Objects

    Server Side

    Development

    Change and

    Transport System

    Test Tools

  • 7/14/2019 t Wenner Abap

    16/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 16

    ABAP DevelopmentFuture: ABAP in Eclipse

  • 7/14/2019 t Wenner Abap

    17/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 17

    ABAP DevelopmentABAP Debugger

    Two Process Debugging

  • 7/14/2019 t Wenner Abap

    18/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 18

    ABAP DevelopmentABAP Language - Documentation

    Comprehensive help for more than 700 ABAP keywords

    F1

  • 7/14/2019 t Wenner Abap

    19/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 19

    ABAPFinding Appropriate Abstractions for

    Business Application Programming

    Business Application Programming

    ABAP Runtime Environment

    ABAP Essential Concepts at one Glance

    ABAP Development

    ABAP Strong Points

    Conclusion

  • 7/14/2019 t Wenner Abap

    20/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 20

    ABAP LanguageABAP Strong Points Built-in Database Access

    Open SQL Native SQL

    ADBC

    DATA: sql TYPE REF TO cl_sql_statement,stmtTYPE string

    .

    stmt = `SELECT ... `.

    sql->execute_query( stmt ).

    EXEC SQL.

    SELECT ...

    CREATE TABLE ...

    EXECUTE PROCEDURE ...

    ENDEXEC.

    SELECT...FROM ...

    INTO ...

    WHERE ...

    GROUP BY ...

    HAVING ...

    ORDER BY ...

    OPEN/FETCH/CLOSE

    CURSOR...

    INSERT...

    UPDATE...MODIFY...

    DELETE...

    DML

    Database Independent

    DML and DDL

    Platform Dependent

    DML and DDL

    Database Dependent

  • 7/14/2019 t Wenner Abap

    21/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 21

    ABAP LanguageABAP Strong Points Handling Tables

    Database Tables

    Tables on Screens____

    DATAitabTYPE TABLE OF ...

    SELECT * FROMdbtab INTO TABLEitab.

    LOOP ATitab ...

    MODIFY...

    ENDLOOP.

    UPDATE dbtabFROM TABLE itab.

    Tables in ABAP:

    Internal Tables

  • 7/14/2019 t Wenner Abap

    22/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 22

    ABAP LanguageABAP Strong Points Dictionary Reflecting DB Catalog

    ABAP Dictionary

    DBTABCOL1COL2

    COL3

    ...

    Database Tables

    Screen Painter____

    DATAscreen_fieldTYPEdbtab-col3.

    DATAitabTYPE TABLE OF dbtab.

    SELECT SINGLEcol3FROMdbtab

    INTOscreen_field

    WHEREcol1 =4711.

    SELECT * FROMdbtab INTO TABLEitab.

  • 7/14/2019 t Wenner Abap

    23/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 23

    ABAP LanguageABAP Strong Points Built-in XML-Support

    REPORTabap_intro_xml_conversion.

    DATA:BEGIN OFcarrier_wa,

    carridTYPEscarr-carrid,

    carrnameTYPEscarr-carrname,

    url TYPEscarr-url,

    END OFcarrier_wa,

    carrier_tabLIKETABLEOFcarrier_wa,

    xml_xstringTYPExstring.

    SELECT*

    FROMscarr

    INTO CORRESPONDING FIELDS OF TABLEcarrier_tab.

    CALL TRANSFORMATIONabap_intro_simple_trans

    SOURCEcarriers = carrier_tab

    RESULT XMLxml_xstring

    OPTIONSxml_header ='NO'.

    cl_abap_browser=>show_xml(

    xml_xstring = xml_xstring ).

    cl_abap_browser=>show_html(html_xstring = xml_xstring

    buttons ='X'

    check_html =' ').

    Carriers:

    IdName

    Homepage

    Simple Transformation,

    Standard XSLT is also possible

  • 7/14/2019 t Wenner Abap

    24/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 24

    ABAP LanguageABAP Strong Points Proof of Concept

    ABAP-based SAPApplications

    ABAP is the language in which most of the business

    applications of the worlds largest ERP vendor are

    developed.

    THE BEST RUN BUSINESSES RUN ABAP

  • 7/14/2019 t Wenner Abap

    25/35 SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 25

    ABAPFinding Appropriate Abstractions for

    Business Application Programming

    Business Application Programming

    ABAP Runtime Environment

    ABAP Essential Concepts at one Glance

    ABAP Development

    ABAP Strong Points

    Conclusion

  • 7/14/2019 t Wenner Abap

    26/35

    SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 26

    ConclusionABAP meets the Demands of an Ever-Changing World

    R/2 ABAP ABAP/4 Modern ABAPABAP Objects Unicode enabled

    by an Ongoing Evolution!

    ABAP

  • 7/14/2019 t Wenner Abap

    27/35

    SAP 2011 / ABAP Introduction and Overview / Horst Keller, Tobias Wenner / SAP AG / Page 27

    ABAPFinding Appropriate Abstractions for

    Business Application Programming

    THANK YOU FOR YOUR

    ATTENTION !

    QUESTIONS SUGGESTIONS DISCUSSION

  • 7/14/2019 t Wenner Abap

    28/35

    SAP 2008 / ABAP Introduction and Overview / Horst Keller / NW F ABAP / Page 28

    Backup Slides

  • 7/14/2019 t Wenner Abap

    29/35

    SAP 2008 / ABAP Introduction and Overview / Horst Keller / NW F ABAP / Page 29

    ABAP LanguageABAP Strong Points The ABAP Type Zoo, Part 1

    Types

    Data Types

    Elementary Daty Types

    Fixed Length

    Variable Length

    Objects

    Data Objects

    Elementary Data Objects

    Static Data Objects

    Dynamic Data Objects

    f

    i

    x

    Binary Floating Point Numbers

    Integers

    Byte Fields

    string

    xstring

    Character Strings

    Byte Strings

    data, any

    clike

    csequence

    numeric

    simple

    xsequence

    c

    d Date Fields

    n Numeric Text Fields

    t Time Fields

    p Packed Numbers

    Text Fields

    Generic Types

    decfloat16/34 Decimal FltPt. decfloat

    ABAP L

  • 7/14/2019 t Wenner Abap

    30/35

    SAP 2008 / ABAP Introduction and Overview / Horst Keller / NW F ABAP / Page 30

    ABAP LanguageABAP Strong Points The ABAP Type Zoo, Part 2

    Types

    Data Types

    Complex Data Types

    Structured Types

    Table Types

    Object Types

    Classes

    Interfaces

    Objects

    Data Objects

    Complex Data Objects

    Structures

    Internal Tables

    Reference Types

    Data References

    Object References

    Reference Variables

    Data Reference Variables

    Object Reference Variables

    Interface References Interface Reference Variables

    Class References Class Reference Variables

    Objects

    Index Tables

    Standard Tables

    Sorted Tables

    Hashed Tables

    Standard Tables

    Sorted Tables

    Hashed Tables

    data, any

    object

    any table

    [standard] table

    sorted table

    hashed table

    index table

  • 7/14/2019 t Wenner Abap

    31/35

    SAP 2008 / ABAP Introduction and Overview / Horst Keller / NW F ABAP / Page 31

    ABAP LanguageABAP Strong Points Internal Tables from Past to Present

    Tables of Structures

    Tables of any Type

    Tables of References

    REPORTabap_intro_reference_table.

    DATAvehicle_tabTYPE TABLE OF

    REF TOcl_abap_intro_vehicle.

    DOnTIMES.

    CREATEOBJECT vehicle.

    APPENDvehicleTOvehicle_tab.

    ENDDO.

    LOOP ATvehicle_tabINTOvehicle.

    vehicle->show_speed( ).

    ENDLOOP.

    Three kinds of internal tables:

    Standard tables

    Sorted tables

    Hashed tables

  • 7/14/2019 t Wenner Abap

    32/35

    SAP 2008 / ABAP Introduction and Overview / Horst Keller / NW F ABAP / Page 32

    ABAP LanguageABAP Strong Points Internal Tables with Secondary Keys

    REPORTdemo_secondary_keys.

    DATA: itabTYPE HASHED TABLE OFexample_data=>strucWITH UNIQUE KEYidx

    WITH NON-UNIQUE SORTED KEYk1

    COMPONENTSname postal_code.

    READ TABLEjtabINTOwa

    WITH KEYk1COMPONENTSname =...

    postal_code =... .

    Primary

    unique

    hashed key

    Secondary

    non-unique

    sorted key

    Access via

    secondary key

  • 7/14/2019 t Wenner Abap

    33/35

    SAP 2008 / ABAP Introduction and Overview / Horst Keller / NW F ABAP / Page 33

    ABAP LanguageABAP Strong Points Dynamic Programming

    REPORTabap_intro_dynamic .

    DATA: type_descr TYPE REF TOcl_abap_typedescr,

    struct_descr TYPE REF TOcl_abap_structdescr,table_descr TYPE REF TOcl_abap_tabledescr,

    components TYPEcl_abap_structdescr=>component_table,

    table_ref TYPE REF TO data.

    FIELD-SYMBOLS TYPE ANY TABLE.

    cl_abap_typedescr=>describe_by_name(

    EXPORTING p_name = dbtab

    RECEIVING p_descr_ref = type_descr ).

    components = ...

    struct_descr = cl_abap_structdescr=>create( components ).

    table_descr = cl_abap_tabledescr=>create( struct_descr ).

    CREATE DATAtable_refTYPE HANDLEtable_descr.

    ASSIGNtable_ref->*TO.

    TRY.

    SELECT(cols)

    FROM(dbtab)

    INTOCORRESPONDINGFIELDS OF TABLE

    WHERE(where).

    CATCHcx_sy_sql_errorINTOerror.

    ...

    ENDTRY.

    RTTSClasses

    Data

    Reference

    Field Symbol

    RTTI

    RTTC

    Data Object

    Instantiation

    Dynamic

    Tokens

    ABAP L

  • 7/14/2019 t Wenner Abap

    34/35

    SAP 2008 / ABAP Introduction and Overview / Horst Keller / NW F ABAP / Page 34

    ABAP LanguageABAP Strong Points Exception Handling

    CX_ROOT

    CX_NO_CHECKCX_STATIC_CHECK CX_DYNAMIC_CHECK

    CLASScx_... DEFINITION INHERITING FROMcx_..._check.

    ...

    ENDCLASS.

    DATA oref TYPE cx_...

    TRY.method( ... ).

    CATCHcx_... cx_... INTOoref.

    ...

    CLEANUP.

    ...

    ENDTRY.

    METHODS method RAISINGcx_...

    METHOD method.

    RAISEcx_...

    ENDMETHOD.

    ABAP D l t

  • 7/14/2019 t Wenner Abap

    35/35

    ABAP DevelopmentABAP Language - Keywords

    ABAP

    Not really a Language for Esthets