Table Control 15

download Table Control 15

of 26

Transcript of Table Control 15

  • 7/31/2019 Table Control 15

    1/26

    IBM Global Services

    2005 IBM CorporationTable Control | 6.15 March-2005

    Table Control

  • 7/31/2019 Table Control 15

    2/26

    IBM Global Services

    2005 IBM Corporation2 March-2005Table Control | 6.15

    Objectives

    The participants will be able to: Know the advantages of using a table control

    Create a table control in the Graphical Screen painter

    Setting attributes of the Table Control

    Paint fields for the table control

    Adding title to a table control

    Discuss about field selection column of a table control

    Program the processing of a table control

    Understand the field transport mechanism in the table control

    Create table control variants

  • 7/31/2019 Table Control 15

    3/26

    IBM Global Services

    2005 IBM Corporation3 March-2005Table Control | 6.15

    Table Control

    Display data in tabular form.

    User configurable.

    Change multiple lines of a table

    together.

    Vertical/horizontal scrollbars.

    Choose any number of key(leading) columns to be fixed.

    Cell attributes can be modified

    during runtime.

    Storing and loading of user-

    specific column layout.Fixed Leading

    Columns

    Automatic horizontal/vertical scrolling

    Change/save table settings

    Change column width

    Mark columns/rows

  • 7/31/2019 Table Control 15

    4/26

    IBM Global Services

    2005 IBM Corporation4 March-2005Table Control | 6.15

    Table Control (Contd.)

    Display data in tabular form.

    User configurable.

    Change multiple lines of a table

    together.

    Vertical/horizontal scrollbars.

    Choose any number of key(leading) columns to be fixed.

    Cell attributes can be modified

    during runtime.

    Storing and loading of user-

    specific column layout.Fixed Leading

    Columns

    Automatic horizontal/vertical scrolling

    Change/save table settings

    Change column width

    Mark columns/rows

  • 7/31/2019 Table Control 15

    5/26

    IBM Global Services

    2005 IBM Corporation5 March-2005Table Control | 6.15

    Creating a Table Control

  • 7/31/2019 Table Control 15

    6/26

    IBM Global Services

    2005 IBM Corporation6 March-2005Table Control | 6.15

    Creating a Table Control

    In the Screen Element Attributes window, assign aname to the table control and set initial (static)

    attributes.

    Some attributes are With column headers, Resizing,

    Separators, With title, Line selection column, No offixed columns etc.

  • 7/31/2019 Table Control 15

    7/26

    IBM Global Services

    2005 IBM Corporation7 March-2005Table Control | 6.15

    Creating Table Control Fields

  • 7/31/2019 Table Control 15

    8/26

    IBM Global Services

    2005 IBM Corporation8 March-2005Table Control | 6.15

    Creating Table Control Fields (Contd.)

  • 7/31/2019 Table Control 15

    9/26

    IBM Global Services

    2005 IBM Corporation9 March-2005Table Control | 6.15

    Adding a table title

  • 7/31/2019 Table Control 15

    10/26

    IBM Global Services

    2005 IBM Corporation10 March-2005Table Control | 6.15

    When creating a table control, the

    system automatically proposes a

    selection column.

    A selection column allows users to

    choose a line of the table control. The selection column elements

    behave like a checkbox.

    The field name must be entered in the

    attributes of the table control.

    Creating Table Control: Fields Selection Column

  • 7/31/2019 Table Control 15

    11/26

    IBM Global Services

    2005 IBM Corporation11 March-2005Table Control | 6.15

    Creating Table Control

    Declare CONTROLS statementwith type TABLEVIEW.

    The user can modify the Table

    Control attributes at runtime.

    Use REFRESH

    CONTROL FROM SCREEN to

    reset a table control to its initial

    attributes.

    Type TABLEVIEW has a complex structure containing

    individual fields and an internal table

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

    * INCLUDE SAPMZxxxTOP *

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

    CONTROLS: ITEMS TYPE TABLEVIEW

    USING SCREEN '9005'.

  • 7/31/2019 Table Control 15

    12/26

    IBM Global Services

    2005 IBM Corporation12 March-2005Table Control | 6.15

    Processing Table Control

    Database

    Screen

    A Table control can be processed with or without an internal table:

    *Processing without an internal table*

    PROCESS BEFORE OUTPUT.LOOP WITH CONTROL items.

    MODULE ctrl_pbo.

    ENDLOOP.

    PROCESS AFTER INPUT.

    LOOP WITH CONTROL items.

    MODULE ctrl_pai.ENDLOOP.

    InternalT

    ablewith

    header

    InternalTa

    blewithh

    eader

    Interna

    ltable

    withh

    eader

  • 7/31/2019 Table Control 15

    13/26

    IBM Global Services

    2005 IBM Corporation

    Defining Elements of a Table Control

    ABAP Dictionary fieldsFields from a program

    New table column

  • 7/31/2019 Table Control 15

    14/26

    IBM Global Services

    2005 IBM Corporation

    Declare Table Control

    To declare table control, use the syntax found below:CONTROLS TYPE TABLEVIEW USING SCREEN

    .

  • 7/31/2019 Table Control 15

    15/26

    IBM Global Services

    2005 IBM Corporation

    Processing Table Control Through Loop Endloop

    You can process the screen table using a LOOPstatement by:

    Looping only through the screen table

    Looping through screen table and an internaltable in parallel

    If you have table control in a screen, you must have

    LOOP ENDLOOP blocked both in PBOand PAI.

    SY-STEPL contains the current loop iteration.

  • 7/31/2019 Table Control 15

    16/26

    IBM Global Services

    2005 IBM Corporation

    Using LOOP Statements

    Syntax:LOOP AT CURSOR

    [WITH CONTROL ]

    [FROM ] [TO ].

    ENDLOOP.

    The FROM .. TO clause is for step loops

    When using step loops, omit the CURSOR parameter in the PAI event.

    The FROM and TO parameters are only possible with step loops. The

    WITH CONTROL parameter is only used with table controls.

    CURSOR contains the current cursor row

    Use TC-CURRENT_LINE as the cursor

  • 7/31/2019 Table Control 15

    17/26

    IBM Global Services

    2005 IBM Corporation

    Fields in a Table Control

  • 7/31/2019 Table Control 15

    18/26

    IBM Global Services

    2005 IBM Corporation

    Process Table Control with Other Screen Elements

    DATA:ok_code LIKE sy-ucomm,

    save_ok LIKE ok_code.

    ...MODULE user_command_100 INPUT.

    CASE save_ok.

    WHEN 'SRTU'.

    SORT it_book by ... .

    . . .

    ENDCASE.

    ENDMODULE.

    DATA:ok_code LIKE sy-ucomm,

    save_ok LIKE ok_code.

    ...MODULE user_command_100 INPUT.

    CASE save_ok.

    WHEN 'SRTU'.

    SORT it_book by ... .

    . . .

    ENDCASE.

    ENDMODULE.

    PROCESS AFTER INPUT.

    ...

    MODULE save_ok_code.

    MODULE user_command_100.

    . . .

    PROCESS AFTER INPUT.

    ...

    MODULE save_ok_code.

    MODULE user_command_100.

    . . .

    ScreenScreen

    PainterPainter

    Screen PainterScreen Painter

    Layout Editor

    Element List

    Object name

    button

    ok_codeok_code

    Type

    OKOK

    FctCode

    SRTU

    FctType

    Sort

    ABAPABAP

    Object name

    Object text

    FctCode

    button

    Sort

    SRTU

    Object Attributes

    FctType

  • 7/31/2019 Table Control 15

    19/26

    IBM Global Services

    2005 IBM Corporation19 March-2005Table Control | 6.15

    Processing Table Control (Contd.)

    *Processing with an internal table*

    PROCESS BEFORE OUTPUT.

    LOOP AT itab WITH CONTROL items CURSOR items-CURRENT_LINE.

    ENDLOOP.

    PROCESS AFTER INPUT.LOOP AT itab WITH CONTROL items.

    MODULE ctrl_pai.

    ENDLOOP.

    The fields in the table control and the internal table work area needs to have the

    same structure and names for automatic transport of data between the ABAP

    program and the screen.

    IBM Gl b l S i

  • 7/31/2019 Table Control 15

    20/26

    IBM Global Services

    2005 IBM Corporation20 March-2005Table Control | 6.15

    Field Transport in Table Controls

    PBO Transport ABAP table control

    fields to screen fields

    Transport remaining ABAP fields

    to screen fields

    PAI Transport all fields except table

    control and FIELD statement fields

    Transport table control fields

    Transport fields in FIELD

    statements

    IBM Gl b l S i

  • 7/31/2019 Table Control 15

    21/26

    IBM Global Services

    2005 IBM Corporation21 March-2005Table Control | 6.15

    Creating Table Control Variants

    IBM Gl b l S i

  • 7/31/2019 Table Control 15

    22/26

    IBM Global Services

    2005 IBM Corporation22 March-2005Table Control | 6.15

    Demonstration

    Creating a program to display the data in the YMOVIE table using a table control.

    IBM Gl b l S i

  • 7/31/2019 Table Control 15

    23/26

    IBM Global Services

    2005 IBM Corporation23 March-2005Table Control | 6.15

    Practice

    Creating a program to display the data in the YMOVIE table using a table control.

    IBM Global Ser ices

  • 7/31/2019 Table Control 15

    24/26

    IBM Global Services

    2005 IBM Corporation24 March-2005Table Control | 6.15

    Summary

    A table control is an area on the screen where the system displays data in atabular form. It is processed using a loop.

    Lines in a table control may contain dictionary table fields, keywords, input/output

    fields, radio buttons, checkboxes, radio button groups, and pushbuttons.A line

    can be up to 255 columns wide. Each column may have a title.

    When creating a table control, the system automatically proposes a selectioncolumn.

    A selection column allows users to choose a line of the table control.

    When processing a table control in the program, you will also need to declare a

    CONTROLS statement with type TABLEVIEW (in the TOP INCLUDE of your

    program).

    IBM Global Services

  • 7/31/2019 Table Control 15

    25/26

    IBM Global Services

    2005 IBM Corporation25 March-2005Table Control | 6.15

    Summary (Contd.)

    A Table control can be processed with or without an internal table. You can use the Customizing button (in the top right corner) to save the

    current setting (column widths and column positions) and use it as the initial

    value for the next call.

    IBM Global Services

  • 7/31/2019 Table Control 15

    26/26

    IBM Global Services

    2005 IBM Corporation26 March-2005Table Control | 6 15

    Questions

    What is a table control ? Is it mandatory to use an internal table for processing a table control ?

    What are the primary advantages of using table control ?