data dictionary & report

Upload: saurabhrites

Post on 07-Aug-2018

232 views

Category:

Documents


1 download

TRANSCRIPT

  • 8/19/2019 Data Dictionary & Report

    1/244

    The Data Dictionary

  • 8/19/2019 Data Dictionary & Report

    2/244

    ABAP Dictionary Concepts

    The ABAP dictionary describes the logical structure of the objects

    used in application development and shows how they are

    mapped to the underlying relational database in tables or views.

    The Data Dictionary 2

  • 8/19/2019 Data Dictionary & Report

    3/244

  • 8/19/2019 Data Dictionary & Report

    4/244

    3 Levels of the Dictionary

    • Tables or structures 

     – Composed of one or more fields

    • Data elements 

     – Each field refers to a data element  that describes themeaning of the field

    Domain  – Determines the technical properties of the field

    • Data type and size (including number of decimal places)

    • Allowed data values

    • Output characteristicsThe Data Dictionary 4

  • 8/19/2019 Data Dictionary & Report

    5/244

    Data Elements & Domains

    • Domain

     – Provides the technical description

    • Element

     – Determines the role played

    • Create a domain called id_number

    • Create elements student_id and staff_id based onthe id_number domain

    The Data Dictionary 5

  • 8/19/2019 Data Dictionary & Report

    6/244

    Data Elements & Domains

    • The domain is the central object for describing the technicalcharacteristics of an attribute of a business object. It describesthe value range of a field. This is determined by specifyingformal characteristics such as external format, length and soon.In addition specifying fixed values or a value table canrestrict the value range.

    • The data element is the semantic attribute for fields/domain. ItDefines exactly one role of a domain in a particular businesscontext for its dependent fields.It describes the technicalattributes and the meaning of the table field.It also contains thesemantic information of a field. Semantic information includesfield labels for displaying

    The Data Dictionary 6

  • 8/19/2019 Data Dictionary & Report

    7/244

    Data Elements & Domains

    The Data Dictionary 7

    z_phonef

    Label: fax number  

    z_phonew

    Label: work number  

    z_phoneh

    Label: home number  

    zphone

    type: char

    len: 12 

    phone_w

    phone_f

    phone_h 

    Customer Table Data Domain

    fields Elements

  • 8/19/2019 Data Dictionary & Report

    8/244

    Data Elemen

    Definition 

    Referential Integrity Chec

  • 8/19/2019 Data Dictionary & Report

    9/244

    Field Information

    The Data Dictionary 9

  • 8/19/2019 Data Dictionary & Report

    10/244

    Define the text to bedisplayed on screen or

    report 

    Domain Definition 

  • 8/19/2019 Data Dictionary & Report

    11/244

    Range/Value Integrity Che

  • 8/19/2019 Data Dictionary & Report

    12/244

    Tables

    • Tables are made up of rows containing one or

    more fields.

    • When a field is defined its data type is

    determined by reference to a data element. A

    data element stores a field label and online

    documentation (F1 help) but also references a

    domain.

    • A domain contains technical characteristics -

    data type/length.

    The Data Dictionary 12

    Data elements and domains are

    reusable

  • 8/19/2019 Data Dictionary & Report

    13/244

    A table definition in the Dictionary

    The Data Dictionary 13

  • 8/19/2019 Data Dictionary & Report

    14/244

    Types Of Database Tables

    •   Transparent table

    •   Pooled table•   Cluster table

    The Data Dictionary 14

  • 8/19/2019 Data Dictionary & Report

    15/244

    Pooled Table

    The Data Dictionary 15

  • 8/19/2019 Data Dictionary & Report

    16/244

    Clustered Table

    The Data Dictionary 16

  • 8/19/2019 Data Dictionary & Report

    17/244

    Viewing the Contents of a Database Table

    • From the

     – Data dictionary

    Click on the table radio button & enter the table name• From the dictionary table: table/structure: display fields

    screen choose utilities…table contents 

     – Data browser (from main menu item overview )

    Enter the table name• Choose table…table contents or press enter

     – Fill in the appropriate selection screen entries

     – Click on the execute icon on the application toolbar,

    (or press F8) The Data Dictionary 17

  • 8/19/2019 Data Dictionary & Report

    18/244

    Table Name 

    Number of Rows Selected 

    Sort Buttons 

  • 8/19/2019 Data Dictionary & Report

    19/244

    Database Views

  • 8/19/2019 Data Dictionary & Report

    20/244

    Different Types Of Views

    •  DATABASE VIEWS : are implemented with an equivalent

    view on the database.

    •  PROJECTION VIEWS : are used to hide fields of a table (only

    projection).

    •  HELP VIEWS : can be used as selection method in search

    helps.

    •  MAINTENANCE VIEWS : permit you to maintain the data

    distributed on several tables for oneapplication object at one time.

    The Data Dictionary 20

  • 8/19/2019 Data Dictionary & Report

    21/244

    Database Views

    The Data Dictionary 21

  • 8/19/2019 Data Dictionary & Report

    22/244

    Projection Views

    The Data Dictionary 22

  • 8/19/2019 Data Dictionary & Report

    23/244

    Help Views

    The Data Dictionary 23

  • 8/19/2019 Data Dictionary & Report

    24/244

    Maintenance View

    The Data Dictionary 24

  • 8/19/2019 Data Dictionary & Report

    25/244

    Search Helps & Lock Objects

    • The input help (F4 help) is a standard function of theR/3 system. The user can display the list of all possibleinput values for a screen field with the input help. Thepossible input values can be enhanced with further

    information.• The R/3 system synchronizes simultaneous access of

    several users to the same data records with a lockmechanism. When interactive transactions areprogrammed, locks are set and released by calling

    function modules. These function modules areautomatically generated from the definition of lockobjects in the ABAP dictionary.

    25

  • 8/19/2019 Data Dictionary & Report

    26/244

    Integrity Checking

    • Domain range/value integrity checks

     – Value table

    • Only values contained in the value table can beentered in fields referring to this domain

     – Fixed values

    • Only values that match a value in the user specified

    list of admissible values can be entered in fields

    referring to this domain

    The Data Dictionary 26

  • 8/19/2019 Data Dictionary & Report

    27/244

    Integrity Checking

    • Referential integrity checking

     – Check table

    • Foreign key values must match an entry in thespecified check table

    • Check tables bound to input fields on data entryscreens

    • Position the cursor on input field and press F4 toget a list of permissible values

    • The default check table for a field is the value tableof the underlying domain

    • From the “dictionary: table/structure: display fields”

    screen, select GoTo…foreign keys (F8) The Data Dictionary 27

  • 8/19/2019 Data Dictionary & Report

    28/244

    Foreign Key value must match

    Primary Key value of the check table 

    Cardinality Ratio of Foreign Key

    Scroll Throu h Other Defined Forei n Ke s

  • 8/19/2019 Data Dictionary & Report

    29/244

    ABAP Commands

    ABAP C d U d I A i i

  • 8/19/2019 Data Dictionary & Report

    30/244

    ABAP Commands Used In Assigning

    Values

     ABAP Commands 30

    ‘Write To’ Statements Move Statements

    Clear & Free

  • 8/19/2019 Data Dictionary & Report

    31/244

    Move Statements

    • MOVE f TO g. 

    • MOVE f+off1(len1) TO

    g+off2(len2). 

    • MOVE c1 TO c2 PERCENTAGE n.• Move-corresponding itab1 toitab2.

     ABAP Commands 31

  • 8/19/2019 Data Dictionary & Report

    32/244

    “Write To” Statements 

    • WRITE f TO g[+off][(len)].

    • WRITE f TO itab[+off][(len)] INDEXidx. 

     ABAP Commands 32

  • 8/19/2019 Data Dictionary & Report

    33/244

    Do’s And Don’ts 

     ABAP Commands 33

    DO’S.

     MOVE ITAB-F1 to ITAB-F2.

     MOVE ITAB-F2 to ITAB-F3.

     MOVE ITAB-F3 to ITAB-F4.

     MOVE ITAB-F4 to ITAB-F5.

    DON’TS.

     MOVE-CORRESPONDING

    ITAB1 TO ITAB2.

  • 8/19/2019 Data Dictionary & Report

    34/244

    ABAP Commands Used In String

    Operations

     ABAP Commands 34

    CondenseConcatenate Replace

    TranslateSplitShift

  • 8/19/2019 Data Dictionary & Report

    35/244

    Translate STATMENTS

    TRANSLATE c TO UPPER CASE.

    TRANSLATE c TO LOWER CASE.

    Example :

    DATA letters(3) TYPE C.

    MOVE ‘xyz' TO letters.TRANSLATE letters TO UPPER CASE.

    TRANSLATE letters TO UPPER CASE.

     ABAP Commands 35

  • 8/19/2019 Data Dictionary & Report

    36/244

    Replace Statements

    REPLACE f ...WITH g...INTO h.

    Example :

    Data field(10).

    Move ‘XYZAB' to field.

    REPLACE 'B' WITH 'string' INTO

    Field.

     ABAP Commands 36

  • 8/19/2019 Data Dictionary & Report

    37/244

    Concatenate Statements

    CONCATENATE f1 ... fn INTO g.

    Additions :

    ……….. Separated by h . Example :DATA: ONE(10) VALUE 'john',

    TWO(3) VALUE 'F.',THREE(10) VALUE 'Kennedy',

    NAME(20).Concatenate one two three into name separated by space.

     ABAP Commands 37

  • 8/19/2019 Data Dictionary & Report

    38/244

    Condense Statements

    CONDENSE c.Additions :

    …… No-gaps.

    Example :

    DATA: BEGIN OF NAME,TITLE(8) VALUE ' dr.',FIRST_NAME(10) VALUE 'Michael',SURNAME(10) VALUE 'Hofmann',

    END OF NAME.

    Condense name no-gaps.

    Output :

    Dr.MichaelHofmann

     ABAP Commands 38

  • 8/19/2019 Data Dictionary & Report

    39/244

    Split Statements

    • SPLIT f AT g INTO h1 ... hn.• SPLIT f AT g INTO TABLE itab.

     ABAP Commands 39

  • 8/19/2019 Data Dictionary & Report

    40/244

    Example Of Split Statements

    DATA : W_STRING(13 ) type c value‘JOHN.F.KENEDY’, 

    W_name1(4),

    W_name2(1),

    W_name3(6).

    Split w_string at ‘.’ into w_name1 w_name2

    w_name3.

     ABAP Commands 40

  • 8/19/2019 Data Dictionary & Report

    41/244

    Contd … 

    Types: begin of ITAB_type, word(20),end of ITAB_type.

    Data: ITAB type standard table of ITAB_type with non-unique default key initial size 5.

    SPLIT 'STOP two STOP three STOP ' AT

    'STOP' INTO TABLE ITAB.

     ABAP Commands 41

  • 8/19/2019 Data Dictionary & Report

    42/244

    Shift Statements

    • SHIFT c.

    • SHIFT c BY n PLACES.

    SHIFT c UP TO c1.• SHIFT c LEFT DELETING LEADING c1.

    • SHIFT c RIGHT DELETING TRAILING c1.

     ABAP Commands 42

  • 8/19/2019 Data Dictionary & Report

    43/244

    Example Of Shift Statements

    Additions :…… Right 

    ….Left 

    Data: alpha1(10) type c value 'ABCDEFGHIJ',alpha2 type string.

    Alpha2 = alpha1.

    Shift alpha1.Shift alpha2.

     ABAP Commands 43

  • 8/19/2019 Data Dictionary & Report

    44/244

    Contd … 

    Variants :Shift c by n places

    Example :

    Data: alpha1(10) type c value

    'ABCDEFGHIJ',alpha2 type string,five type i value 5.

    Alpha2 = alpha1.Shift alpha1 by five places.Shift alpha2 right by 2 places.

     ABAP Commands 44

  • 8/19/2019 Data Dictionary & Report

    45/244

  • 8/19/2019 Data Dictionary & Report

    46/244

    Some Other Operations

    • CO --- contains only

    • CS --- contains string

    •CA --- contains any

    • Example :

    • ‘ABCDE’ CS ‘AB’ --- true

    • ‘ABCDE’ CO ‘XY’ --- false

    • ‘ABCDE’ CA ‘E’ --- true

     ABAP Commands 46

    ABAP Commands Used In

  • 8/19/2019 Data Dictionary & Report

    47/244

    ABAP Commands Used In

    Mathematical Functions

    • Absolute values : “ABS ” 

    • Sign : “ SIGN “ 

    • Truncate : “ TRUNC ” 

     ABAP Commands 47

    ABAP Commands Used In Logical

  • 8/19/2019 Data Dictionary & Report

    48/244

    ABAP Commands Used In Logical

    Operations

     ABAP Commands 48

    EQ / “ = “ 

     NE / “ “ LT / “ < “ GT / “ > “ 

    LE / “ = “ 

  • 8/19/2019 Data Dictionary & Report

    49/244

    Useful Keywords

    Initial

    If w_var1 is initial.

    ….. 

    ENDIF.

    Space

    Data : w_var1 type c.

    If w_var1 is space.

    ….. 

    ENDIF.

     ABAP Commands 49

    ABAP C d I B h

  • 8/19/2019 Data Dictionary & Report

    50/244

    ABAP Commands In Branch

    Statements

     ABAP Commands 50

    IF VAR1 GT VAR2 .

    WRITE : ‘ TEST1’. 

    ELSE.

    WRITE : ‘ TEST2’. 

    ENDIF.

    IF VAR1 GT VAR2 .

    WRITE : ‘ TEST1’. 

    ELSEIF VAR1 EQ VAR2.

    WRITE : ‘ TEST2’. 

    ELSEIF VAR1 LE VAR2.

    WRITE : ‘ TEST3’. 

    ENDIF.

    ABAP Commands For Different

  • 8/19/2019 Data Dictionary & Report

    51/244

    ABAP Commands For Different

    Loop Conditions

    Loop on internal table

    LOOP at ITAB.

    LOOP at ITAB INTO WA_ITAB

    Loop on screen fields

    Loop at screen

     ABAP Commands 51

  • 8/19/2019 Data Dictionary & Report

    52/244

    Continue Statements

    Continue

    Effect :

    CONTINUE terminates the current loop pass, return the processing to the

    beginning of the loop and starts the next loop pass, if there is one

    Example :

    Do 100 times.

    If SY-index >= 10 and SY-index

  • 8/19/2019 Data Dictionary & Report

    53/244

  • 8/19/2019 Data Dictionary & Report

    54/244

    More Looping

     ABAP Commands 54

    DO.

     WRITE: / 'SY-INDEX – 

    Begin:', (3) SY-INDEX.

    IF SY-INDEX = 10.EXIT.ENDIF.

     WRITE: 'End:', (3) SY-

    INDEX.ENDDO.

     WHILE W_INDEX < 5 .

     W_INDEX = W_INDEX + 1.

     WRITE: W_INDEX .

    ENDWHILE.

  • 8/19/2019 Data Dictionary & Report

    55/244

    DATABASE Commands

    • Update

    • Modify

    • Delete

    • Insert

    • Select

     ABAP Commands 55

  • 8/19/2019 Data Dictionary & Report

    56/244

    Database Update Statements

    • UPDATE dbtab SET f1 ... fn.

    • UPDATE dbtab. Or

    UPDATE *dbtab. Or

    UPDATE (dbtabname) ... .

    • UPDATE dbtab FROM TABLE itab. Or

    UPDATE (dbtabname) FROM TABLE itab.

     ABAP Commands 56

  • 8/19/2019 Data Dictionary & Report

    57/244

    Database Delete Statements

    DELETE FROM dbtab WHERE cond.

    DELETE FROM (dbtabname) WHERE cond.

    DELETE dbtab.

    DELETE *dbtab.

    DELETE (dbtabname) ... .DELETE dbtab FROM TABLE itab.

    DELETE (dbtabname) FROM TABLE itab.

     ABAP Commands 57

  • 8/19/2019 Data Dictionary & Report

    58/244

    Database Insert Statements

    • INSERT INTO dbtab [CLIENT SPECIFIED] VALUES wa.

    • INSERT INTO (dbtabname) [CLIENT SPECIFIED] VALUES wa.

    • INSERT dbtab [CLIENT SPECIFIED].

    • INSERT *dbtab [CLIENT SPECIFIED].

    • INSERT (dbtabname) [CLIENT SPECIFIED] ... .

    • INSERT dbtab [CLIENT SPECIFIED] FROM TABLE itab.

    • INSERT (dbtabname) [CLIENT SPECIFIED]

    FROM TABLE itab.

     ABAP Commands 58

  • 8/19/2019 Data Dictionary & Report

    59/244

    Database Modify Statements

    • MODIFY dbtab.

    • MODIFY *dbtab.

    • MODIFY (dbtabname) ... .

    • MODIFY dbtab FROM TABLE itab.

    • MODIFY (dbtabname) FROM TABLE itab.

     ABAP Commands 59

  • 8/19/2019 Data Dictionary & Report

    60/244

    Database Select Statements

     ABAP Commands 60

    •SELECT Select Clause•[INTO Clause] FROM From Clause [WHERE Cond1]

    •[GROUP BY Fields1]

    •[HAVING Cond2]

    •[ORDER BY Fields2]. 

  • 8/19/2019 Data Dictionary & Report

    61/244

    Example Of Select Statements

    Data: WA_SBOOK type SBOOK.

    Select * from SBOOK into WA_SBOOKwhere

    CARRID = 'LH ' andCONNID = '0400' and

    FLDATE = '19950228'order by primary key.

    Write: / WA_SBOOK-BOOKID, WA_SBOOK-CUSTOMID,

    WA_SBOOK-CUSTTYPE, WA_SBOOK-smoker,WA_SBOOK-LUGGWEIGHT, WA_SBOOK-WUNIT,WA_SBOOK-invoice.

    ENDSELECT.

     ABAP Commands61

  • 8/19/2019 Data Dictionary & Report

    62/244

    Different Join Conditions

    • Inner join :

    We only get the records of the cross-

    product for which there is an entry in all

    tables used in the view.

    • Outer join :

    Records are also selected for which

    there is no entry in some of the tablesused in the view. 

     ABAP Commands 62

  • 8/19/2019 Data Dictionary & Report

    63/244

    Different Join Statements

    Select ESLL~ktext1 ESLL~MENGE ESLL~MEINS

    ESLL~NETWR

    Into table I_ESLL

    From ESLH inner join ESLH

    On ( ESLH~PACKNO = ESLL~PACKNO )

    Where ESLH~HPACKNO EQ

    Gs_XEKPO-PACKNO

    AND ESLH~DEL EQ c_space

    AND ESLL~DEL EQ c space ABAP Commands 63

  • 8/19/2019 Data Dictionary & Report

    64/244

    Contd ...

    Select ESLL~ktext1 ESLL~MENGE ESLL~MEINS

    ESLL~NETWR

    Into table i_ESLL

    From ESLH outer join ESLH

    On ( ESLH~PACKNO = ESLL~PACKNO )

    Where ESLH~HPACKNO EQ

    GS_XEKPO-PACKNO

    AND ESLH~DEL EQ c_space

    AND ESLL~DEL EQ c space ABAP Commands 64

  • 8/19/2019 Data Dictionary & Report

    65/244

    Join Conditions

     ABAP Commands 65

  • 8/19/2019 Data Dictionary & Report

    66/244

    Internal Tables

  • 8/19/2019 Data Dictionary & Report

    67/244

    Topics of the Session:

    • Concept of internal table

    • Types of internal tables

    • Declaration of internal table

    • Commands related to internal tables• Exercise

    Internal Tables 67

  • 8/19/2019 Data Dictionary & Report

    68/244

    Internal Tables

    • Database tables store long-life data

    • Internal tables store temporary data

     – Table calculations on subsets of database tables

     – Implementing complex data structures

     – Reorganize the contents of database tables

    according to specific processing needs

    • Generate ranked lists• Combine contents from more than one database table

    into a single table for easier processing

    Internal Tables 68

  • 8/19/2019 Data Dictionary & Report

    69/244

    Internal Tables

    • Used as – Snapshots of database tables

     – Containers for volatile data

    • Exist only at runtime, (unlike database tables)

    • Consist of any number of records

    • Note that it is not necessary to declare the initial

    size of the table: sap’s memory managementallows the table to be ‘infinitely’ extensible. 

    Internal Tables 69

    ABAP Internal Table

  • 8/19/2019 Data Dictionary & Report

    70/244

    ABAP Internal Table

    Types•

    Choose table type (and access method) by most frequently performedoperation

     – Standard tables

    • Access by linear table index or key

    • Response time proportional to table size

     – Sorted tables • Filled in sorted order

    • Access by linear index or sort key

    • Response time logarithmically proportional to table size

     – Hashed tables 

    • Direct access (only) by table key

    • Constant, fast response time

    Internal Tables 70

  • 8/19/2019 Data Dictionary & Report

    71/244

    Internal Table Types

    • ABAP offers standard, sorted, & hashed types of internaltables. The type of table that you should use (and hence the

    access method) is determined by the operations that will be

    performed most frequently with the table.

    • Standard tablesMost appropriate for general table operations. Accessed by

    referring to the table index (which is the quickest access

    method). Access time for standard table increases linearly

    with respect to the number of table entries. New rows areappended to the table. Individual rows are accessed by

    reading the table at a specified index value.

    Internal Tables 71

  • 8/19/2019 Data Dictionary & Report

    72/244

    Internal Table Types

    • Sorted tables

    Most appropriate where the table is to be filled in sorted order. Sorted

    tables are filled using the INSERT statement. Inserted entries are sorted

    according to a sort sequence defined by the table key. Illegal entries are

    recognized as soon as you try to insert them into the table. Response time

    is logarithmically proportional to the number of table entries (since thesystem always uses a binary search). Sorted tables are particularly useful if

    you wish to process row by row using a LOOP.

    • Hashed tables

    Most appropriate when access to rows is by a key. (Cannot access hashed

    tables via the table index)response time remains constant regardless ofthe number of rows in the table.

    Internal Tables 72

  • 8/19/2019 Data Dictionary & Report

    73/244

    Hierarchy of Internal Table Types

    Internal Tables 73

  • 8/19/2019 Data Dictionary & Report

    74/244

    When to Use Which Table Type

    Internal Tables 74

    Standard Tables

  • 8/19/2019 Data Dictionary & Report

    75/244

    Standard Tables

    (History)•

    Release 2.2 – Only standard tables with header lines

     – Table structure determined with BEGIN OF

    OCCURS … END OF . 

    • Release 3.0

     – Header lines optional

     – Introduction of type concept

    • Release 4.0

     – Introduction of sorted & hashed table types

     – Allows key definition & uniqueness attributesInternal Tables 75

    D l i I l T bl

  • 8/19/2019 Data Dictionary & Report

    76/244

    Declaring Internal Tables

    DATA: TYPE of [WITH [UNIQUE | NON-UNIQUE] ]

    [INITIAL SIZE ]

    [With header line].

      [STANDARD] TABLE | SORTED TABLE |

    Hashed table | any table

      KEY … | 

    Key table line |

    Default key Internal Tables 76

  • 8/19/2019 Data Dictionary & Report

    77/244

    Tables With Header Line

    Internal Tables 77

    Program Work Area  

    R/3 Database 

  • 8/19/2019 Data Dictionary & Report

    78/244

    Internal Tables - Header

  • 8/19/2019 Data Dictionary & Report

    79/244

    Internal Tables Header

    Lines

    • Advantages of header lines 

     – Convenient declaration

    • Table and header line structure declared in same statement

     – Ease of use

    • Don’t have to explicitly move data into the work area

    structure and then append the work area structure to the

    table – Some statements require a table with header line

    • Disadvantages of header lines 

     –

    Performance - I/O is faster for tables without headerInternal Tables 79

    l bl d

  • 8/19/2019 Data Dictionary & Report

    80/244

    Internal Tables - Header Lines

    • Default declaration is without  a header line

    • To declare a table with a header line

     – Data: itab type standard table of withheader line

    Types : Begin of GS_xtype,

    var1 type c,var2 type I,

    .

    .Internal Tables 80

    l bl fi i i S

  • 8/19/2019 Data Dictionary & Report

    81/244

    Internal Table Definition Syntax

    Internal Tables 81

    S d d T bl D l i

  • 8/19/2019 Data Dictionary & Report

    82/244

    Standard Table Declaration

    TYPES: begin of LineType,

    F1,f2,

    End of LineType.

    DATA: itab TYPE STANDARD TABLE OF

    LineType [WITH DEFAULT KEY]

    Initial size 100

    With header line.

    Internal Tables 82

    S d T bl D l i

  • 8/19/2019 Data Dictionary & Report

    83/244

    Sorted Table Declaration

    TYPES: begin of LineType,

    F1,f2,

    End of LineType.

    DATA: itab TYPE SORTED TABLE OF

    LineType WITH {NON-

    UNIQUE|UNIQUE} KEY f1

    With header line.

    Internal Tables 83

    H h d T bl D l i

  • 8/19/2019 Data Dictionary & Report

    84/244

    Hashed Table Declaration

    TYPES: begin of LineType,

    F1,f2,

    End of LineType.

    DATA: itab TYPE HASHED TABLE OF

    LineType WITH UNIQUE KEY f1

    Initial size 100

    With header line.

    Internal Tables 84

    Declaring Internal

  • 8/19/2019 Data Dictionary & Report

    85/244

    ec a g e a

    Tables• with reference to existing internal or database table type

    DATA type

    [WITH HEADER LINE]. 

    • with reference to an existing line structure

    DATA like

    [WITH HEADER LINE]. 

    Internal Tables 85

  • 8/19/2019 Data Dictionary & Report

    86/244

    Declaring Tables With a Header Line

    Data: begin of itab occurs 1,

    Field1(8),

    Field2 type i, … 

    End of itab.

    Types: begin of itab_type,

    Field1(8),

    Field2 type c, … 

    End of itab_type.

    Data: itab type standard table of

    itab_type

    With header line.

    Internal Tables 86

  • 8/19/2019 Data Dictionary & Report

    87/244

    Declaring Tables Without a Header Line

    Types: begin of itab_type,

    Field1(8),

    Field2 type c, … 

    End of itab_type.

    Data: itab1 type standard table of

    itab_type.

    Data: itab2 like itab1.

    Internal Tables 87

    Do Not Declare Internal Table This

  • 8/19/2019 Data Dictionary & Report

    88/244

    Way

    Don’t 

    Data: begin of INT_tab occurs 0,

    EMP_code type i,Name(20),

    Join_date type d,

    End of INT_tab.

    Internal Tables 88

    Accessing Internal

  • 8/19/2019 Data Dictionary & Report

    89/244

    g

    Tables

    Internal Tables 89

    •work area acts as interface for transferring data•read from table•contents of table line overwrite work area

    • program refers to work area

    •write to table•first enter data in the work area then transfer to table

    work area 

    table 

    G i K O ti

  • 8/19/2019 Data Dictionary & Report

    90/244

    Generic Key Operations

    Internal Tables 90

    Cl R f h d F C d

  • 8/19/2019 Data Dictionary & Report

    91/244

    Clear, Refresh and Free Commands

    • Clear

     – Deletes the content of the header area of internal table

     – Does not delete the content of the internal table

    • Refresh

     – Deletes the content of the internal table

     – Does not delete the content of the header area

    • Free

     – Frees the memory space allocated to the internal table

    Internal Tables 91

    Data Transfer & Internal Tables

  • 8/19/2019 Data Dictionary & Report

    92/244

    Data Transfer & Internal Tables

    • Filling line by line

     – Append, collect, insert

    Copying the contents of another table – Append, insert, move

    • Reading line by line

     – Loop, read, search

    • Determining the attributes of an internal table

     – Describe

    Internal Tables 92

    Append

  • 8/19/2019 Data Dictionary & Report

    93/244

    Append

    • Appends new line to itab

    • TO specifies the source area

    • INITIAL LINE TO appends line with

    each field set to default values

    according to field type

    To be used only with STANDARDtable

    Data: itab type standard table of

    spfli ,

    itab_wa like spfli.

    Select * into itab_wa

    From spfli.

    Append itab_wa to itab.

    endselect.

    Internal Tables 93

    APPEND [ TO | INITIAL LINE TO]

    C ll

  • 8/19/2019 Data Dictionary & Report

    94/244

    Collect

    Internal Tables 94

    COLLECT [ INTO]

    •used to fill an internal table which has unique table key (or

    standard key for standard table if no key defined):

     – standard key is combination of non-numeric key fields

    •if table entry exists with the same table key values as the

    work area or the header line of the table

     – COLLECT adds the contents of the numeric fields of the workarea to contents of the numeric fields in the existing entry

    •else

     – COLLECT is the same as APPEND

    Collect

  • 8/19/2019 Data Dictionary & Report

    95/244

    Collect

    • Often used to generate summaryinformation

    Internal Tables 95

    data: itab type standard table of sflight,

    wa like sflight.

    select * into wa from sflight.collect wa into itab.

    endselect.

    loop at itab into wa

    write wa-carrid, wa-connid, wa_fldate, wa-seatsocc.endloop.

    standard key fields 

    sflight-seatsocc

    C ll t

    Internal Tables 96

  • 8/19/2019 Data Dictionary & Report

    96/244

    Collect

    header line internal table

    abc 1 6

    def 5 4

    abc 1 7

    abc 1 6

    abc 1 6

    def 5 4

    abc 1 13 

    def 5 4

    database

    ‘abc’ ‘1’ 6 

    ‘def’ ‘5’ 4 

    ‘abc’ ‘1’ 7 

    insert 

    accumulate 

    Insert

  • 8/19/2019 Data Dictionary & Report

    97/244

    Insert

    • New line is inserted before the line which has

    index  – If the table consists of -1 lines the new line is

    inserted at the end of the table

     –

    If INSERT is used without the INDEX addition it canbe used only in a LOOP…ENDLOOP by adding the

    new line before the current line

     – NB: insertion by index is not recommended for

    SORTED table nor permissible for HASHED table Internal Tables 97

    INSERT [ INTO | INITIAL LINE INTO] [INDEX ].

    S Fi ld U d i T bl P i

  • 8/19/2019 Data Dictionary & Report

    98/244

    System Fields Used in Table Processing

    SY-TABIX – Holds the index of the current line in the table

    • SY-SUBRC

     –

    Return code for operation• SY-SUBRC = 0

     – Operation was sucessful

    • SY-SUBRC 0

     –Operation failed

    • SY-DBCNT

    • Number of lines that were affected by the operation

    • How many lines have already been processedInternal Tables 98

    Copying Contents of an Internal Table

  • 8/19/2019 Data Dictionary & Report

    99/244

    Copying Contents of an Internal Table

    • To append part or all of to

    APPEND LINES OF [FROM ] [TO

    ] TO . 

    • To insert part or all of into

    INSERT LINES OF [FROM ] [TO] INTO [INDEX ]. 

    • To copy the entire contents of into itab2>

    MOVE TO .

    NB: again, inserting by index will create problem with SORTEDtable and not permitted with HASHED table 

    Internal Tables 99

    Loop

  • 8/19/2019 Data Dictionary & Report

    100/244

    Loop

    Internal Tables 100

    •Reads line by line

    •INTO specifies the target

    area for tables without header

    line

    •FROM & TO specify begin and

    end index values (forSTANDARD and SORTED

    table only)

    data: itab type standard table of

    spfli,

    wa like itab.

    select * into table itab from spfli. 

    loop at itab into wa.write: / wa-carrid, wa-connid.

    endloop.

    LOOP AT [INTO ] [FROM ] [TO] [WHERE ].

    Branching Out From the Loop

  • 8/19/2019 Data Dictionary & Report

    101/244

    Branching Out From the Loop

    • Exit:

     – Control goes to the end of the loop.

    • Continue:

     – Control goes to the beginning of the loop.

    Internal Tables 101

    READ by INDEX

  • 8/19/2019 Data Dictionary & Report

    102/244

    READ - by INDEX

    Internal Tables 102

    •Reads the line with index

    from table

    •faster than accessing the

    table with the key value•if < 0 a runtime error

    occurs

    •INDEX valid only for

    STANDARD and SORTEDtable

    •INTO specifies the target

    area for tables without header

    line

    data: itab type standard table of

    spfli,

    wa like itab.

    select * into table itab from spfli.

    read table itab into wa index 7.

    write: / wa-carrid, wa-connid.

    READ TABLE [INTO ] INDEX .

    READ by TABLE KEY

  • 8/19/2019 Data Dictionary & Report

    103/244

    READ - by TABLE KEY

    Internal Tables 103

    •1st variation: Reads the line

    with key values matching thosein wa2

    • 2nd variation: Reads the line

    with explicit key values

    specified in

    •system reads the first entryof itab which matches the

    key value

    data: begin of rectype,

    f1 type I,f2 type I,

    end of rectype.

    data: tab type SORTED TABLE of

    rectype with unique key f1 with header

    line.Wa-f1 = 1.

    read table tab from wa.

    READ TABLE FROM [INTO ]

    READ TABLE WITH TABLE KEY [INTO]

    READ - by KEY

  • 8/19/2019 Data Dictionary & Report

    104/244

    READ - by KEY

    Internal Tables 104

    •Reads the line with key

    from table •system reads the first entry

    of itab which matches the

    key value

    •INTO specifies the target

    area for tables without headerline

    data: itab type standard table of

    spfli,wa like itab.

    select * into table itab from spfli. read table itab into wa with key carrid

    = ‘LH’ connid = ‘0400’. write: / wa-carrid, wa-connid.

    endloop.

    READ TABLE [INTO ] WITHKEY [BINARY SEARCH].

    READ -

  • 8/19/2019 Data Dictionary & Report

    105/244

    Variations

    • Defining a sequence of key fields

    WITH KEY = … =  

    • Defining the entire line as key

    WITH KEY =

    • BINARY SEARCH (useful only in conjuction with

    STANDARD table and HASHED table) 

     – Table must be sorted in the order specified in the key

    fields prior to the use of the READ statement with

    BINARY SEARCH

    Internal Tables 105

    Describe

  • 8/19/2019 Data Dictionary & Report

    106/244

    Describe

    •Allows you to find out how many lines arecontained in your internal table or how large you

    have defined the OCCURS parameter when you

    declare

    Internal Tables 106

    DESCRIBE TABLE [LINES ] [OCCURS].

  • 8/19/2019 Data Dictionary & Report

    107/244

    Changing the Contents of an Internal Table

    • Changing lines

     – Modify

     – Write to

    • Not recommended. Does not recognise the structure of

    a table line. Overwrites section of table line even across

    fields from start pos for length len 

    Deleting lines – Selected lines in a loop

     – Using the index

     – Adjacent duplicate linesInternal Tables 107

    Modify

  • 8/19/2019 Data Dictionary & Report

    108/244

    Modify

    Internal Tables 108

    •Replaces a line in with

    contents of

    •INDEX option specifies the targetline of

    •can be used only with standard

    and sorted table

    •without index, the target line isdetermined by search key

    •TRANSPORTING moves only the

    named fields from to

    data: itab type standard table of

    spfli,

    wa like itab.

    select * into table itab from spfli. wa-fldate = ‘19982201’. 

    wa-price = 1912.50.modify itab from wa index 5

    transporting fldate price.

    MODIFY [TABLE] [FROM ] [INDEX ]

    [TRANSPORTING …] [WHERE ]. 

    Delete

  • 8/19/2019 Data Dictionary & Report

    109/244

    Delete

    Internal Tables 109

    •Deletes line from itab

    •can be used only in a loop

    data: itab type standard table of

    spfli,

    wa like itab.

    select * into table itab from spfli. loop at itab into wa.

    if wa-carrid = ‘LH’. 

    delete itab.endloop.

    DELETE .

    Delete

  • 8/19/2019 Data Dictionary & Report

    110/244

    Delete

    Internal Tables 110

    •deletes line from itab with

    index

    •after deleting the line the index

    of the following lines is

    decremented by one

    •not allowed with hashed table

    data: itab type standard table of

    spfli.

    select * into table itab from spfli. delete itab index 5.

    DELETE INDEX .

    Delete

  • 8/19/2019 Data Dictionary & Report

    111/244

    Delete

    Internal Tables 111

    •deletes all adjacent duplicate

    lines from itab

    •without COMPARING

    •uses table key to determine

    duplicates

    •with COMPARING

    •uses the contents of thespecified fields in

    to determine duplicates

    data: itab type standard table of

    spfli.

    select * into table itab from spfli.

    delete adjacent duplicates from itab

    comparing carrid.

    DELETE ADJACENT DUPLICATES FROM [COMPARING ].

    Delete

  • 8/19/2019 Data Dictionary & Report

    112/244

    Delete

    Internal Tables 112

    •deletes all lines from itab

    where index is between n1 and

    n2•without FROM

    •starts from first line

    •without TO

    •deletes to end of table

    •without WHERE

    •unconditional deletion of

    lines between n1 and n2

    data: itab type standard table of

    spfli.

    select * into table itab from spfli.

    delete itab from 2 to 12 where carrid

    = ‘LH’. 

    DELETE [FROM ] [TO ] [WHERE].

    Sort

  • 8/19/2019 Data Dictionary & Report

    113/244

    Sort

    Internal Tables 113

    •without BY

    •uses table key to sort•

    •ASCENDING or

    DESCENDING

    •as TEXT•char fields sorted

    alphabetically rather than by

    internal binary

    representation

    data: itab type standard table of

    spfli.

    select * into table itab from spfli.

    sort itab by carrid connid descending.

    SORT [] [AS TEXT] [BY [][AS TEXT] ... [BY [] [AS TEXT] .

    Append…sorted By

  • 8/19/2019 Data Dictionary & Report

    114/244

    Append…sorted By 

    Internal Tables 114

    •Uses only with standard table

    • builds itab sorted by

    •descending sort order•it is less then 100 lines

    use APPEND …SORTED BY 

    •otherwise use SORT after

    table is populated

    •table can contain only the

    number of lines specified in the

    OCCURS clause

    data: itab type standard table of

    spfli ,

    itab_wa like spfli.

    select * into itab_wa from spfli.

    append itab_wa to itab sorted by

    cityfrom.

    endselect.

    APPEND [ TO] SORTED BY .

    Do’s & Don’t 

  • 8/19/2019 Data Dictionary & Report

    115/244

    • Do not use nested loop

    • Do not select data from

    database table within a loop

    • Do not use binary search

    without sorting

    • Use read within a loop

    • Select before the loop and then

    read the data or use ‘for all

    entries’ addition with the select

    statement

    • Check whether itab is initial

    before using ‘for all entries’ 

    Internal Tables 115

    Summary of Internal Table Operations

  • 8/19/2019 Data Dictionary & Report

    116/244

    y p

    Internal Tables 116

    Standard Table Sorted Table Hashed Table

    INSERT

    COLLECT

    MODIFY

    DELETE

    READLOOP

    INSERTAPPEND

    MODIFY

    DELETE

    READLOOP

    SORT

    n

     No Index

    Operations 

    works like appendinserts incorrect positionworks like append

    see above

    sort sequence

    may be broken

  • 8/19/2019 Data Dictionary & Report

    117/244

    Simple Reports

    What Is a Report

  • 8/19/2019 Data Dictionary & Report

    118/244

    p

    Executable program with a three-stage

    function:

    Data input  data processing data

    output.

    Reports: reading and processing of data

    using data from database tables,

    without actually changing it. 

    Reports 118

    Report Programming -

    O i

  • 8/19/2019 Data Dictionary & Report

    119/244

    Overview

    • Task of a report

     – Evaluate and display data from the database

    •Reports are stand alone programs

    • Reports are controlled by events

     – Program events are always triggered externally

     –React to events by• Programming the corresponding processing block

    • Ignore the event by not programming the corresponding

    blockReports 119

  • 8/19/2019 Data Dictionary & Report

    120/244

    Report Programming -

  • 8/19/2019 Data Dictionary & Report

    121/244

    Overview

    • Report processing is controlled by events

     – Processing the selection screen

    • Presenting the selection screen, validating user inputs

     – Reading the database

    • Logical database events

     – Evaluating data and creating lists

     – Outputting the list

    • Interactive list events are triggered by user mouse clicks

    • If the program contains no event keywords

     – Entire program belongs to the standard event  which is

    triggered after selection screen processingReports 121

    Purpose of Report

  • 8/19/2019 Data Dictionary & Report

    122/244

    • Reports are used by management as a tool

    to monitor the day to day activity in theorganization.

    • Basically reports are used to provide data

    to the user in a desired format.

    Reports 122

    Structure of Report

  • 8/19/2019 Data Dictionary & Report

    123/244

    • Report statement and report driven listheadings

    • Processing blocks

    • Control level statements

    • Subroutines

    • Includes

    Reports 123

    Concept of Flow Control in

  • 8/19/2019 Data Dictionary & Report

    124/244

    ABAP

    • Internal control

     – Branching (IF, CASE)

     – Looping (DO, WHILE)

    • External control – Events

    • Runtime events

    • User events

     – System does not necessarily process the statement blocks in the

    same order as they appear in the source code

    Reports 124

    Concept of Flow Control in

    ABAP

  • 8/19/2019 Data Dictionary & Report

    125/244

    ABAP

    Reports 125

    event keyword 

     processing block

    internal control 

    event keyword 

     processing blockinternal control 

    …... 

    external control 

    external control

    event begin 

    event end 

    Internal Control

    S

  • 8/19/2019 Data Dictionary & Report

    126/244

    Statements

    • If

    IF logexpr1.

    Processing1.

    ELSEIF logexpr2.

    Processing2.

    … 

    Else.

    processingN.

    ENDIF.Reports 126

    IF statements can be

    nested to any level.

    All IF statements must

     be terminated withENDIF in the same

     processing block.

    Internal Control

    St t t

  • 8/19/2019 Data Dictionary & Report

    127/244

    Statements

    • Case

    CASE f.

    WHEN f11 or f12 …or f1n. 

    Processing f1.

    WHEN f21 or f22 …or f2n. 

    Processing f2.

    When …. 

    When others.

    Processing others.

    ENDCASE.

    • F is a variable name

    • F11..fnn may be variables or

    literals

    • CASE statements can be

    nested

    • No further WHENs can follow

    WHEN OTHERS

    Reports 127

    Internal Control Statements

  • 8/19/2019 Data Dictionary & Report

    128/244

    • Iteration

     – Do … ENDDO. 

     – Loop … ENDLOOP. 

     – While … ENDWHILE. 

     – Select … ENDSELECT. 

    • Breaking out of a loop

     – Exit, stop, reject

    • Selective loop processing

     – Continue, checkReports 128

    Do ... Enddo

  • 8/19/2019 Data Dictionary & Report

    129/244

    Do ... Enddo

    • Variations

     – Do ... ENDDO.

     –DO n TIMES ... ENDDO.

    • Additions

     – VARYING f FROM f1 NEXT f2.

    • Basic form, DO...Enddo must contain a looptermination statement

     – Exit, reject, stop

    • Can process/skip current loop passReports 129

    Do ... Enddo

  • 8/19/2019 Data Dictionary & Report

    130/244

    Sum = 0.

    Do

    Sum = sum + sy-index.

    Counter = counter + 1.

    Write sum.

    If counter > 10.

    Exit.

    endif.

    Enddo.

    Sum = 0.

    Do 10 times

    Sum = sum + sy-index.

    Write sum.

    Enddo. 

    Reports 130

    Exit

  • 8/19/2019 Data Dictionary & Report

    131/244

    • Always leaves the current unit and the program

    continues after that unit

    Context sensitive – Only leaves inner structure if structures are nested

    • Can be used in

     –

    Unconditional loops (DO...Enddo) – Conditional loops (WHILE...Endwhile)

     – Subroutine (FORM...ENDFORM)

     –

    Function (FUNCTION ENDFUNCTION)Reports 131

  • 8/19/2019 Data Dictionary & Report

    132/244

    Reject

  • 8/19/2019 Data Dictionary & Report

    133/244

    j

    • Used in logical database processing• Stops processing the current database table

    line and resumes with the next line of the

    table on the same hierarchy levelIF logexp.

    Reject.

    ENDIF. 

    Reports 133

    Continue

  • 8/19/2019 Data Dictionary & Report

    134/244

    • Terminates the current loop pass and returns

    processing to the beginning of the next loop

    pass (if there is one)

     – Excludes lines where logexp is true from the list

    IF logexp.Continue.

    ENDIF. Reports 134

    Check

  • 8/19/2019 Data Dictionary & Report

    135/244

    • CHECK logexp

     – Evaluates the subsequent logical expression

     – Expression is true

    • Processing continues with the next statement

     – Expression is false

    • Terminates the current loop pass and goes back to the

    start of the next loop pass (if there is one)• Negative CHECK in a subroutine terminates the

    subroutine

    Negative CHECK not in loop or subroutineReports 135

    While … Endwhile 

  • 8/19/2019 Data Dictionary & Report

    136/244

    • Variations

     – WHILE logexp ... ENDWHILE.

    Additions – VARYING f FROM f1 NEXT f2.

    • Performs loop body statements while logexp is

    true – Pretest loop

    • Can contain other nested loop structuresReports 136

    Select … ENDSELECT 

  • 8/19/2019 Data Dictionary & Report

    137/244

    • Used for processing lines of data returned

    directly from a database table

    • Variations

    SELECT < * | field list > [target]

    FROM

    * Where … + 

    * Group by … + 

    * Order by … + 

    ENDSELECT.Reports 137

    LOOP AT … ENDLOOP 

  • 8/19/2019 Data Dictionary & Report

    138/244

    • Used for processing internal tables• Variations

     – LOOP at itab. …  Endloop.

     – LOOP at itab INTO wa. …  Endloop.

    • Additions

     – From n1

     – To n2

     – Where logexp

    Reports 138

    The ABAPProcessor

  • 8/19/2019 Data Dictionary & Report

    139/244

    Processor

    • ABAP program is a collection of processing

    blocks which are executed in response to

    specific events• Processing blocks do not have to occur in any

    specific order

     –

    At program start time the system starts a process,(the ABAP processor)

    •  Calls these modules

    • Controls the external program flowReports 139

    Events

  • 8/19/2019 Data Dictionary & Report

    140/244

    Reports 140

    INITIALIZATION 

    AT SELECTION-SCREEN OUTPUT

    START-OF-SELECTION 

    AT SELECTION-SCREEN 

    GET Events 

    Interactive Events 

    END-OF-SELECTION 

    TOP-OF-PAGE 

    END-OF-PAGE 

    AT LINE-SELECTION 

    AT USER-COMMAND 

    AT PF

    }TOP-OF-PAGE DURING

    LINE-SELECTION 

    Events & Their

    Keywords

  • 8/19/2019 Data Dictionary & Report

    141/244

    Keywords

    • Runtime events

     – Selection screen events

    Initialization• At selection-screen

     – Events after selection criteria has been

    processed

    • Start-of-selection

    • End-of-selection

    Reports 141

    Events & Their Keywords

  • 8/19/2019 Data Dictionary & Report

    142/244

    • During list processing

     – Top-of-page

     – End-of-page

    • During display of (interactive) list

     – At line-selection 

     – At user-command

     – AT pf 

    first line of new page

    last line of current page

    user double clicks on a report line

    user clicks on command button or presses

    function key 

    Reports 142

    Run-Time Events

  • 8/19/2019 Data Dictionary & Report

    143/244

    • Initialization

     – Processed before the presentation of the

    selection screen – Can be used to initialise values in the selection

    screen or to assign values to any parameters

    that appear on the selection screen

    Reports 143

    Run-Time Events

  • 8/19/2019 Data Dictionary & Report

    144/244

    • At selection-screen

     – Processing block is started after the user has

    specified all the criteria in the selection screen

     – If an error message is displayed from this

    processing block the system displays the

    selection screen again and all input fields can

    be changed

    Reports 144

  • 8/19/2019 Data Dictionary & Report

    145/244

    Run-Time Events

  • 8/19/2019 Data Dictionary & Report

    146/244

    • End-of-selection

     – Processing block executed after the system has

    read and processed all database table records

    Reports 146

    Top Of Page

  • 8/19/2019 Data Dictionary & Report

    147/244

    Under this event we can code the header of thepage which is to be printed on every page of

    the report.

    The TOP-OF-PAGE event occurs as soonas the system starts processing a new

    page of a list. The system processes the

    statements following TOP-OF-PAGEbefore outputting the first line on a new

    page

    Reports 147

    End Of Page

  • 8/19/2019 Data Dictionary & Report

    148/244

    This event occurs to define a pagefooter,if, while processing a list page,

    the system reaches the lines reserved

    for the page footer, or if the RESERVEstatement triggers a page break.

    Reports 148

    Control Level Statements

  • 8/19/2019 Data Dictionary & Report

    149/244

    1. At new  - beginning of a group of lines with the same contents in the field

    and in the fields left of  

    2. At end of  - end of a group of lines with the same contents in the field and in

    the fields left of  

    3. At first  –  first line of internal table

    4. At last  –  last line of internal table

    In a loop which processes an internal table, you can use special

    control structures for control break

    processing. All these structures begin withAT and end with Endat. The sequence of

    statements which lies between them is then

    executed if a control break occurs.Reports 149

    Control Level Statements

  • 8/19/2019 Data Dictionary & Report

    150/244

    If you have sorted an extract dataset by the fields , , ..., the

    processing of the control levels should be written between the othercontrol statements as follows: 

    Loop.

     At first.... ENDAT.

     AT NEW ....... ENDAT.

     AT NEW ....... ENDAT.

    ...

    ...

    at end of .... ENDAT.

     AT END OF .... ENDAT.

     At last..... ENDAT.

    Endloop.Reports 150

    Control Level Statements - SUM

  • 8/19/2019 Data Dictionary & Report

    151/244

    The ABAP statement SUM can be used onlywithin a loop.

    When used in an AT – ENDAT block, the

    system calculates the totals for the numericfields of all lines in the current line group and

    writes them to the corresponding fields of the

    work area.E.G.

    Loop at ITAB into line.

    At end of col1Reports 151

    Report Statement

  • 8/19/2019 Data Dictionary & Report

    152/244

    REPORT keyword is used along with the name ofthe report as the starting line of the report to

    introduce the program as a report the SAP

    system.

    • Some additions which are used with this

    statement. Are as follows -:

    NO STANDARD PAGE HEADING – this will

    suppress the page heading which is taken as a

    default heading by SAP.

    LINE-COUNT – to determine the page length ofReports 152

    Report Statement

  • 8/19/2019 Data Dictionary & Report

    153/244

    shows the length of the total reportlength.

    will reserve n no of lines as space for

    the page footer.

    LINE-SIZE – this specify the width of the

    report.MESSAGE-ID – this contains the ID where

    messages to be used are stored.Reports 153

    SELECT Overview

  • 8/19/2019 Data Dictionary & Report

    154/244

    Reports 154

    SELECT

    FROM

    INTO

    GROUP BY

    which columns?

    which table?

    where to?

    which entries?

    how are they grouped?

    how are they arranged?

    WHERE

    ORDER BY

  • 8/19/2019 Data Dictionary & Report

    155/244

    SELECT Clause

  • 8/19/2019 Data Dictionary & Report

    156/244

    Select *

    SELECT ...

    Reports 156

    • SELECT *

    • returns all columns of the database table

    • SELECT ...

    • can be either fields or aggregate functions• MIN, MAX, AVG, SUM, COUNT

    • NB. No commas between fields in f ield list  

    SELECT INTO ...

  • 8/19/2019 Data Dictionary & Report

    157/244

    •  – fields placed left to right into components of  

    • (, , ... ) – fields placed left to right into fields ...  

    TABLE  – selected data not processed line by line but all at once 

    • CORRESPONDING FIELDS OF  – fields placed into fields in which have the corresponding name 

    • CORRESPONDING FIELDS OF TABLE  – as above except selected data is placed in all at once 

    Reports 157

    WHERE

  • 8/19/2019 Data Dictionary & Report

    158/244

    • BETWEEN AND

    • LIKE

    • CONTAINS

    • IN ( , ... )

    IN

    Reports 158

  • 8/19/2019 Data Dictionary & Report

    159/244

    Reports 159

    EQ

    GELE

     NE

    GT

    LT

    =

    >=

    =<

    ><

    >

  • 8/19/2019 Data Dictionary & Report

    160/244

    GROUP BY ...

  • 8/19/2019 Data Dictionary & Report

    161/244

    • combines groups of entries into single entries• a group consists of entries that have identical

    ...

    • SELECT list – must contain ...

     – fields other than ... must be aggregate

    functions , eg. SUM( LUGGWEIGHT )

    Reports 161

    ORDER BY

  • 8/19/2019 Data Dictionary & Report

    162/244

    • determines sort order of selected result table• ...ORDER BY PRIMARY KEY

     – sorts entries by primary key of the database table• ...ORDER BY [ASCENDING | DESCENDING]

    [ASCENDING | DESCENDING] ...

     – default sort order is ascending

    Select Carrid Connid CityFrom Cityto

    From SPFLI

    Order by Carrid Connid CityTo Descending. Reports 162

    Message & Message Class

  • 8/19/2019 Data Dictionary & Report

    163/244

    • Messages are grouped together into anobject called message class where

    individual messages are identified by an

    unique number.• Transaction code : SE91

    Reports 163

    Different Message Types

     A Termination The message appears in a dialog box, and the program terminates. When theh fi d th t l t t th t hi h t

  • 8/19/2019 Data Dictionary & Report

    164/244

    Reports 164

    user has confirmed the message, control returns to the next-highest area menu. 

    E ErrorDepending on the program context, an error dialog appears or the program

    terminates. 

    I Information The message appears in a dialog box. Once the user has confirmed themessage, the program continues immediately after  the MESSAGE statement. 

    S Status The program continues normally after the MESSAGE statement, and themessage is displayed in the status bar of the next screen. 

    W Warning Depending on the program context, an error dialog appears or the programterminates. 

    X Exit No message is displayed, and the program terminates with a short dump.Message type X allows you to force a program termination.

    Messages in Reports

  • 8/19/2019 Data Dictionary & Report

    165/244

    • messages are stored in table T100

    • REPORT MESSAGE-ID xx. 

     – xx represents an application area

    Reports 165

    Messages in Reports

  • 8/19/2019 Data Dictionary & Report

    166/244

    MESSAGE xnnn. – x is one of Displayed Outcome

    • I Info window resumes processing

    • W Warning status line terminates current

    list level• E Error status line terminates current

    list level

    • A Abend window termination aftermessage

    • X Exit status line immediatetermination

    • S Success status line resumes processing

     – nnn is the message numberReports 166

    Messages in Reports

  • 8/19/2019 Data Dictionary & Report

    167/244

    MESSAGE xnnn *WITH …+. 

    Reports 167

    & characters serve as placeholders in a message

    200 Level &1 not allowed here

    WITH option allows contents of fields < f i > to replace the &i

    according to the value of I

    MESSAGE E200 WITH SY-LSIND.

    Messages in Reports

  • 8/19/2019 Data Dictionary & Report

    168/244

    MESSAGE ID TYPE

    NUMBER *WITH … +. 

    Reports 168

    allows a message to be specified dynamically at runtime

    do not need the MESSAGE-ID xx option in the REPORT

    statement

    is the message application area

    is the message type (I, W, E, A, X, S)

    is the message number

    Write Statements

  • 8/19/2019 Data Dictionary & Report

    169/244

    Reports 169

    •Write : / Var1 As Checkbox.

    •Write : / Var2 As Symbol.

    Write : / Var3 As Icon.•Write : / Var4 As Line.

    Several Options In Write

    Statements

  • 8/19/2019 Data Dictionary & Report

    170/244

    • NO-ZERO

    • NO-SIGN

    • DD/MM/YY

    • LEFT-JUSTIFIED

    • RIGHT-JUSTIFIED

    • CENTERED

    • USING EDIT MASK mask

    • USING NO EDIT MASK• DECIMALS d

    Reports 170

    Several Options In WriteStatements

  • 8/19/2019 Data Dictionary & Report

    171/244

    • No-gap

    • No grouping

    • CURRENCY w

    • EXPONENT e

    • ROUND r Reports 171

    Formatting of Report

  • 8/19/2019 Data Dictionary & Report

    172/244

    •Report can be printed using variousstatements like -:

    Write

     Write:[/][][()] E.G.

     WRITE: 'one',

    / ' ',/ 'two'. 

    Reports 172

    Output Format of Predefined Types

  • 8/19/2019 Data Dictionary & Report

    173/244

    Reports 173

    c field length left-justified 

    n field length left-justified 

    i 11 right-justified 

    f 22 right-justified 

    p 2*fieldlength (+1) right-justified 

    d 8 left-justified 

    t 6 left-justified 

    x 2*field length left-justified 

    Positioning Output

  • 8/19/2019 Data Dictionary & Report

    174/244

    WRITE AT [/] [pos] [(len)] . 

    • ‘/’ Denotes new line 

     –Horizontal position

     – Always output at that position regardless of whether there is

    enough space or other fields overwritten

    • ()

     – Output length

     – If is too short

    • Numeric fields truncated (left), asterisk displayed

    • All others truncated (right) with no indication

    Reports 174

    Some Examples of Pos (Len)

  • 8/19/2019 Data Dictionary & Report

    175/244

    data: word(16) value '0123456789ABCDEF',

    col type i value 5,

    len type i value 10.

    write /5(12) word. 0123456789AB 

    write at col(len) word. 0123456789 

    write /(3) 12345. *45 

    write: /5(8) word, 25(2)word. 01234567 01 

    Reports 175

    Formatting Options – All Data

    Types

  • 8/19/2019 Data Dictionary & Report

    176/244

    yp

    WRITE .... 

    Reports 176

    • LEFT-JUSTIFIED Output is left justified

    • RIGHT-JUSTIFIED Output is right justified

    • CENTERED Output is centered

    • UNDER Output starts under field

    •  NO-GAP Blank after field is omitted

    • USING EDIT MASK Specifies a format template

    • USING NO EDIT MASK Deactivates a template

    •  NO-ZERO All zero field replaced by blanks

    • COLOR Color of output specified by

    Formatting Options - Examples

  • 8/19/2019 Data Dictionary & Report

    177/244

    data c(10) value ‘text’. 

    write: / ‘Left Just :’, c left-justified. Left Just : text 

    write: / ‘Right Just:’, c right-justified. Right Just: text write: / ‘Centered :’, c centered.  Centered : text 

    write: / ‘aaa ‘, ‘bbb ‘, ‘ccc ‘, ‘ddd’.  aaa bbb ccc ddd 

    write: / c under ‘bbb ‘  text 

    write: / c using edit mask ‘_:_%_8_!’.  t:e%x8t! 

    Reports 177

    Formatting Options - NumericFields

  • 8/19/2019 Data Dictionary & Report

    178/244

    Reports 178

    •  NO-SIGN Leading sign is not output

    • DECIMALS Output has digits after decimal

    • EXPONENT Type f fields exponent defined in

    • ROUND Type p fields are divided by 10**(r)

    and then rounded

    • CURRENCY According to definition of in table

    TCURX

    • UNIT Number of decimal places is fixed

    according to the definition of in

    table T006 for type p fields

    Formatting Options - Date Fields

  • 8/19/2019 Data Dictionary & Report

    179/244

    Reports 179

    WRITE  

    • DD/MM/YY

    • MM/DD/YY• DD/MM/YYYY

    • MM/DD/YYYY

    • DDMMYY

    • MMDDYY• YYMMDD

    Formatting Options - Examples

  • 8/19/2019 Data Dictionary & Report

    180/244

    Data X type p value ‘-12345.678’, 

    F type f value ‘-12345.678’, 

    D type d value ‘19980323’. 

    Write: / X decimals 2. 12,346.000- 

    Write: / F decimals 2. -1.235e+04 Write: / X exponent 2. 12,346- 

    Write: / F exponent 2. -123.4567800000000e+02 

    Write: / D DD/MM/YY 23/03/99 

    Reports 180

    Format

  • 8/19/2019 Data Dictionary & Report

    181/244

    • formatting options used in a WRITE statement overwrite the

    corresponding settings of a previously issued FORMAT

    statement for the current output

    • for each new event the system resets all formatting options to

    their default values

     – all options have a default value of OFF except the

    INTENSIFIED option

    • FORMAT RESET 

     – sets all formatting options to OFF in one go

    Reports 181

    COLOURS IN LISTS

  • 8/19/2019 Data Dictionary & Report

    182/244

    FORMAT COLOR =

    INTENSIFIED =

    INVERSE = • COLOR sets colour of line background

    • INVERSE influences the foreground colour

     – INVERSE ON sets the foreground to the selected COLOR option

    • INTENSIFIED determines the colour palette for the line background

    Reports 182

    LIST COLOUR OPTIONS

    Colour Intended For 

  • 8/19/2019 Data Dictionary & Report

    183/244

    Reports 183

    OFF or COL_BACKGROUND 0 depends on GUI background 

    1 or COL_HEADING 1 grey-blue headings 

    2 or COL_NORMAL 2 light grey list bodies 

    3 or COL_TOTAL 3 yellow totals 

    4 or COL_KEY 4 blue-green key columns 

    5 or COL_POSITIVE 5 green pos threshold value 

    6 or COL_NEGATIVE 6 red neg threshold value 

    7 or COL_GROUP 7 violet group levels 

    Color Examples

  • 8/19/2019 Data Dictionary & Report

    184/244

    Data: I type i value 0, col(15).

    While I < 8.

    Case I.When 0. Col = ‘COL_BACKGROUND’. 

    When 1. Col = ‘COL_HEADING.

    When ...endcase.

    Format intensified color = I.Reports 184

    Output of Color: Example

  • 8/19/2019 Data Dictionary & Report

    185/244

    Reports 185

    On Screen Lines & BlankLines

  • 8/19/2019 Data Dictionary & Report

    186/244

    • Horizontal Lines

    LINE [AT [/] [] [(len)] ]. 

    WRITE [AT [/] [] [(len)] ] SY-ULINE.• Vertical Lines

    WRITE [AT [/] [] ] SY-VLINE. 

    WRITE *AT */+ *+ + ‘|’. • Blank Lines

    SKIP []

    SKIP TO LINE < >

    Reports 186

    Creating Blank LinesSET BLANK LINES [ON | OFF]

  • 8/19/2019 Data Dictionary & Report

    187/244

    SET BLANK LINES [ON | OFF] 

     – OFF

    • system suppresses blank lines created by WRITE

    SKIP [] 

     – if greater than lines remaining on page

    produces page footer, throws to new page – at the beginning of a new page

    • ignored except if page created by NEW-PAGE or if page is the

    first of a list level

     – last output statement of last list page

    • ignored

    Reports 187

    Formatting Options - RESERVE 

  • 8/19/2019 Data Dictionary & Report

    188/244

    RESERVE statement triggers a page break ifless than free lines are left on the current

    list page between the last output and the

    page footer.

    Before starting a new page, the system

    processes the END-OF-PAGE event.

    RESERVE only takes effect if output is

    written to the subsequent page (the system

    will not generate an empty page).

    Reports 188

    System Fields for Lists

  • 8/19/2019 Data Dictionary & Report

    189/244

    • SY-PAGNO 

     – Number of current page of current list

    • SY-LINNI 

     – Number of current line of current list

    • SY-COLNO 

     – Number of column where cursor is positioned

    in the current list

    Reports 189

    System Fields for Lists

  • 8/19/2019 Data Dictionary & Report

    190/244

    • SY-title 

     – Title that appears in the title bar of the display window

     – Can be manipulated by

    Maintaining text elements• Using SET TITLEBAR .

    • SY-SROWS 

     – Current number of lines in display window

    • SY-SCOLS  – Current number of columns in display window

    Reports 190

  • 8/19/2019 Data Dictionary & Report

    191/244

    Selection Screens

    Objective

  • 8/19/2019 Data Dictionary & Report

    192/244

    • Concepts associated with • The creation and use of selection screens in ABAP

    reports• The SELECT-OPTIONS statement

    • Selection tables• Formatting the selection screen

    • Selection texts, lines, comments, frames,

    • The PARAMETERS statement• Radio button groups, checkboxes

    • Executing reports with variants

    Selection Screen 192

    Selection Screens

  • 8/19/2019 Data Dictionary & Report

    193/244

    Used to allow the user to control the databaseselections of the report

    • Allows interactive

     –

    Assignment of values to variables• With the PARAMETERS statement

     – Determine selection criteria for database fields

    •  Single values, range of values, sets of values, ...

    • With the SELECT-OPTIONS statement

    Selection Screen 193

    Defining Selection Screen

  • 8/19/2019 Data Dictionary & Report

    194/244

    3 ABAP statements for defining selectionscreens

    •PARAMETERS for single fields

    • SELECT-OPTIONS for complex selections

    • SELECTION-SCREEN for formatting the

    selection screen and defining user-specificSelection Screen 194

    Parameters

  • 8/19/2019 Data Dictionary & Report

    195/244

    Used to enable user to enter values for singlefields on the selection screen

    • Define variables in the program using

    PARAMETERS statement.

    • Basic form of PARAMETERS statement:

    • PARAMETERS

    [()] [TYPE|like ] [DECIMALS ].

    Selection Screen 195

    Parameters Variants

  • 8/19/2019 Data Dictionary & Report

    196/244

    PARAMETERS

    ...... DEFAULT ......

    • PARAMETERS

    ...... OBLIGATORY ......

    • PARAMETERS

    ...... LOWER CASE ......

    • PARAMETERS

    ...... AS CHECKBOX ......

    • PARAMETERS

    ...... RADIOBUTTON GROUP

    ......Selection Screen 196

    The Parameters Keyword

  • 8/19/2019 Data Dictionary & Report

    197/244

    Selection Screen 197

    PARAMETERS: P1 TYPE P,

    P2(6) TYPE C DEFAULT ‘ITB255’. 

    PARAMETERS TYPE [DEFAULT ]. 

    P1 P2  ITB255 

    Selection Screen 

    Select-options

  • 8/19/2019 Data Dictionary & Report

    198/244

    Allow the user to easily handle complexselections

    •Basic form of the SELECT-OPTIONS statement :

    • SELECT-OPTIONS for .

    • is a column of a database table or aninternal field in the program.

    Selection Screen 198

    Select-options Contd..

  • 8/19/2019 Data Dictionary & Report

    199/244

    Structure of selection tablesSIGN – type C length 1

    Values ‘I’ or ‘E’ 

    OPTION – type c length 2Values ‘EQ’, ‘NE’, ‘LT’, ‘BT’, etc. 

    LOW – data type same as of

    HIGH – data type same as of

    Selection Screen 199

    Select-options Variants

  • 8/19/2019 Data Dictionary & Report

    200/244

    SELECT-OPTIONS FOR DEFAULT [TO ] ....

    • SELECT-OPTIONS FOR ...

    LOWERCASE ..............• SELECT-OPTIONS FOR ...

    OBLIGATORY ..............

    SELECT-OPTIONS FOR ..... NO-EXTENSION .....

    • SELECT-OPTIONS FOR ..... NO

    INTERVALS

    Selection Screen 200

    REPORT ZSAPTEST.

    TABLES: SFLIGHT.

    SELECT-OPTIONS: AIRLINE FOR SFLIGHT-CARRID,

  • 8/19/2019 Data Dictionary & Report

    201/244

    Selection Screen 201

    ,

    CONN FOR SFLIGHT-CONNID. 

    multiple selection screen 

    Selection-screen

  • 8/19/2019 Data Dictionary & Report

    202/244

    SELECTION-SCREEN SKIP [].

    SELECTION-SCREEN ULINE [[/]]

    SELECTION-SCREEN COMMENT [/]

    [FOR FIELD ]

    Selection Screen 202

    Selection-screen – Elements on aSingle Line

  • 8/19/2019 Data Dictionary & Report

    203/244

    Several Elements in a Single lineSELECTION-SCREEN BEGIN OF LINE.

    ...

    SELECTION-SCREEN END OF LINE.

    SELECTION-SCREEN POSITION .

    E.g.

    SELECTION-SCREEN BEGIN OF LINE.Selection Screen 203

    Selection-screen – Blocks ofElements

  • 8/19/2019 Data Dictionary & Report

    204/244

    Create logical block of elements on selectionscreen

    SELECTION-SCREEN BEGIN OF BLOCK

    [WITH FRAME [TITLE ]][NO INTERVALS].

    ...

    Selection-screen end of block .

    E.G.

    Selection-screen begin of block rad1

    with frame title text-002.Selection Screen 204

    Calling Selection-screen

  • 8/19/2019 Data Dictionary & Report

    205/244

    Standard selection screen –   Called automatically between the INITIALIZATION

    and START-OF-SELECTION events.

    • User-defined selection screen

     –   CALL SELECTION-SCREEN [STARTING AT

    ]

    [ENDING AT ].

    Selection Screen 205

    Modifying Screens Dynamically

    Th t bl

  • 8/19/2019 Data Dictionary & Report

    206/244

    • The screen table

     – Screen is like an internal table with header line

     – Do not need to declare it in your program

     – Cannot use any work area other than its header line to

    address it• Some components of screen table

     – Name

     – Input

     – Output

     – Required

     – Intensified

     – Invisible Selection Screen 206

    Loop at Screen

  • 8/19/2019 Data Dictionary & Report

    207/244

    You can modify screen in your ABAP program• The only statements that can be used with

    SCREEN are

    •  Loop at screen....

    Modify screen.

    ...

    Endloop.

    • No further additions are allowed in the LOOP

    AT SCREEN statementSelection Screen 207

    Loop at Screen Contd..

  • 8/19/2019 Data Dictionary & Report

    208/244

    E.G.Loop at screen.

    IF screen-group1 = 'MOD'.

    IF flag = ' '.Screen-input = '0'.

    ELSEIF flag = 'X'.

    Screen-input = '1'.

    ENDIF.

    Modify screen. Selection Screen 208

    Selection Screen Events

  • 8/19/2019 Data Dictionary & Report

    209/244

    At selection-screen• At selection-screen output

    • At selection-screen on

    • At selection-screen on block• At selection-screen on help-request

    • At selection-screen on RADIOBUTTON

    • At selection-screen on value-request

    Selection Screen 209

    At Selection-screen

  • 8/19/2019 Data Dictionary & Report

    210/244

    Basic form of a series of events

    • These events are called between

    INITIALIZATION and START-OF-SELECTION.

    • Defined to change selection screen or process

    user input, i.E. Validations, etc.

    Selection Screen 210

    Contd..

    At selection-screen output

  • 8/19/2019 Data Dictionary & Report

    211/244

    At selection screen output

    Allows you to modify selection-screen directly before it is displayed.E.G.

    Parameters: test1(10),test2(10),test3(10),test4(10).

    At selection-screen output.

    Loop at screen.If screen-name = ‘test1'. Screen-intensified = '1'.Modify screen.Continue.

    ENDIF.If screen-name = ‘test3'. 

    Screen-input = '0'.Modify screen.

    ENDIF.Endloop. Selection Screen 211

    Contd..

  • 8/19/2019 Data Dictionary & Report

    212/244

    AT SELECTION-SCREEN ON Is triggered when the contents of the field are

    passed from the selection screen to the ABAP

    program.E.G.

    At selection-screen on test1.

    IF TEST1 = ‘not OK’. Message e001.

    ENDIF.Selection Screen 212

    Contd..

    AT SELECTION-SCREEN ON BLOCK

  • 8/19/2019 Data Dictionary & Report

    213/244

    AT SELECTION SCREEN ON BLOCK block

    Is triggered when the contents of all of the fields in a block are passed from theselection screen to the ABAP program

    E.G.

    Selection-screen begin of block part1 with frame.Parameters: number1 type i,

    number2 type i,

    number3 type i.Selection-screen end of block part1.

    At selection-screen on block part1.

    If number3 LT number2 ornumber3 LT number1 or

    number2 LT number1.Message e020.

    ENDIF.

    Selection Screen 213

    Contd..

  • 8/19/2019 Data Dictionary & Report

    214/244

    AT SELECTION-SCREEN ON HELP-REQUEST FOR Is triggered when the user calls the F1 help for the

    field .

    E.G.

    At selection-screen on help-request for p_CARR_2.

    Call screen 100 starting at 10 5

    ending at 60 10.

    Selection Screen 214

    Contd..

    AT SELECTION SCREEN ON RADIOBUTTON GROUP

  • 8/19/2019 Data Dictionary & Report

    215/244

    AT SELECTION-SCREEN ON RADIOBUTTON GROUP

    Is triggered when the contents of all of the fields in a radio

    button group are passed from the selection screen to the

    ABAP program

    E.G.

    At selection-screen on RADIOBUTTON group rad1.

    If r1 = 'x'.

    Message w040.

    ENDIF.

    Selection Screen 215

    Contd..

  • 8/19/2019 Data Dictionary & Report

    216/244

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR Is triggered when the user calls the F4 help for the

    field

    E.G.

    At selection-screen on value-request for p_CARR_2.

    Call screen 100 starting at 10 5

    ending at 50 10.

    Module value_list output.

    Selection Screen 216

    is an internal table with 4 fields

  • 8/19/2019 Data Dictionary & Report

    217/244

    Selection Screen 217

    SIGN OPTION LOW HIGH 

    I EQ

    E NELT

    GT

    LE

    GE

    BTNB

    CP

    NP 

    and Database Selections

  • 8/19/2019 Data Dictionary & Report

    218/244

    • If the contains more than one line

     – form the union of sets defined on the lines that

    have SIGN = I

     – subtract the union of sets defines on the lines thathave SIGN = E

     – select the resulting set

    • If contains only lines with SIGN = E – select all data outside the set specified in these

    lines Selection Screen 218

    Assigning Default Values to Selection Criteria

  • 8/19/2019 Data Dictionary & Report

    219/244

    SELECT-OPTIONS FOR DEFAULT [TO ]

    OPTION SIGN . 

    Selection Screen 219

    and may beliterals (enclosed in single quotes)names of fields whose contents should be used as defaultvalues

    may be one of

    EQ,NE,GE,LE,GT,LT,CP,NP for single selectionsBT,NB for interval selections

    may be either I or E

    REPORT ZSAPTEST.

    TABLES: SFLIGHT.

    SELECT-OPTIONS: AIRLINE FOR SFLIGHT-CARRID

  • 8/19/2019 Data Dictionary & Report

    220/244

    Selection Screen 220

    DEFAULT ‘AA’ TO ‘LH’ OPTION NB

    SIGN I. 

    Assigning Default Values to Selection Criteria

  • 8/19/2019 Data Dictionary & Report

    221/244

    Selection Screen 221

    REPORT ZSAPTEST.TABLES: SPFLI, SFLIGHT, SBOOK.SELECT-OPTIONS:AIRLINE FOR SPFLI-CARRID,

    CONN FOR SPFLI-CONNID.INITIALIZATION. MOVE ‘LH’ TO AIRLINE-LOW.

    MOVE ‘UA’ TO AIRLINE-HIGH.MOVE ‘I’ TO AIRLINE-SIGN.MOVE ‘BT’ TO AIRLINE-OPTION.APPEND AIRLINE.CLEAR AIRLINE.MOVE ‘0400’ TO CONN-LOW.MOVE ‘I’ TO CONN-SIGN.MOVE ‘EQ’ TO CONN-OPTION.APPEND CONN.

  • 8/19/2019 Data Dictionary & Report

    222/244

    Selection Screen 222

    Restricting the Selection Screen to One Line

  • 8/19/2019 Data Dictionary & Report

    223/244

    SELECT-OPTIONS FOR … NO-

    EXTENSION … . 

    Selection Screen 223

    right arrow does notappear on the selection screen

    user cannot access the

    multiple succession screen

    REPORT ZSAPTEST.TABLES: SFLIGHT.

    SELECT-OPTIONS AIRLINE

    FOR SFLIGHT-

    CARRID

    NO-EXTENSION.

     Restricting the Selection Screen to Single Value Selection

  • 8/19/2019 Data Dictionary & Report

    224/244

    Selection Screen 224

    SELECT-OPTIONS FOR … NO INTERVALS

    … . 

    TO field does not appear onthe selection screen

    user can  access the multiple

    succession screen

    REPORT ZSAPTEST.TABLES: SFLIGHT.

    SELECT-OPTIONS AIRLINE

    FOR SFLIGHT-

    CARRID

    NO INTERVALS.

    Further Selection Screen Options

    • NO-DISPLAY

  • 8/19/2019 Data Dictionary & Report

    225/244

    • suppresses display of selection screen criterion

    • LOWER CASE

    • enables acceptance of upper & lower case letters

    • OBLIGATORY

    •makes selection for FROM field mandatory

    • MEMORY ID

    • uses default values from SAP memory for FROM field

    • MODIF ID

    • assigns fields of a selection criterion to a modification group

    • MATCHCODE OBJECT

    • assigns a matchcode object to the FROM & TO fields of a selection

    criterion

    Selection Screen 225

    Selection Tables in WHEREConditions

    … WHERE IN  

  • 8/19/2019 Data Dictionary & Report

    226/244

    Selection Screen 226

    is a database column (without a prefix)

    is the selection table atached to

    REPORT ZSAPTEST.TABLES: SFLIGHT.SELECT-OPTIONS AIRLINE FOR SFLIGHT-CARRID.SELECT * FROM SFLIGHT

    WHERE CARRID IN AIRLINE.

    Checkboxes on the SelectionScreen

  • 8/19/2019 Data Dictionary & Report

    227/244

    PARAMETERS

    … AS CHECKBOX ... 

    Selection Screen 227

     parameter

    is created with type C length 1

    options TYPE & LIKE are not allowed

    valid values for

    are ‘ ‘ (false) and ‘X’ (true) 

    PARAMETERS: A AS CHECKBOX,B AS CHECKBOX DEFAULT ‘X’. 

     A

    B x 

    Checkboxes on the SelectionScreen

    REPORT ZSAPTEST.

  • 8/19/2019 Data Dictionary & Report

    228/244

    Selection Screen 228

    TABLES: SPFLI, SFLIGHT, SBOOK.SELECT-OPTIONS: SDEPART FOR SPFLI-DEPTIME, … PARAMETERS: CURRENCY LIKE SFLIGHT-CURRENCY,

    LUGGAGE AS CHECKBOX.

    Dep.Time

    Price 

    to

    to 

    Show Luggage Weight 

    Radiobuttons on the SelectionScreen

  • 8/19/2019 Data Dictionary & Report

    229/244

    PARAMETERS

    …RADIOBUTTON GROUP ...

    Selection Screen 229

     parameter

    is created with type C length 1can use LIKE option but must refer to a dictionary object of type C

    length 1

    string of max length 4must assign at least 2 parameters to each group

    user click on radiobuttonrespective parameter is activated, ie, assigned ‘X’ 

    only one parameter in each group can be activated

  • 8/19/2019 Data Dictionary & Report

    230/244

    Formatting the Selection Screen

  • 8/19/2019 Data Dictionary & Report

    231/244

    • SELECTION-SCREEN statement allows

     – insertion of texts/comments

     – underlines

     – insertion of blank lines

    • SELECTION-SCREEN BEGIN OF BLOCK 

     – combine logically related fields

     – draw a box around them using WITH FRAME

    Selection Screen 231

    Formatting the SelectionScreen

    SELECTION-SCREEN BEGIN OF LINE

  • 8/19/2019 Data Dictionary & Report

    232/244

    Selection Screen 232

    COMMENT POSITION SELECTION-SCREEN END OF LINE.

    REPORT ZSAPTEST.TABLES: SPFLI, SFLIGHT, SBOOK.SELECTION-SCREEN: BEGIN OF LINE,

    COMMENT 1(11) TEXT-002,POSITION 33.

    PARAMETERS: PRICE LIKE SFLIGHT-PRICE OBLIGATORY.SELECTION-SCREEN: COMMENT 55(8) TEXT-003,

    POSITION 65.PARAMETERS: CURRENCY LIKE SFLIGHT-CURRENCY OBLIGATORY.SELECTION-SCREEN END OF LINE. 

    Formatting the Selection Screen

  • 8/19/2019 Data Dictionary & Report

    233/244

    Selection Screen 233

    SELECTION-SCREEN SKIP .leaves blank lines on the selection screen

    SELECTION-SCREEN ULINE

    draws an underline on the selection screen 

    Formatting the Selection ScreenSELECTION-SCREEN BEGIN OF BLOCK

    … WITH FRAME 

  • 8/19/2019 Data Dictionary & Report

    234/244

    Selection Screen 234

    … TITLE title SELECTION-SCREEN END OF BLOCK .

    REPORT ZSAPTEST.TABLES: SPFLI, SFLIGHT, SBOOK.SELECTION-SCREEN BEGIN OF BLOCK SPFLI

    WITH FRAME TITLE TEXT-001.SELECT-