You are on page 1of 132

ABAP Training

Odin Lee 6/2005

Business Consulting Services

Copyright IBM Corporation 2005

Business Consulting Services

Agenda
-

ABAP Program Flow ( 30 Mins )

ABAP Dictionary Data type ( 90 Mins )


ABAP Program ( 300 Mins )
ABAP Editor ( 30 Mins ) Selection Screen ( 90 Mins ) Query Database ( 90 Mins ) ABAP List ( 90 Mins )

Page 2

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

ABAP Program Flow


-

ABAP Program Flow ( 30 Mins )

ABAP Dictionary Data type ( 90 Mins )


ABAP Program ( 300 Mins )
ABAP Editor ( 30 Mins ) Selection Screen ( 90 Mins ) Query Database ( 90 Mins ) ABAP List ( 90 Mins )

Page 3

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Client / Server Architecture

Page 4

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Report Program Flow 1.Program Start

Program Start

Repository

Database Table

Page 5

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

2.System Load Program Context

Program Start

ABAP Program
Selection Screen

Repository

Data Objects

Database Table
ABAP Processing Block

ABAP Runtime System

Page 6

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

3.Runtime System Sends Selection screen

Program Start

ABAP Program

Data Objects

Database Table
ABAP Processing Block

ABAP Runtime System

Page 7

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

4.Selection Screen Entries Insert into Data Object

Program
Start

ABAP Program

Data objects

Database Table
ABAP Processing Block

ABAP Runtime System

Page 8

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

5.Program Requests Data Record from Database

Program Start

ABAP Program

Data objects

Database Table
ABAP Processing Block

ABAP Runtime System

Page 9

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

6.Database Returns Data Record to Program

Program Program

ABAP Program ABAP Program

Start Start

Data objects Data objects

Database Database Table Table


ABAP Processing Block

ABAP Runtime System

Page 10

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

7.Runtime System Sends List

Program Start

ABAP Program

Data objects

Database Table
ABAP Processing Block

ABAP Runtime System

Page 11

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

ABAP Dictionary Data Type


-

ABAP Program Flow ( 30 Mins )

ABAP Dictionary Data type ( 90 Mins )


ABAP Program ( 300 Mins )
ABAP Editor ( 30 Mins ) Selection Screen ( 90 Mins ) Query Database ( 90 Mins ) ABAP List ( 90 Mins )

Page 12

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Data Types

Page 13

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Basic Types
Data Type Initial field length Valid field length Initial value Meaning

Numeric types I F P Character types C D N T 1 8 1 6 1 - 65535 8 1 - 65535 6 ' ' '00000000' '0 0' '000000' Text field (alphanumeric characters) Date field (Format: YYYYMMDD) Numeric text field (numeric characters) Time field (format: HHMMSS) 4 8 8 4 8 1 - 16 0 0 0 Integer (whole number) Floating point number Packed number

Hexadecimal type
X 1 1 - 65535 X'0 0' Hexadecimal field

Page 14

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Packed Number
Declear length
1 2 3 4 5 6 7 8
+ _

Output length no decimals


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + _

Output length with decimals


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 . + _

Page 15

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Global and Local Data Types


Types can be defined locally in a program or centrally in the Dictionary

Local Types in program: Technical Attributes Only ABAP Dictionary

ABAP Program ABAP Source Code Interface Subroutine

Global Types in ABAP Dictionary: Technical and Semantic Attribute

Page 16

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

ABAP Dictionary

Page 17

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Function of ABAP Dictionary


Type definitions
Structure

DB objects

Table, View

DB table

Data elements

Table type

Services
Poss. values Screen F4 Help F1

Page 18

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Database Object in the ABAP Dictionary


View

Objects are automatically Table 1 Table 2 created in the DB and adjusted to changes

ABAP Dictionary

Database
View

Table 1
Page 19

Table 2

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Type Definition in the ABAP Dictionary


Address Book
Name Address Telephone

First name

Last name

Town

Address

Phone No.

ZIP

Town name

Street

House no.

There are three different type categories in the ABAP Dictionary: Data elements: Describe an elementary type by defining the data type, length and possibly decimal places. Structures: Consist of components that can have any type.
Table types: Describe the structure of an internal table.
Page 20

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Internal table type

Page 21

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Internal table type line type

table name structure name

Page 22

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Internal table type table type

table access

Page 23

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Internal table type - key

Page 24

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Services of the ABAP Dictionary

Maintenance of flights

Carrier

LH

Flight number

F4

...
F1
Code of the flight connection
Code defining a flight connection between two cities, e.g. 0400 Frankfurt - New York.

Page 25

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Linking to the Development and Runtime Environment


Development environment Screen Painter Reads structure of database objects

ABAP Editor

ABAP
Read type definitions Runtime environment Screen Interpreter Database interface

Dictionary

ABAP Interpreter

Page 26

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Global Data Type-Using Data Element


Data Element: Field Label Input Field Technical Type Field Label Field Documentation (for F1 Help) Search Help (for F4 Help)

F1

Page 27

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Finding ABAP Dictionary Types


DATA wa_carrid TYPE S_CARR_ID.

F1

Data element S_CARR_ID

Structure Type SBC405_S_SFLIGHT Fields Field type

CARRID CONNID ...

S_CARR_ID

Page 28

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Local Data Types in Program


Help for Local Data Type Declaration

F1 TYPES Types:

<user_defined_type> TYPE <type>.

Help for Local Data Object Declaration Navigates to Local Data Type Declaration or ABAP Dictionary Type Declaration

F1 DATA DATA: <data_object> TYPE <type>. Double-Click

F1

Keyword Documentation for Built-In Types

Page 29

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

ABAP Editor
-

ABAP Program Flow ( 30 Mins )

ABAP Dictionary Data type ( 90 Mins )


ABAP Program ( 300 Mins )
ABAP Editor ( 30 Mins ) Selection Screen ( 90 Mins ) Query Database ( 90 Mins ) ABAP List ( 90 Mins )

Page 30

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

ABAP Editor

Page 31

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Create a Report Program


1

3
Page 32

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Comment and Chained Statement

REPORT yrep_create_01

. Comment

DATA wa_flight TYPE sflight. " work area for SFLIGHT * read data from DB table SFLIGHT Comment SELECT * FROM sflight INTO CORRESPONDING FIELDS OF wa_flight. NEW-LINE. WRITE : Chained Statement wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flight-seatsocc, wa_flight-seatsmax. ENDSELECT.

Page 33

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Navigation in the Editor and Keyword Documention


REPORT yrep_create_01 DATA wa_flight LIKE sflight. .
Definition of Structure In the Program

SELECT * FROM sflight INTO CORRESPONDING FIELDS OF wa_flight. NEW-LINE. WRITE: wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flight-seatsocc, wa_flight-seatsmax. ENDSELECT.
Definition of Database Table in the ABAP Dictionary
Copyright IBM Corporation 2005

Keyword Documentation
Page 34

IBM / Wistron ERP Project

Business Consulting Services

Defining Data Object

<user-defined-type>. DATA: <varname> TYPE <ABAP-dictionary-type>.

ABAP Program

ABAP Dictionary

DATA: <varname>

LIKE <data-object>.

Reference Data Object


Page 35

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Declaring Data Objects


ABAP Program carrid counter Data Element Tmp_carrid S_carr_id

DATA: Carrid

TYPE

s_carr_id, carr

counter TYPE I, Tmp_carrid LIKE carrid.

ABAP Basic Type

Data Object

Page 36

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Literals and Constants


CONSTANTS <constants> TYPE <type> VALUE <literal>.

CONSTANTS:

C_PI C_NAME(4)

TYPE P DECIMALS 4

VALUE '3.1415',

TYPE C VALUE 'Hugo'.

Numeric literal 1234, -987 Whole number (a minus sign is placed in front of negative numbers) Text literal 'abdc', '2.17', '1.213E15', HELLO', 'A''B' Character sequence set off by single quotation marks, 255 characters max.

Page 37

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Concatenate Statement
CONCATENATE f1 ... fn INTO g.

DATA: ONE(10) VALUE ' John ', TWO(3) VALUE 'F.', THREE(10) VALUE ' Kennedy', NAME(20). FIRST TYPE STRING. CONCATENATE ONE TWO THREE INTO NAME. NAME then contains the value ' JohnF. Kennedy'.

John F . Kennedy

JohnF .

Kennedy

Page 38

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Chang Variable Value Copy and Initialization


Data Declarations: CONSTANTS c_id TYPE s_carr_id VALUE 'AA . DATA: d_id1 TYPE s_carr_id , d_id2 counter Program Start c_id TYPE s_carr_id TYPE i . AA AA AA AA VALUE 'LH ', d_id2 LH LH AA AA counter 0000 0000 0000 0001

d_id1

MOVE

c_id

TO

d_id1

d_id2 = d_id1. ADD 1 TO counter. CLEAR CLEAR: gd _carrid1, gd _carrid2, counter.

0000

ABAP Program

ABAP Runtime System

Page 39

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Debugger Field Data Flow

Page 40

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Debugger - Watchpoint
Watchpoint

Page 41

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Defining Structure with Dictionary Type Reference


Structure Definition wa _ spfli Sdyn_conn _ ABAP Program ABAP Source Code

DATA: w_spfli TYPE spfli.


TABLES: sdyn_conn.

Page 42

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Addressing Fields in Structures


_ WA_SPFLI mandt carrid CONNID CITYFROM ABAP Program

ABAP Source Code DATA: w_spfli TYPE spfli. TABLES: sdyn_conn. sdyn_conn-carrid = 'AA'. SELECT * FROM spfli INTO w_spfli WHERE carrid = sdyn_conn-carrid. WRITE: / w_spfli-connid, w_spfli-cityfrom, w_spfli-cityto. ENDSELECT.

Fields in structures are always addressed by <structure>-<field_name>

Page 43

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Moving Values Fields for Field


MOVE-CORRESPONDING <rec1> TO <rec2>.

DATA: ...

wa _ sflight

TYPE

sflight

wa _sbc400focc TYPE sbc400focc. MOVE-CORRESPONDING MOVE-CORRESPONDING wa _ sflight wa _ sflight TO TO wa _sbc400focc. wa _sbc400focc.

MANDT 401

CARRID LH

CONNID 0400

FLDATE 20000513

... ...

SEATSMAX 280

SEATSOCC 100

... ...

wa _ sflight

CARRID

CONNID 0400

FLDATE 20000513

SEATSMAX 280

SEATSOCC 100

PERCENTAGE

LH

Page 44

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Debugger - Structure

Double-Click

Page 45

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Internal Table
CARRID CONNID DISTANCE Key Fields AA LH LH QF SQ UA 0017 0400 0400 0005 0866 0007 2,572 6,162 6,162 10,000 1,625 2,572 5 Data Access Type UA 0007 Access with Index Sequence Unique / Non-Unique Key Line Type Key

Table Kind

Access with Key

You do not have to determine the number of lines in your table; the ABAP runtime system automatically determines this

at runtime (dynamic table expansion).

Page 46

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Table Types
ANY TABLE

INDEX TABLE

HASHED TABLE

STANDARD TABLE

SORTED TABLE

Access with Index Access with Key Unique / Non-Unique Key Access Using

NON- UNIQUE

UNIQUE | NON-UNIQUE

UNIQUE

Mainly Index

Mainly Keys

Keys Only

Page 47

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Defining Internal Table Reference to Dictionary Type

IT_flight

ABAP Program

DATA it_flight TYPE

SBC405_T_SFLIGHT

Page 48

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Debugger Internal Table

Page 49

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Processing Single Record


Append APPEND wa_itab to itab. APPEND

Insert

INSERT wa_itab INTO itab <condition>.

Read

READ

TABLE itab INTO wa_itab <condition>.

Change

MODIFY

TABLE itab <condition>.

Delete

DELETE DELETE itab <condition>.

Page 50

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Example: Filling Internal Table Line by Line


* declaration of internal table and workarea DATA: it_flight TYPE sbc405_t_sflight. DATA: wa_flight TYPE sbc405_s_sflight.
It_flight

Wa_flight

** Filling structure wa_flight with values SELECT * FROM sflight INTO CORRESPONDING FIELDS OF wa_flight. ** Append wa_flight to internal table it_flight APPEND wa_flight TO it_flight. ENDSELECT.

Page 51

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Example: Reading Using the Index

READ TABLE it_flight INTO wa_flight INDEX 5. IF sy-subrc = 0. WRITE: / wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flight-seatsmax. ENDIF.

Page 52

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Example: Reading Using Keys

READ TABLE it_flight INTO wa_flight WITH KEY carrid = 'LH' connid = '0401' fldate = '20030404'. IF sy-subrc = 0. WRITE: / wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flight-seatsmax. ENDIF.

Page 53

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Processing Sets of Records


Loop: LOOP AT itab INTO wa _ itab .

For All Operations


ENDLOOP. ENDLOOP.

Delete

DELETE

itab

<condition>.

Insert Multiple Lines from an Internal Table Append Multiple Lines from an Internal Table APPEND INSERT itab2 <condition2> FROM itab1 <condition1>. INSERT itab2 <condition2> FROM itab1 <condition1>.

Page 54

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Other Process Options


Sort SORT SORT itab <conditions>

Setting Internal Table Contents to Initial

CLEAR CLEAR

itab .

Page 55

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Example: Reading Using a Loop

LOOP AT it_flight INTO wa_flight. WRITE: / wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flight-seatsmax. ENDLOOP.

Page 56

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Internal Table with Header Line


DATA WITH HEADER LINE < itab > TYPE < itabtype > [[WITH HEADER LINE] .

Work Area <wa>

Header Line <itab>

Internal Table <itab>


CARRID AA LH CONNID 0017 0400

Internal Table <itab>


CONNID 0017 0400 AA LH

CARRID Report : YBC_REP_005

APPEND <WA> TO <itab>. MODIFY <ITAB> INDEX <n> FROM <WA>. LOOP AT <ITAB> INTO <WA>. WRITE <WA>-<field>. ENDLOOP. READ TABLE <ITAB> INDEX <n> INTO <WA>.

APPEND <itab>. MODIFY <ITAB> INDEX <n>. LOOP AT <ITAB>. WRITE <ITAB>-<field>. ENDLOOP. READ TABLE <ITAB> INDEX <n>.

Page 57

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Query Database
-

ABAP Program Flow ( 30 Mins )

ABAP Dictionary Data type ( 90 Mins )


ABAP Program ( 300 Mins )
ABAP Editor ( 30 Mins ) Selection Screen ( 90 Mins ) Query Database ( 90 Mins ) ABAP List ( 90 Mins )

Page 58

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Querying the Database


ABAP Program

Data Objects

pa_car wa_scarr wa _

ABAP Processing Block

SELECT ...

Open SQL

Database Specific Conversion

Database SQL

Database Interface ABAP Runtime System

scarr

Page 59

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Reading database tables


SELECT <result>
Which columns? Which table(s)? Where? Which lines?

FROM

<table>

INTO <destination> WHERE <condition>

Single Line

} Multiple Lines
Particular Column

Page 60

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Processing Single Records


ABAP Program

Data Objects

pa_carrid wa_scarr wa _ Database Table SCARR

ABAP Processing Block

DATA: p_carrid LIKE scarr-carrid. DATA: wa_scarr LIKE scarr. ****** SINGLE SELECT SINGLE * INTO wa_scarr FROM scarr WHERE carrid = p_carrid. IF sy-subrc = 0. WRITE: / wa_scarr-carrid, wa_scarr-carrname. ELSE. MESSAGE i006(bc405) WITH 'Data not found!'. ENDIF. ABAP Runtime System

Database Interface

scarr

Page 61

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

ABAP statement return code

Page 62

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Message
MESSAGE XNNN WITH f1 ... f4

Table T100

Page 63

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Runtime Behavior of Messages


A Termination Processing is terminated, the user must restart the transaction Exit Like a termination message, but with short dump MESSAGE_TYPE_X Error Runtime behavior depends on context Warning Runtime behavior depends on context Information Processing is interrupted, the message is displayed in a dialog box and the program is continued when the message has been confirmed with ENTER. Status The message appears in the status bar on the next screen.

X
E W I

Page 64

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Evaluating Filed Contents


CASE <data object1>. WHEN <data object2>.
Statements

WHEN <data object4> OR <data object5>.


Statements

WHEN OTHERS.
Statements

ENDCASE.

IF <logical expression>.
Statements

ELSEIF <logical expression>.


Statements

ELSEIF <logical expression>.


Statements

ELSE.
Statements

ENDIF.

Page 65

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Select loops
Data Objects

ABAP Program

pa_carrid wa _sflight
ABAP Processing Block

Database Table SFLIGHT

DATA: p_carrid LIKE scarr-carrid. DATA: wa_sflight LIKE sflight. ****** SELECT * INTO wa_sflight SELECT FROM sflight WHERE carrid = p_carrid. WRITE: / wa_sflight-carrid, wa_sflight-connid, wa_sflight-fldate. ENDSELECT ENDSELECT . IF sy-subrc <> 0. MESSAGE i006(bc405) WITH 'Data not found!'. ENDIF. ABAP Runtime System

Database Interface

Page 66

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

INTO Clauses
ABAP Program

DATA: wa_sbc405_sflight LIKE sbc405_s_sflight. ****** SELECT mandt carrid connid fldate price currency seatsmax seatsocc INTO wa_sbc405_sflight FROM sflight WHERE carrid = p_carrid. WRITE: / wa_sbc405_sflight-connid, wa_sbc405_sflight-fldate. ENDSELECT. IF sy-subrc <> 0. Same Type as MESSAGE i006(bc405) WITH 'Data not found!'. ENDIF. Column Read

Page 67

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

INTO CORRESPONDING FIELDS


ABAP Program

DATA: wa_sdyn_conn LIKE sdyn_conn. ****** SELECT carrid connid seatsmax INTO CORRESPONDING FIELDS OF wa_sdyn_conn FROM sflight WHERE carrid = p_carrid. WRITE: / wa_sdyn_conn-connid, wa_sdyn_conn-seatsmax. ENDSELECT. IF sy-subrc <> 0. MESSAGE i006(bc405) WITH 'Data not found!'. ENDIF. mandt carrid connid ... seatsmax

Same Name as Column Read

mandt
Page 68

carrid

connid

...

seatsmax
Copyright IBM Corporation 2005

IBM / Wistron ERP Project

Business Consulting Services

Array Fetch

Data Objects

ABAP Program

pa_carid _ it_flight Database Table SFLIGHT

ABAP Processing Block

DATA: p_carrid LIKE scarr-carrid. DATA: it_sflight LIKE sflight OCCURS 0. ****** SELECT * INTO TABLE it_sflight TABLE FROM sflight WHERE carrid = p_carrid. IF sy-subrc <> 0. MESSAGE i006(bc405) WITH 'Data not found!'. ENDIF.

Database Interface

ABAP Runtime System

Page 69

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Reading Multiple Database Tables

Database View in the ABAP Dictionary Database View in the ABAP Dictionary INNER JOIN, OUTER JOIN INNER JOIN, OUTER JOIN FOR ALL ENTRIES FOR ALL ENTRIES Nested SELECT Statements Nested SELECT Statements

Page 70

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Reading Multiple Database Tables - View


Database View in the ABAP Dictionary Database View in the ABAP Dictionary

REPORT ZSAPBC405_GDAD_DB_VIEW

Dictionary
Table

Database view DV_FLIGHTS


Join conditions

...

SELECT carrid connid cityfrom cityto fldate seatsmax seatsocc INTO TABLE itab_flights FROM dv_flights WHERE cityfrom IN so_cityf AND cityto IN so_cityt AND seatsocc < dv_flights~seatsmax ORDER BY carrid connid fldate. ...
View fields

Page 71

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Reading Multiple Database Tables Inner Join


INNER JOIN INNER JOIN

REPORT SAPBC405_GDAD_INNER_JOIN_2TAB ... SELECT SPFLI~CARRID SPFLI~CONNID SPFLI~CITYFROM SPFLI~CITYTO SFLIGHT~FLDATE SFLIGHT~SEATSMAX SFLIGHT~SEATSOCC INTO TABLE ITAB_FLIGHTS FROM SPFLI INNER JOIN SFLIGHT ON SPFLI~CARRID = SFLIGHT~CARRID AND SPFLI~CONNID = SFLIGHT~CONNID WHERE SPFLI~CARRID IN SO_CARR AND SPFLI~CONNID IN SO_CONN.
A

INNER JOIN

a1
a2 a3

b1
b2 b3

c1
c2 c3

a1
a3 a3

b1
b2 b3

d1
d2 d3

A a1 a3

B b1 b3

C c1 c3

D d1 d3

...

Page 72

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Reading Multiple Database Tables Outer Join


OUTER JOIN OUTER JOIN

REPORT SAPBC405_GDAD_OUTER_JOIN ...


A

LEFT OUTER JOIN

B b1 b2 b3

C c1 c2 c3

A a1 a3 a3

D d1 d2 d3

E e1 e2 e3

SELECT SCARR~CARRID SCARR~CARRNAME SPFLI~CONNID SPFLI~CITYFROM SPFLI~CITYTO INTO TABLE ITAB_FLIGHTS FROM SCARR LEFT OUTER JOIN SPFLI ON SCARR~CARRID = SPFLI~CARRID ORDER BY SCARR~CARRID SPFLI~CONNID.

a1 a2 a3

A a1 a2 a3

B b1 b2 b3 b3

C c1 c2 c3 c3

D d1

E e1

d2 d3

e2 e3

...
a3

Page 73

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Alias Name

SELECT A~CARRID AS A1 A~CARRNAME AS B1

FIELD ALIAS

B~CONNID B~CITYFROM B~CITYTO INTO CORRESPONDING FIELDS OF TABLE ITAB_FLIGHTS FROM SCARR AS A LEFT OUTER JOIN SPFLI AS B ON A~CARRID = B~CARRID WHERE A~CARRID EQ P_CARRID ORDER BY A~CARRID B~CONNID. Table ALIAS

Page 74

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Reading Multiple Database Tables FOR ALL ENTRIES


FOR ALL ENTRIES FOR ALL ENTRIES
REPORT ... . SAPBC405_GDAD_FOR_ALL_ENTRIES
itab_spfli
LH LH 0400 0402 ... ...

SELECT carrid connid cityfrom airpfrom cityto airpto deptime arrtime INTO TABLE itab_spfli FROM spfli WHERE cityfrom IN so_cityf AND cityto IN so_cityt.
* Check, if at least one dataset is found DESCRIBE TABLE itab_spfli LINES itab_lines. IF sy-subrc <> 0. EXIT. ENDIF. * Delete Duplicates SORT itab_spfli. DELETE ADJACENT DUPLICATES FROM itab_spfli. SELECT carrid connid fldate seatsmax seatsocc INTO TABLE itab_sflight FROM sflight FOR ALL ENTRIES IN itab_spfli WHERE carrid = itab_spfli-carrid AND connid = itab_spfli-connid. .... .
Page 75

Executed according to:

where (

carrid and connid

= 'LH' = '0400') = 'LH' = '0402')

or or

( (.

carrid and connid ..

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Selection Screen
-

ABAP Program Flow ( 30 Mins )

ABAP Dictionary Data type ( 90 Mins )


ABAP Program ( 300 Mins )
ABAP Editor ( 30 Mins ) Selection Screen ( 90 Mins ) Query Database ( 90 Mins ) ABAP List ( 90 Mins )

Page 76

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Selection Screen

Page 77

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

The Selection Screen Function

Type checks Multilingual Capacity

Value Entry
...

Variants

Search Help

Page 78

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Entering Selections

SELECT-OPTIONS ... PARAMETERS ...

Multiple single values,

Intervals,
Single value exclusion, Interval exclusion

Page 79

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Selection text
Multilingual Capacity

Program
Source Code REPORT bc400td_selection_screen. : SELECT-OPTIONS so_ carr FOR ... PARAMETERS pa_city TYPE ... Text elements
Title/Headers Text symbols

Selection Texts SO_CARR EN Airline carrier DE EN Departing from DE

PA_CITY Airline Carrier LH to ...

Departing from

Page 80

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Search Help
DATA: WA_SPFLI TYPE LINE_TYPE_SPFLI. SELECT-OPTIONS: SO_CARID FOR WA_SPFLI-CARRID DEFAULT 'AA' TO 'LH', SO_CONID FOR WA_SPFLI-CONNID.

Table field Structure Field Search Help Search Help Check Tables Data element

ABAP Dictionary

Page 81

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Variants

Airline Carrier

AA

to

LH

...

Departing from

Variant CARRIER_AA_TO_LH: Airlines AA to LH Hide input field

Departing from

Page 82

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Parameters

ABAP Program

p_carid
reference ABAP Dictionary

Locally Defined Types and Fields

PARAMETERS
Selection Screen

p_carid TYPE s_carr_id. s_carr_id

ABAP Processing

Block

ABAP Runtime System

Page 83

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Data Transport

ABAP Program

pa_car p_car

Locally Defined Types and Fields

p_car PARAMETERS pa _ car TYPE s_carr_id.


Selection Screen Selection Screen

ABAP Processing Block

ABAP Runtime System

Page 84

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Declaring Fields with PARAMETERS


PARAMETERS: <f>[TYPE <type>][DECIMALS <n>][LIKE <f1>][MEMORY ID < [OBLIGATORY][DEFAULT < wert >] [AS CHECKBOX] [RADIOBUTTON GROUP < grp >]
.

pid >]

REPORT ... .

SAPBC405_SSCD_CHECKBOX_RADIOB

PARAMETERS: PA_CARR LIKE SFLIGHT-CARRID DEFAULT 'AA', PA_NAME AS CHECKBOX DEFAULT 'X',
PA_CURR AS CHECKBOX DEFAULT 'X', PA_LIM_1 RADIOBUTTON GROUP LIM,

PA_LIM_2 RADIOBUTTON GROUP LIM,


PA_LIM_3 RADIOBUTTON GROUP LIM .

Page 85

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Using Parameters in Select Statement

REPORT ...

DATA wa _spfli TYPE spfli.


PARAMETERS pa_car TYPE s_ ... SELECT SELECT carrid connid cityfrom cityto ... wa _spfli FROM spfli INTO CORRESPONDING FIELDS OF pa_car WHERE carrid = pa_car. WRITE: ENDSELECT ENDSELECT. / wa _spfli-carrid, wa _spfli- fldate , ... . carr _id.

wa _spfli- connid ,

Page 86

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Select-Options

option Sign low

high so_ carr

ABAP Program

gd _carrid
Locally Defined Types and Fields

Selection Screen

DATA gd _carrid TYPE s_carr_id . SELECT-OPTIONS SELECT-OPTIONS so_ carr FOR gd_carrid.

ABAP Processing Block

ABAP Runtime System

Page 87

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Data Transport

ABAP Program

so_ carr so_ carr wa _ scarr

gd _carrid
Locally Defined Types and Fields Selection Screen Selection

DATA gd _carrid TYPE s_ carr _ id . so_ carr SELECT-OPTIONS so_ carr FOR gd _carrid.

Screen

ABAP Processing Block

ABAP Runtime System

Page 88

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Selection Screen with select-options

sign

option I EQ

low 003000497

high

Internal Table S_VBELN

Page 89

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Syntax of the SELECT-OPTIONS Statement


SELECT-OPTIONS < seltab > FOR <Data Object>

DEFAULT <value> OPTION < DEFAULT <value1> TO <value2> xx > SIGN <x>

MEMORY ID <

pid >

LOWER CASE

OBLIGATORY

NO-EXTENSION

NO INTERVALS.

Page 90

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Selection Options and Multiple Selections


Selection options

Multiple selections

Sign I I

Option EQ BT

Low AA DL

High

LH

Page 91

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Using select-options in the SELECT Statement


REPORT ZTEST. DATA: WA_SPFLI TYPE SPFLI. SELECT-OPTIONS S_CARR FOR WA_SPLFLI-CARRID. SELECT CARRID CONNID CITYFROM CITYTO FROM SPFLI INTO CORRESPONDING FIELDS OF WA_SPFLI WHERE CARRID IN S_CARR. WRITE: / WA_SPFLI-CARRID, WA_SPFLI-CONNID, WA_SPFLI-CITYFROM, WA_SPFLI-CITYTO. ENDSELECT.

Page 92

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Designing the Selection Screen I


SELECTION-SCREEN BEGIN OF BLOCK <block WITH FRAME TITLE <text> Price ...
>

SELECTION-SCREEN END OF BLOCK <block>

REPORT sapbc405_sscd_sel_screen_i. ... * Block with frame SELECTION-SCREEN BEGIN OF BLOCK CARR WITH FRAME. SELECT-OPTIONS: SO_CARR FOR WA_SFLIGHT-CARRID. SELECTION-SCREEN END OF BLOCK CARR. * Block with frame and title SELECTION-SCREEN BEGIN OF BLOCK LIMIT WITH FRAME TITLE TEXT-001. PARAMETERS: PA_LIM_1 RADIOBUTTON GROUP LIM, PA_LIM_2 RADIOBUTTON GROUP LIM, PA_LIM_3 RADIOBUTTON GROUP LIM. SELECTION-SCREEN END OF BLOCK LIMIT. ...

Page 93

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Designing the Selection Screen II


REPORT SAPBC405_SSCD_SEL_SCREEN_II. ... * Nested blocks with frame and title * Radiobutton group SELECTION-SCREEN BEGIN OF BLOCK OUT_PUT WITH FRAME TITLE TEXT-S01. * Radiobutton group with frame and frame text SELECTION-SCREEN BEGIN OF BLOCK SEATS WITH FRAME TITLE TEXT-S02. PARAMETERS PA_OCC RADIOBUTTON GROUP SEAT. PARAMETERS PA_FRE RADIOBUTTON GROUP SEAT. PARAMETERS PA_ALL RADIOBUTTON GROUP SEAT. SELECTION-SCREEN END OF BLOCK SEATS. * Parameters displayed in one line SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) TEXT-S03. SELECTION-SCREEN COMMENT POS_LOW(8) TEXT-S04. PARAMETERS PA_COL AS CHECKBOX. SELECTION-SCREEN COMMENT POS_HIGH(8) TEXT-S05. PARAMETERS PA_ICO AS CHECKBOX. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK OUT_PUT. ...
Page 94

SELECTION-SCREEN: BEGIN OF LINE

COMMENT pos ( len ) <text> [FOR FIELD <f>]


POSITION pos

END OF LINE

Output ...
Seats ...

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Selection Screen Events


Program Start ABAP Program

INITIALIZATION.

AT SELECTON-SCREEN OUTPUT.

AT SELECTION-SCREEN.

No Yes
START-OF-SELECTION

ABAP Runtime System

Page 95

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Initializing the Selection Screen


INITIALIZATION. REPORT ... SAPBC405_SSCD_INITIALIZATION.

INITIALIZATION.
MOVE: MARK TO PA_ALL. MOVE: 'I' TO SO_CARR-SIGN, 'BT' TO SO_CARR-OPTION, 'AA' TO SO_CARR-LOW, 'LH' TO SO_CARR-HIGH. APPEND SO_CARR. CLEAR SO_CARR. MOVE: 'E' TO SO_CARR-SIGN, 'EQ' TO SO_CARR-OPTION, 'DL' TO SO_CARR-LOW. APPEND SO_CARR.

...

Page 96

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

At selection-screen output

Page 97

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Input Checks:AT SELECTION-SCREEN


AT SELECTION-SCREEN

ON <f>
ON RADIOBUTTON GROUP <grp>

ON <seltab>
ON BLOCK <block>

REPORT sapbc405_sscd_at_sel_screen. ... * Check of selection criterion SO_DEPT AT SELECTION-SCREEN ON so_dept. IF ( so_dept-low LT '060000' OR so_dept-high LT '060000' ) OR ( so_dept-low GE '220000' OR so_dept-high GE '220000' ) AND airp_fr EQ 'FRA'. MESSAGE e002(bc405). ENDIF.

...

Page 98

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Error Dialogs in AT SELECTION-SCREEN


Program Start ABAP Program

INITIALIZATION.

AT SELECTION-SCREEN. MESSAGE e001.

No Yes
START-OF-SELECTION

ABAP Runtime System

Page 99

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

At Selection-Screen Syntax
PARAMETERS: pa_car TYPE s_ carr _id.

* First event processed after leaving the selection screen AT SELECTION-SCREEN. AUTHORITY-CHECK OBJECT 'S_CARRID' ID 'CARRID' FIELD pa_car ID 'ACTVT' IF sy - subrc FIELD <> 0. actvt _display.

* Show selection screen again and show message in status bar MESSAGE e045(bc400) WITH pa_car. MESSAGE e045(bc400) WITH pa_car. ENDIF.

Page 100

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

ABAP List
-

ABAP Program Flow ( 30 Mins )

ABAP Dictionary Data type ( 90 Mins )


ABAP Program ( 300 Mins )
ABAP Editor ( 30 Mins ) Selection Screen ( 90 Mins ) Query Database ( 90 Mins ) ABAP List ( 90 Mins )

Page 101

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

List

Page 102

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Purpose of List

Screen
CA ID PRICE 2500 7800

Multilingual Capacity

AA
AA Total

2602 2400
2602

Print

Page 103

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

List Operations

Page 104

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Basic list Process

Program Start ABAP Program Data Objects

Database Table START-OF-SELECTION


List
buffer

ABAP Runtime System

Page 105

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Generating a List
REPORT SAPBC405_FOLD_LIST_CREATION.

DATA: WA_SPFLI LIKE SPFLI. SELECT CARRID CONNID CITYFROM CITYTO DEPTIME ARRTIME INTO CORRESPONDING FIELDS OF WA_SPFLI FROM SPFLI. WRITE: / WA_SPFLI-CARRID, WA_SPFLI-CONNID, WA_SPFLI-CITYFROM, WA_SPFLI-CITYTO, WA_SPFLI-DEPTIME, WA_SPFLI-ARRTIME. ENDSELECT.

Page 106

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

WRITE Statement :General Syntax


WRITE [AT] [/< pos ( len )>] <f> <option1> <option2> ...

REPORT sapbc405_fold_write ... .... . . * constants for positions of outputs CONSTANTS: pos TYPE i VALUE 72, pos2 TYPE i VALUE 12, len_fdt TYPE i VALUE 10, "sflight-fldate len_max TYPE i VALUE 6, "sflight-seatsmax len_pri TYPE i VALUE 11, "sflight-price len_cur TYPE i VALUE 8. "sflight-currency .... . . WRITE AT: / sy-vline, pos2(len_fdt) wa_sflight-fldate COLOR COL_KEY, (len_max) wa_sflight-seatsmax, (len_max) wa_sflight-seatsocc, (len_max) seatsfree COLOR COL_POSITIVE, (len_pri) wa_sflight-price CURRENCY wa_sflight-currency, (len_cur) wa_sflight-currency.

Page 107

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Addition Option Parameters

Page 108

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Setting the List Format

Page 109

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Page Headers

Page 110

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Multilingual Capability
Program
Source text REPORT ... REPORT ... WRITE:/ SY-VLINE, WRITE:/ SY-VLINE, 'Flight'(001), 'Flight'(001), 'Starting city'(002), 'Starting city'(002), 'Dest .. city'(003), 'Dest city'(003), ... ... Text elements
Title/Headings List header DE Flugverbindungen EN Flight Connections FR Text symbols 001 DE Flug EN Flight FR ..... ...

:
002 DE Startort

Start the extended syntax check: Error if text elements are not maintained. Reconciliation: Program text symbols possible. Determine text lengths with character list for other languages.

Page 111

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Event Overview
* Basic list

START-OF-SELECTION. . END-OF-SELECTION.

TOP-OF-PAGE.

END-OF-PAGE

Detail lists

AT LINE-SELECTION.

AT USER-COMMAND.
TOP-OF-PAGE DURING LINE-SELECTION .

Page 112

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Defining Line and Field Formats

Page 113

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Outputting Icons, Symbols, and Lines

Page 114

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Additional Statements for Page Layout


NEW-LINE.

SKIP [TO LINE] <n>.

RESERVE <n> LINES.

BACK.

POSITION <n>.

SET BLANK LINES ON|OFF

}.

Page 115

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

System Fields in List Creation


1 SY-SROWS SY-LINCT SY-COLNO

SY-LINSZ 2

SY-SCOLS

SY-LINNO SY-PAGNO
3 2 1

Page 116

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Detail List

Page 117

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Events for Detail List


* Basic list

START-OF-SELECTION. GET ... .

END-OF-SELECTION. TOP-OF-PAGE.

Detail lists

AT LINE-SELECTION. AT USER-COMMAND. TOP-OF-PAGE DURING LINE-SELECTION .

Page 118

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Example : A Simple Detail List

Page 119

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

System Variant : sy-lsind

Page 120

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Create a detail List I


REPORT sapbc405_ilbd_interact_list_1.
... AT LINE-SELECTION. AT LINE-SELECTION.

SET CURSOR LINE 2. pos = 3 * sy-lsind. len = sy-linsz - pos - 21. WRITE: 'Das ist eine Verzweigungliste'(001) COLOR COL_TOTAL. FORMAT COLOR COL_NEGATIVE. WRITE: / 'Listenstufe: '(002) NO-GAP COLOR COL_NORMAL, sy-lsind COLOR COL_NORMAL, AT (pos) space. IF sy-lsind = 19. pos = pos + 19. WRITE AT pos(len) icon_message_error AS ICON COLOR COL_NORMAL RIGHT-JUSTIFIED. ELSEIF sy-lsind = 20. pos = pos + 19. WRITE AT pos(len) icon_alarm AS ICON COLOR COL_NORMAL RIGHT-JUSTIFIED. ENDIF.

User actionsy-ucomm = PICK

Page 121

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Creating Detail Lists II


Basic list sy-lsind: 0 REPORT sapbc405_ilbd_interact_lists_2.

AT LINE-SELECTION. AT LINE-SELECTION.
AT LINE-SELECTION. * Creation of detail lists FORMAT COLOR COL_TOTAL. CASE sy-lsind. WHEN '1'. * Detail list 1 WRITE: 'Verzweigungsliste: 1'(001), /'SY-LSIND: '(000), 19 sy-lsind . WHEN '2'. * Detail list 2 WRITE: 'Verzweigungsliste: 2'(002), /'SY-LSIND: '(000), 19 sy-lsind . ENDCASE.

PICK

Detail list: sy-lsind:

1 1

PICK

Detail list: sy-lsind:

2 2

PICK

Page 122

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

The HIDE Area


HIDE <data object>.

Basic list buffer Line

HIDE area Line wa _spflicarrid ... LH LH ... SQ wa _spfliconnid ... 0400 0402 ... 0002

... 5 6 ... 11

LH 0400 FRA LH 0402 FRA ... SQ 0002 SIN

JFK JFK SFO

10:10:00 13:30:00 09:30:00

... 5 6 ... 11

REPORT sapbc400udd_example_2. ... START-OF-SELECTION. SELECT * FROM spfli INTO wa _spfli. WRITE:/ wa _spfli-carrid, wa _spfli- connid , wa _spfli- airpfrom , wa _spfli- airpto , wa _spfli- deptime . HIDE: wa _spfli-carrid, wa _spfli- connid . ENDSELECT.
Page 123

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Line Selection
HIDE area
Line Flight From LH 0400 FRA LH 0402 FRA ... SQ 0002 SIN To JFK JFK SFO Departing at 10:10:00 13:30:00 09:30:00 ... 5 6 ... 11

wa _spfli-carrid ... LH LH ... SQ

wa _spfli- connid ... 0400 0402 ... 0002

??

LH 0402

??

??

??

wa _spfli

REPORT sapbc400udd_example_2.
AT LINE-SELECTION. WRITE: text-001, wa _spfli-carrid, wa _spfli- connid .

Text symbols: 001 Flights for connection

Page 124

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Line Selection:The Hide Technique

DEMO: Data Transport: Hide Technique -------------------------------------------------------AA NEW YORK SAN FRANCI AZ ROME FRANKFURT AZ TOKYO ROME LH FRANKFURT NEW YORK

DEMO: Data Transport: Hide Technique -------------------------------------------------------LH 400 02/01/2000 1,332.00 DEM 03/28/2000 1,332.00 DEM 04/17/2000 1,332.00 DEM

1
SY-LILLI
6 Hide area of list level 0 Line 3 3 4 5 6 :
Page 125

5
REPORT SAPBC405_ILBD_HIDE .

Field name spfli spfli spfli spfli - carrid - carrid - carrid - carrid :

Value AA AZ AZ LH

Field name spfli spfli spfli spfli - connid - connid - connid - connid :

Value 0017 0555 0789 0400

AT LINE-SELECTION. AT LINE-SELECTION. SELECT ... WHERE carrid AND connid

= spfli - carrid LH = spfli - connid .

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Line Selection Syntax


REPORT sapbc400udd_example_2.

...
Text symbols: AT LINE-SELECTION. IF sy - lsind WRITE: = 1. wa _spfli-carrid, wa _spfli- connid . SELECT FROM fldate seatsmax seatsocc sflight wa _ sflight wa _spfli-carrid = wa _spfli- connid . wa _ sflight - fldate , wa _ sflight - seatsmax , wa _ sflight - seatsocc . ENDSELECT. ENDIF. 001 Flights for connection text-001,

INTO CORRESPONDING FIELDS OF WHERE carrid = AND connid

WRITE:/

Page 126

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Valid Line Selection


REPORT sapbc405_ilbd_valid_line_sel. ... GET spfli FIELDS ... WRITE ... HIDE: spfli-carrid, spfli-connid. DEMO: LH Data Transport: Hide Technique

-------------------------------------------------------400 01.02.00 1.332,00 DEM 28.03.00 1.332,00 DEM

17.04.00 1.332,00 DEM


END-OF-SELECTION. CLEAR spfli-carrid. CLEAR spfli-carrid. HIDE area AT LINE-SELECTION. CHECK NOT spfli-carrid IS INITIAL. CHECK NOT spfli-carrid IS INITIAL. ...

CLEAR spfli-carrid. CLEAR spfli-carrid.

Page 127

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Data Buffering in a List System


HIDE area Basic list

HIDE area
Detail List

HIDE area Detail List

Basic list

DL 1

DL 2

...

Display

Display

Display

List buffer Basic list

List buffer Detail List

List buffer Detail List

Page 128

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Page Headings for Detail Lists


TOP-OF-PAGE DURING LINE-SELECTION .

REPORT sapbc405_ilbd_heading_i_lists NO STANDARD PAGE HEADING. TOP-OF-PAGE.

TOP-OF-PAGE DURING LINE-SELECTION TOP-OF-PAGE DURING LINE-SELECTION FORMAT COLOR COL_HEADING. ULINE. WRITE: sy-vline, 'Flight dates'(t05), AT pos_nr sy-pagno, AT line_size sy-vline. ULINE.

..

Page 129

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Field Selection
GET CURSOR FIELD <feld1> [VALUE <feld2>].
REPORT SAPBC405_ILBD_FIELD_SELECTION. DATA: ... , field_name(30), (30), field_value field_name field_value(50).

...
AT LINE-SELECTION. * Cursor information GET CURSOR FIELD field_name VALUE field_value. CASE field_name. WHEN 'SPFLI-CARRID'. SELECT carrname INTO wa_carrname FROM scarr WHERE carrid = spfli-carrid. WRITE: field_value, ':', wa_carrname. ENDSELECT. WINDOW STARTING AT 15 10 ENDING AT 50 15. WHEN 'SPFLI-CONNID'. FORMAT COLOR COL_HEADING. WRITE: spfli-carrid, field_value. SELECT fldate INTO wa_fldate FROM sflight WHERE carrid = spfli-carrid AND connid = spfli-connid. FORMAT RESET. WRITE: /4 wa_fldate. ENDSELECT. WINDOW STARTING AT 15 10 ENDING AT 50 15. ENDCASE.

Page 130

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

System Fields for Interactive Lists


SY-LILLI SY-LILLI 1 1 2 2 3 3 4 4 SY-LINNO SY-LINNO 1 SY-PAGNO SY-PAGNO

5 5 6 6 7 7 8 8
9 9 10 10

1 1 2 2 3 3 4 4

2 SY-CUROW SY-CUROW SY-CUCOL SY-CUCOL 3

SY-CPAGE SY-CPAGE

Basic list
SY-LSIND = 0 SY-LSIND = 0 SY-LISTI = 0 SY-LISTI = 0

DL 1
SY-LSIND = 1 SY-LSIND = 1 SY-LISTI = 0 SY-LISTI = 0

DL 2
SY-LSIND = 2 SY-LSIND = 2 SY-LISTI = 1 SY-LISTI = 1

...

Page 131

IBM / Wistron ERP Project

Copyright IBM Corporation 2005

Business Consulting Services

Question & Answers

Page 132

IBM / Wistron ERP Project

Copyright IBM Corporation 2005