Quick Overview on ABAP

Embed Size (px)

Citation preview

  • 8/3/2019 Quick Overview on ABAP

    1/94

    Introduction to ABAP

    February 8, 2012

    By: Asad A. Wosaibi

  • 8/3/2019 Quick Overview on ABAP

    2/94

    ABAP is

    Advanced Business Application Programming

    Used to develop transactions, reports and other

    programs.

    All SAP is built using ABAP

  • 8/3/2019 Quick Overview on ABAP

    3/94

    SAP AG 1999

    In this course, you will develop several

    programs meant to assist travel agencies.

    Some of their typical needs include:

    Determining flight connections on specific dates Processing bookings for specific flights

    Evaluating additional flight information, such as

    Price

    Capacity

    Departure City

    Departure Airport

    Destination

    Destination City

    Main Business Scenario

  • 8/3/2019 Quick Overview on ABAP

    4/94

    SAP AG 1999

    Client / Server Architecture

    Presentation

    Server

    Layer

    Application

    Server

    Layer

    database

    Dispatcher

    Work

    Process

    SAPGUI SAPGUI SAPGUI SAPGUI SAPGUI SAPGUI

    Work

    Process

    Work

    Process

    Work

    Process

    Dispatcher

    Work

    Process

    Work

    Process

    Work

    Process

    Work

    Process

  • 8/3/2019 Quick Overview on ABAP

    5/94

    SAP AG 1999

    User-Oriented View

    Presentation

    Server

    Layer

    Application

    Server

    Layer

    Database

    Work Process

    ABAP Program

  • 8/3/2019 Quick Overview on ABAP

    6/94

    SAP AG 1999

    Program Flow: What the User Sees

    Time

    Selection Screen

    List

    Bl

    ackBox

    Screen

  • 8/3/2019 Quick Overview on ABAP

    7/94

    Screen Types

    1. Selection Screen

    2. List

    3. Dialog Screen

  • 8/3/2019 Quick Overview on ABAP

    8/94

    SelectionScreen

  • 8/3/2019 Quick Overview on ABAP

    9/94

    List (Report)

  • 8/3/2019 Quick Overview on ABAP

    10/94

    Dialog Screen

  • 8/3/2019 Quick Overview on ABAP

    11/94

    Summary

    Three-Tier Architecture

    User-Oriented client/server

    Three screen types:

    1. Selection Screen

    2. Dialog Screen

    3. List (output report)

  • 8/3/2019 Quick Overview on ABAP

    12/94

    Introductionto ABAP Workbench

    ABAP Workbench tools

    Key words in ABAP

    Transaction codes

    Dialog Messages

    Authorization objects and checks.

  • 8/3/2019 Quick Overview on ABAP

    13/94

    SAP AG 1999

    Function BuilderFunction Builder

    Screen PainterScreen Painter

    ABAP DictionaryABAP DictionaryABAP EditorABAP Editor

    Object

    Navigator

    Menu PainterMenu Painter

    ABAP Workbench Tools

    DebuggerDebugger

    Class BuilderClass Builder

    FI HR

    MM

    SD

    MM

    WM

    Cust.

  • 8/3/2019 Quick Overview on ABAP

    14/94

    Analyzing Existing Program

    SAPBC400_GETTING_STARTED

    Functionality of the program

    Objects, fields and screens used in the program.

    Debug mode

    Analyzing source code of the program

    Changing the program

  • 8/3/2019 Quick Overview on ABAP

    15/94

    SAP AG 1999

    General ABAP Syntax: Key Words

    Additions (depending on keyword) Period (ends all

    ABAP statements)

    ABAP

    key word

    START-OF-SELECTION .

    SELECT SINGLE * FROM scarr

    INTO CORRESPONDING FIELDS OF wa_scarr

    WHERE carrid = pa_car .IF sy-subrc = 0 .

    MOVE-CORRESPONDING wa_scarr TO sbc400_carrier.

    CALL SCREEN 100 .

    MOVE-CORRESPONDING sbc400_carrier TO wa_scarr.

    WRITE : wa_scarr-carrid ,

    wa_scarr-carrname ,wa_scarr-currcode .

    ENDIF.

    TABLES sbc400_carrier .

    DATA wa_scarr TYPE scarr .PARAMETERS pa_car TYPE scarr-carrid .

    STARTSTART--OFOF--SELECTIONSELECTION

    SELECTSELECT

    IFIF

    MOVEMOVE--CORRESPONDINGCORRESPONDING

    CALLCALL

    MOVEMOVE--CORRESPONDINGCORRESPONDING

    ENDIFENDIF

    TABLESTABLES

    DATADATAPARAMETERSPARAMETERS

    WRITEWRITE

    Chainedstatement

    ,

    ,.

    ..

    ..

    ....

    ..

    ..

    ..

    ..

    ..

    :

  • 8/3/2019 Quick Overview on ABAP

    16/94

    Creating TransactionCode

    Must start with Z

    Specify the program and the startup screen.

    Can be added to your favorite list in the startup menu.

  • 8/3/2019 Quick Overview on ABAP

    17/94

    SAP AG 1999

    Standard Dialogs for Messages

    Function

    Error

    occurred?

    Information passed

    to the user

    Control ofsubsequent

    program processing

    depends on the type

    of error

    Next program

    step Program aborted

    Standard Dialogs for MessagesStandard Dialogs for Messages

    Yes

    No

    Text from the

    message table

    (language-specific)

    Different message typesfor status messages,

    information,

    warnings,

    error messages,

    aborted programs

    Continue executing

    programBack to initial screenMessage

    type

  • 8/3/2019 Quick Overview on ABAP

    18/94

    SAP AG 1999

    Syntax Example: MESSAGE Statements

    READ TABLE itab INTO wa_itabWITH TABLE KEY carrid = c_ua.

    CONSTANTS c_ua TYPE s_carr_id VALUE 'UA'.

    ...

    IF sy-subrc ne 0.* Message

    MESSAGE ID 'BC400' TYPE 'I'

    NUMBER '048' WITH wa_itab-carrid.

    ELSE.

    MESSAGE ID 'BC400' TYPE 'S'NUMBER '047' WITH wa_itab-carrid wa_itab-carrname.

    ENDIF.Message class BC400

    Message:

    047: The name of the airline &1 is &2

    048: Airline &1 is not available

    BC400

    040

    041

    MESSAGE ID 'BC400' TYPE 'I'

    NUMBER '041' WITH wa_itab-carrid.

    MESSAGE ID 'BC400' TYPE 'I'

    NUMBER '040' WITH wa_itab-carrid wa_itab-carrname.

  • 8/3/2019 Quick Overview on ABAP

    19/94

    SAP AG 1999

    The Dialog Behavior of Messages: Message Types

    MESSAGE ID '' TYPE ''

    NUMBER WITH .

    TYPE ''

    Type Behavior Message appears in

    S

    I

    W

    I

    A

    X

    Program continues without

    interruption

    Program interrupted when

    dialog box is displayed

    Depends on context

    Depends on context

    Program aborted

    Runtime errorMESSAGE_TYPE_X

    Status line in next screen

    Modal dialog box

    Status line (and modal dialog

    box)

    Status line (and modal dialog

    box)

    Modal dialog box

    Integrated in short dump

    Meaning

    Status message

    Information

    Warning

    Error

    Termination

    Short dump

  • 8/3/2019 Quick Overview on ABAP

    20/94

    SAP AG 1999

    Authorization Checks in ABAP Programs

    AUTHORITY

    CHECK

    Yes

    No

    SELECT

    User Master

    Records

    BC400-00

    Profile1

    Profile2

    Profile S_CARRID

    Profile4

    Authorization for

    authorizationobject S_CARRID

    Authorization for

    authorization

    object S_CARRID

    Authorization for

    authorizationObject S_TCODE

    SY-SUBRC

    = 0

    ?

    Selection

    Screen

    Note

  • 8/3/2019 Quick Overview on ABAP

    21/94

    SAP AG 1999

    Authorization Objects and Authorizations

    'Display' Authorizationfor Object S_CARRID

    CARRID: *

    ACTVT: Display

    'Change' Authorization

    for Object S_CARRID

    CARRID: LH

    ACTVT: Change

    Object: S_CARRID

    CARRID (Airline Carrier)

    ACTVT (Activity)

    Activities:

    Create

    Change

    Display

    = 01

    = 02

    = 03

  • 8/3/2019 Quick Overview on ABAP

    22/94

    SAP AG 1999

    AUTHORITY-CHECK

    Send back

    results

    01

    02

    03

    AA AZ DL LH UA

    xxxx x

    ACTVT

    CARRID

    Set of all

    authorizationsfor object S_CARRIDAUTHORITY-CHECK

    OBJECT 'S_CARRID'

    ID 'CARRID' FIELD 'LH'ID 'ACTVT' FIELD '02'.

    Check

    xIF sy-subrc ne 0.

    * Reaktion auf fehlende

    * Berechtigung kontextabhngig

    ENDIF.

  • 8/3/2019 Quick Overview on ABAP

    23/94

    Summary

    Example program (simple screen and list)

    Overview of ABAP statements

    Creating and using Transaction Codes

    Handling errors and warnings through messages

    Describing how authority checks are implemented in

    SAP

  • 8/3/2019 Quick Overview on ABAP

    24/94

    Unit Objectives

    Closer look at

    1. Lists

    2. Selection screens

    3. Dialog Screens Interface (Toolbars, menu bars ..etc).

  • 8/3/2019 Quick Overview on ABAP

    25/94

    SAP AG 1999

    FormattedFormatted

    display:display:

    PrintPrintFormatted display:Formatted display:

    CA ID PRICE

    AA 2602 2400

    AA 2602 2500

    Total 7800

    ScreenScreen Display languageDisplay language--

    specific texts in logonspecific texts in logonlanguagelanguage

    List Attributes

    According to fixedAccording to fixed

    user settingsuser settings

    20000721

    21.07.2000

    Amounts byAmounts by

    their currencytheir currency

    Lengths byLengths by

    their unittheir unit

    DateDate

  • 8/3/2019 Quick Overview on ABAP

    26/94

    SAP AG 1999

    List header

    Column header

    Save

    :

    List

    :

    System ... Text elements

    Title/Headers

    From within a list: From the ABAP Editor:

    Column Header in the Default Page Header

  • 8/3/2019 Quick Overview on ABAP

    27/94

    SAP AG 1999

    Flight From ToFlight From To Departing atDeparting at

    LH 0400 FRA Frankfurt JFK New York 10:10:00

    LH 0402 FRA Frankfurt JFK New York 01:30:00 PM

    ...

    SQ 0002 SIN Singapore SFO San Francisco 09:30:00

    You have chosen LH 0402

    Flight date

    19.12.1998

    20.12.1998

    24.12.1998

    Max.

    380

    380

    380

    Occ.

    240

    270

    380

    Example: Detail lists

    TimetableTimetable

    Detail:Detail: FlightsFlights

  • 8/3/2019 Quick Overview on ABAP

    28/94

    SAP AG 1999

    Use of Selection Screens

    Database

    table

    ABAP

    processing

    block

    ABAP runtime system

    ABAP program

    Selection criteria

  • 8/3/2019 Quick Overview on ABAP

    29/94

    SAP AG 1999

    ValueValuesetssets

    Multilingual CapacityMultilingual Capacity

    VariantsVariants

    PossiblePossible

    entries helpentries help

    Type checksType checks

    The Selection Screen

    Input helpInput help?

  • 8/3/2019 Quick Overview on ABAP

    30/94

    SAP AG 1999

    Using the Semantic Information of DictionaryTypes

    Selection screen

    AirlineGlobal types

    Field label

    Input help

    Search help[Search help]

    Data elementData elementStructureStructure

    ABAP program

    PARAMETERS pa_carr TYPE spfli-carrid.

    Technical type

    Semantic

    information

    Layout

    information

    Formatting

    rules

  • 8/3/2019 Quick Overview on ABAP

    31/94

    SAP AG 1999

    FlexibleFlexible

    program flowprogram flow

    200

    120

    140

    100

    300

    Type checksType checks

    Consistency checksConsistency checks

    when data is enteredwhen data is entered

    PossiblePossible

    entries helpentries help

    Input helpInput help?

    Selection Screen Attributes

    FormattingFormattingoptionsoptions

  • 8/3/2019 Quick Overview on ABAP

    32/94

    SAP AG 1999

    Options for Calling Screens

    100

    200

    300

    120

    140

    Transaction code

    CALL SCREEN 100.

  • 8/3/2019 Quick Overview on ABAP

    33/94

    Whatcan you put in a screen?

    Field labels

    Data fields

    Icons and pushbuttons

    Radio buttons and checkboxes

    Tap control

    Table control

  • 8/3/2019 Quick Overview on ABAP

    34/94

    SAP AG 1999

    Overview of Screen Objects

    Flight data Edit Goto System Help

    Help F1

    Choose F2

    Back F3

    .

    .

    .

    Menu barStandard toolbar

    Application toolbar

    Key settings

    GUI title

    SET TITLEBAR .

    GUI-StatusSET PF-STATUS .

  • 8/3/2019 Quick Overview on ABAP

    35/94

    Summary :

    Strengths and attributes of:

    1. List

    2. Selection Screen

    3. Dialog Screen The use of interface (toolbars, menu barsetc)

  • 8/3/2019 Quick Overview on ABAP

    36/94

    Unit objectives

    Reuse components

    1. Function Module

    2. BAPI

    UserExits and Enhancements

    DB LUW and SAP LUW

    DB Locks

  • 8/3/2019 Quick Overview on ABAP

    37/94

    SAP AG 1999

    Techniques for Encapsulating Business Logic

    Reuse

    components

    Business

    objects

    Reuse components

    encapsulatebusiness

    logic

    ABAP:

    Technical

    possibilities

    Object

    Function

    group

  • 8/3/2019 Quick Overview on ABAP

    38/94

    SAP AG 1999

    Function Modules

    InterfaceInterface

    Import parametersImport parameters

    sy-subrc

    Function moduleFunction moduleAdministrationAdministration

    Local data objectsLocal data objects

    Source codeSource code

    GlobalGlobaldata objectsdata objects

    Function groupFunction group

    Export parametersExport parameters Changing parametersChanging parameters ExceptionsExceptions

    Interface

    Subroutine

  • 8/3/2019 Quick Overview on ABAP

    39/94

    SAP AG 1999

    Example: The CancelDialog Box

    !

    "Data will be lost."

    NoYes

  • 8/3/2019 Quick Overview on ABAP

    40/94

  • 8/3/2019 Quick Overview on ABAP

    41/94

  • 8/3/2019 Quick Overview on ABAP

    42/94

  • 8/3/2019 Quick Overview on ABAP

    43/94

    SAP AG 1999

    System Landscape

    Delivery route

    Note: Repository

    objects are

    cross-client

    DEV

    Development

    system

    QAS

    Quality assurance

    system

    PRD

    Production

    system

    SAP

    ZDEV

    SAP

    Transport routes

    Consolidation route

    for modifications to

    SAP Repository objects

    Consolidation for customer

    Repository objects

  • 8/3/2019 Quick Overview on ABAP

    44/94

    SAP AG 1999

    Projects

    Project

    Team

    Specification

    Design document

    Customer

    program

    (to create)

    Customer

    program

    (to change)

    SAP program

    (to enhance)

    Project ManagerProject Manager

  • 8/3/2019 Quick Overview on ABAP

    45/94

    SAP AG 1999

    Change Levels

    R/3 businessR/3 business

    applicationsapplications(SAP Standard)(SAP Standard)

    CustomerCustomer

    programsprograms

    CustomerCustomer

    developmentdevelopmentEnhancementEnhancementModificationModification

    Assisted

    modification

    Calling SAP

    objects

    Without calling

    SAP objects

    ABAP Dictionary

    Table enhancement

    Field exit

    Customer exit

    Function module exit

    Screen exit

    Menu exit

    Business transactionevent (BTE)

    Business Add-In

    User exit

  • 8/3/2019 Quick Overview on ABAP

    46/94

    SAP AG 1999

    How Enhancements Function

    * REPORT *

    *********************************

    REPORT .

    * Object in customer namespace *

    ******************************

  • 8/3/2019 Quick Overview on ABAP

    47/94

    SAP AG 1999

    Is a similar functionmapped in the SAP standard?

    Can the SAP

    function be adjustedto the customer's requirements

    using enhancements?

    Does the

    SAP application allow

    more functions to be

    linked with enhancements?

    No

    Yes

    Yes

    No

    Yes

    No

    Customer development

    Customizing

    Enhancement

    Request enhancement,

    Avoid modification

    Enhancing Functions

  • 8/3/2019 Quick Overview on ABAP

    48/94

    SAP AG 1999

    Menu 2

    Function 1

    Function 2

    Cust. function

    Function 3

    Menu 1 Menu 3

    Menu exitMenu exit

    Field x

    Field y

    ScreenScreen

    exitexitField exitField exit

    Enhancing User Dialogs

  • 8/3/2019 Quick Overview on ABAP

    49/94

    SAP AG 1999

    Process

    step 1

    Process

    step 2 . . .ProcessProcess

    step nstep n

    SAP LUW

    Basic

    business process

    Basic Business Process

  • 8/3/2019 Quick Overview on ABAP

    50/94

    SAP AG 1999

    Database LUW

    Consistent

    state 1

    Intermediate state

    Consistent

    state 2

    ROLLBACK

    State of data changes -insert, update, delete

    COMMIT

  • 8/3/2019 Quick Overview on ABAP

    51/94

    SAP AG 1999

    To avoid competing

    accesses to the same

    data

    Why Set Locks?

    Program CProgram C

    Tab 1

    Tab 2

    Tab 3

    Tab 4

    Tab 5

    Tab 6

    Program A

    Program B

  • 8/3/2019 Quick Overview on ABAP

    52/94

    Summary

    Function Modules and BAPI

    UserExits and Enhancements

    SAP LUW and DB LUW

    Locks

  • 8/3/2019 Quick Overview on ABAP

    53/94

    ABAP Dictionary

    Functions and services provided by ABAP Dictionary

    Objects created in ABAP Dictionary

    DB Tables

    Structure TypesDomains and Data elements

    DB Views

    f

  • 8/3/2019 Quick Overview on ABAP

    54/94

    SAP AG 1999

    Function of the ABAP Dictionary

    DB table

    Services

    Screen

    Poss. values

    Type definitions

    Structure

    Table typeData elements

    F4

    DB objects

    Table

    D t b Obj t i th ABAP Di ti

  • 8/3/2019 Quick Overview on ABAP

    55/94

    SAP AG 1999

    Database

    Database Objects in the ABAP Dictionary

    Table 1

    ABAP Dictionary

    Table 2

    View

    Objects are automatically

    created in the DB and

    adjusted to changes

    T D fi iti i th ABAP Di ti

  • 8/3/2019 Quick Overview on ABAP

    56/94

    SAP AG 1999

    Type Definitions in the ABAP Dictionary

    ZIP Town name Street House no.

    Numbers

    Employee

    Name Address Telephone

    First name Last name Town Address

    S i f th ABAP Di ti

  • 8/3/2019 Quick Overview on ABAP

    57/94

    SAP AG 1999

    Services of the ABAP Dictionary

    Carrier

    Flight number

    . . .

    Maintenance of flights

    LH

    No

    .

    Depart. city Arrival city

    Carrier

    0400 Frankfurt New York

    0402 Frankfurt New York

    LH

    2402 Frankfurt Berlin

    ... ... ...

    Code of the flight connection

    Code defining a flight connection

    between two cities, e.g. 0400

    Frankfurt - New York.

    F1

    F4

    B i Obj t f th ABAP Di ti

  • 8/3/2019 Quick Overview on ABAP

    58/94

    SAP AG 1999

    Basic Objects of the ABAP Dictionary

    uses

    uses

    Table

    Tablefield

    Data elementData element

    DomainDomain

    T L l D i C t E l

  • 8/3/2019 Quick Overview on ABAP

    59/94

    SAP AG 1999

    Two-Level Domain Concept: Example

    Table SPFLI

    MANDT

    Data element S_FROMAIRPData element S_FROMAIRP Data element S_TOAIRPData element S_TOAIRP

    Domain S_AIRPIDDomain S_AIRPID

    CARRID ... AIRPFROMCONNID ... AIRPTO

    Transparent Tables and Str ct res

  • 8/3/2019 Quick Overview on ABAP

    60/94

    SAP AG 1999

    Transparent Tables and Structures

    Table

    Field 1Field 2 Field 3Field 4

    Structure

    Field 1Field 2 Field 3Field 4

    ABAP Dictionary

    Physical definition of the table

    Table

    Field 1 Field 2 Field 3 Field 4

    Database

    Include Structures

  • 8/3/2019 Quick Overview on ABAP

    61/94

    SAP AG 1999

    Include Structures

    Table 2Table 1

    Field 1 Field 2 Field A Field B Field 4Field 3 Field A Field B

    Field A Field B

    Database

    Field 1 Field 2 Field A Field BField A Field B Field 3 Field 4

    Include structure

    Technical Settings

  • 8/3/2019 Quick Overview on ABAP

    62/94

    SAP AG 1999

    Technical Settings

    Buffering

    Table buffer

    R/3

    In which physical

    area of the database

    should the tablebe stored?

    Logging

    Should the recordsof the table be

    buffered? Should changes to

    the data records be

    logged?

    How many records

    will the table

    probably contain?

    Size category

    Data class

    Database

    Database

  • 8/3/2019 Quick Overview on ABAP

    63/94

    Database Tables

    Attributes of DB tables

    Include structure

    Pros and cons ofTable Buffering

    Data Class

  • 8/3/2019 Quick Overview on ABAP

    64/94

    SAP AG 1999

    Data Class

    Tables in the ABAP Dictionary

    Tablespace

    Org. data

    Tablespace

    Master data

    Tablespace

    Trans. data

    Tablespace

    System data

    Database

    Organizational data Transaction data System dataMaster data

    Table 1

    Table 3

    Table 4

    Table 2

    Table 6

    Table 5

    Table 9

    Table 7

    Table 8

    Table 1

    Table 3

    Table 4

    Table 2

    Table 6

    Table 5

    Table 9

    Table 7

    Table 8

    Size Category

  • 8/3/2019 Quick Overview on ABAP

    65/94

    SAP AG 1999

    Size Category

    Initial

    Extent

    First

    Extent

    Second

    Extent

    Technical Settings

    Size category

    TABA

    TABB

    TABC

    1

    3

    4

    TABATABA

    TABBTABB

    TABCTABC

    Database

    Logging

  • 8/3/2019 Quick Overview on ABAP

    66/94

    SAP AG 1999

    Logging

    Application

    transaction

    Change

    a record

    System profiles

    rec/client =ALL

    ...

    ...

    TAB

    Field 2 Field 3 Field 5

    TAB Log tableField 1 Field 2 Field 3

    Database

    ABAP Dictionary

    Log TABLog TAB

    Structure of an Index

  • 8/3/2019 Quick Overview on ABAP

    67/94

    SAP AG 1999

    Table SCOUNTER

    Index on

    AIRPORT

    MANDT CARRIDCOUNTNUM AIRPORT

    001

    001

    001

    001

    001

    001001

    001

    001

    001

    001

    001

    001001

    LH

    BA

    UA

    LH

    BA

    LHAA

    LH

    BA

    LH

    LH

    BA

    LH

    LH

    00000005

    00000004

    00000001

    00000002

    00000003

    0000000700000001

    00000003

    00000001

    00000001

    00000004

    00000002

    0000000600000008

    ACA

    ACE

    BER

    LCY

    LHR

    BERDEN

    FRA

    LCY

    LGW

    LHR

    MUC

    RTMHAM

    AIRPORT P

    ACA

    ACE

    BER

    BER

    DEN

    FRAHAM

    LCY

    LCY

    LGW

    LHR

    LHR

    MUCRTM

    1

    2

    3

    6

    7

    814

    4

    9

    10

    5

    11

    1213

    Binary

    search

    Structure of an Index

    SELECT * FROM

    SCOUNTER WHERE

    AIRPORT = 'LHR'.

    Table Buffering

  • 8/3/2019 Quick Overview on ABAP

    68/94

    SAP AG 1999

    Application server 2Application server 1

    Program reads data

    from a buffered tableRecords are loaded

    into the buffer

    TAB

    Database

    Table Buffering

    Table bufferTable buffer

    Program Program

  • 8/3/2019 Quick Overview on ABAP

    69/94

    Buffering Types

    1. Full table buffering

    2. Generic Key buffering

    3. Single record buffering

    Append Structures 1

  • 8/3/2019 Quick Overview on ABAP

    70/94

    SAP AG 1999

    Append Structures 1

    Field 1 Field 2 Field 3 Field A Field B

    Table

    Field 2 Field 3Field 1

    Append structure

    Field A Field

    B

    Append Structures 2

  • 8/3/2019 Quick Overview on ABAP

    71/94

    SAP AG 1999

    Append Structures 2

    New SAP version isimported

    Field 1 Field 2 Field 3 Field A Field B

    Append structure

    Field A Field B

    Table

    Field 2 Field 3Field 1

    Field 2 Field 3Field 1 Field 4

    Append Structures 3

  • 8/3/2019 Quick Overview on ABAP

    72/94

    SAP AG 1999

    Append Structures 3

    Append the fieldon the database

    Table

    Activate

    Field 1 Field 2 Field 3 Field A Field B Field

    4

    Append structure

    Field A Field B

    Field 2 Field 3Field 1 Field 4

    Why do you Need Views?

  • 8/3/2019 Quick Overview on ABAP

    73/94

    SAP AG 1999

    F3F2F1F4 F5

    F6 F7 F8

    Table 3Table 2

    Table 1

    View on the tables

    View on data

    that is

    distributed on

    more than onetable

    Why do you Need Views?

    F1 F2 F3 F5 F8

    Structure of a View - Starting Situation

  • 8/3/2019 Quick Overview on ABAP

    74/94

    SAP AG 1999

    TableTABA

    TableTABB

    1 1

    12

    2

    2

    Text 1 Text 3

    Text 4

    Text 5

    Text 2

    Text 6

    A

    A

    B

    B

    Field 1 Field 2 Field 3 Field 4 Field 5

    Field 1 Field 2 Field 3 Field 4 Field 5

    1 Text 1

    1 Text 1

    1 Text 11 Text 1

    2 Text 2

    2 Text 2

    2 Text 2

    2 Text 2

    1

    1

    22

    Text 3

    Text 4

    Text 5Text 6

    A

    A

    B

    B

    1

    1

    2

    2

    Text 3

    Text 4

    Text 5

    Text 6

    A

    A

    B

    B

    Cross-product of

    tables TABA and

    TABB

    Structure of a View Starting Situation

  • 8/3/2019 Quick Overview on ABAP

    75/94

    Views

    How views are defined

    Tables in views

    DB Views VS Maintenance Views

    Structure of a View - Join Condition

  • 8/3/2019 Quick Overview on ABAP

    76/94

    SAP AG 1999

    Join condition: TABA - Field 1 = TABB - Field 3

    Field 1 Field 2 Field 3 Field 4 Field 5

    1 Text 1

    1 Text 1

    1 Text 1

    1 Text 1

    2 Text 2

    2 Text 2

    2T

    ext 2

    2 Text 2

    1

    1

    2

    2

    Text 3

    Text 4

    Text 5

    Text 6

    A

    A

    B

    B

    1

    1

    22

    Text 3

    Text 4

    Text 5Text 6

    A

    A

    B

    B

    Reduction of

    the cross-

    product

    Structure of a View - Field Selection (Projection)

  • 8/3/2019 Quick Overview on ABAP

    77/94

    SAP AG 1999

    Field 1 Field 2 Field 4 Field 5

    1 Text 1

    1 Text 1

    2 Text 2

    2 Text 2

    Text 3

    Text 4

    A

    B

    Text 5

    Text 6

    A

    B

    Field 1 Field 2 Field 5

    1 Text 11 Text 1

    2 Text 2

    2 Text 2

    Text 3

    Text 4

    Text 5

    Text 6

    Projection

    ( j )

    Structure of a View - Selection Condition

  • 8/3/2019 Quick Overview on ABAP

    78/94

    SAP AG 1999

    Selection condition: TABB - Field 4 = A.

    Field 1 Field 2 Field 5

    1 Text 1

    1 Text 1

    2 Text 2

    2 Text 2

    Text 3

    Text 4

    Text 5

    Text 6

    Field 1 Field 2 Field 5

    1 Text 1

    1 Text 1

    2 Text 2

    2 Text 2

    Text 3

    Text 4

    Text 5

    Text 6

    Field 4

    A

    B

    A

    B

    How are Tables Linked to Views?

  • 8/3/2019 Quick Overview on ABAP

    79/94

    SAP AG 1999

    MANDT CARRID CONNID FLDATE BOOKID CUSTOMID ... SBOOK

    MANDT CARRID CONNID CITYFROM CITYTO SPFLI...... ...

    001

    001

    SCUSTOMMANDT ID CITYNAME ...

    122356 Smith New York001 ...

    122356

    122356

    ...

    ...

    001

    001

    New York

    TokyoBerlin

    BerlinAA

    AA

    LH

    LH

    48

    324

    324

    48

    ...

    ...

    ...

    ...

    3689

    3690

    ...

    ...

    ...

    ...

    Structure of the View

  • 8/3/2019 Quick Overview on ABAP

    80/94

    SAP AG 1999

    MANDT ID NAME CITY CARRID CONNID FLDATE BOOKID CITYFROM CITYTO

    001

    001

    122356 Smith New York AA 48 3689 New York Berlin

    122356 Smith New YorkLH

    324 3690 Berlin Tokyo

    View SCUS_BOOK for customer bookings

    4.9.1999

    9.9.1999

    Data Selection with Views

  • 8/3/2019 Quick Overview on ABAP

    81/94

    SAP AG 1999

    REPORT CUSBOOK1.

    PARAMETERS: CUSTOMID LIKE SBOOK-CUSTOMID.DATA: BOOKINGS TYPE SCUS_BOOK.

    WRITE: / Existing bookings for customer, CUSTOMID, :.

    SELECT * FROM SCUS_BOOK INTO BOOKINGSWHERE CUSTOMID = CUSTOMID.

    WRITE: / CUSTOMER, BOOKINGS-NAME, booked for,

    BOOKINGS-CARRID,BOOKINGS-CONNID, from,BOOKINGS-CITYFROM,

    to,BOOKINGS-CITYTO, on,BOOKINGS-FLDATE.

    ENDSELECT.

    IF SY-SUBRC 0.

    WRITE: / No bookings exist.

    ENDIF.

    Maintenance Views

  • 8/3/2019 Quick Overview on ABAP

    82/94

    SAP AG 1999

    F6 F7 F8

    Table 3

    F3F2F1

    Table 1Table 2

    F4 F5

    Maintenance

    view on the

    tables

    Data exchange withthe maintenance view

    Foreign key Foreign key

    F1 F2 F3 F5 F8

    Application object

    Inner and Outer Joins

  • 8/3/2019 Quick Overview on ABAP

    83/94

    SAP AG 1999

    What is displayed with the view?

    Inner join Outer join

    Table TABA Table TABB

    Join condition

    Field 1 Field 2 Field 4

    A Text 1B Text 2

    Text 3Text 4

    Field 1 Field 2 Field 4

    A Text 1B Text 2

    Text 3Text 4

    C Text 5

    A

    B

    Text 1

    Text 2

    Field 1 Field 2

    C Text 5

    A

    B

    Text 3

    Text 4

    Field 3 Field 4

  • 8/3/2019 Quick Overview on ABAP

    84/94

    Search Helps

    Attributes and services provided by Search help

    Tow types of Search helps

    Simple Search Help

    Collective Search Help Append Search Help

    R/3 Standard Function: Input Help

  • 8/3/2019 Quick Overview on ABAP

    85/94

    SAP AG 1999

    Carrier

    Flight number

    . . .

    Maintenance of flights

    LH

    No

    .

    Depart. city Arrival city

    Carrier

    0400 Frankfurt New York

    0402 Frankfurt New York

    LH

    2402 Frankfurt Berlin

    ... ... ...

    F4

    ABAP Dictionary Object Search Help

  • 8/3/2019 Quick Overview on ABAP

    86/94

    SAP AG 1999

    Search help

    Selection

    method

    Dialog behavior

    Interface

    How do you Use Search Helps?

  • 8/3/2019 Quick Overview on ABAP

    87/94

    SAP AG 1999

    Search field

    Field 1

    Input template

    Field 3

    Table/structure

    Field 1 Field 3Search field ...

    Definitions in the

    Screen Painter

    Link

    in DDIC

    Internal behavior

    Interface

    F4

    Search help

    Collective Search Helps and Elementary SearchHelps

  • 8/3/2019 Quick Overview on ABAP

    88/94

    SAP AG 1999

    Helps

    Included search helps

    Collectivesearch help

    Internal behavior

    Interface

    InterfaceInterface

    Internal behavior

    Append Search Helps

  • 8/3/2019 Quick Overview on ABAP

    89/94

    SAP AG 1999

    Included search helps

    . . .

    (customer) appendsearch help

    Included search helps

    . . .

    (SAP) collectivesearch helpappends

  • 8/3/2019 Quick Overview on ABAP

    90/94

    OtherTopics

    Data Transfer

    1. Call Transaction

    2. Batch Data Communication (BDC)

    3. CATT

    ALE

    DB Connect

    SAP Smart Forms

  • 8/3/2019 Quick Overview on ABAP

    91/94

  • 8/3/2019 Quick Overview on ABAP

    92/94

  • 8/3/2019 Quick Overview on ABAP

    93/94

  • 8/3/2019 Quick Overview on ABAP

    94/94

    Thank you