You are on page 1of 31

Select Single and Select up to

Select single statement only selects the first record of any series of records from a database
table. That means this statement can read a single record from a database table. It keeps the
data into a work area or header line. This work area is generally a line type of internal table.
In below example we are fetching records of PO no, item no, material, plant & storage location
from table EKPO where the PO no is 3000000232. The database contains only 3 items for this
PO.

REPORT

zabap_gui.

TABLES: ekpo.
* Creating a custom structure of Item Table
TYPES:
BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
END OF ty_ekpo.
* Creating a line type of predefined structure
DATA:
wa_ekpo TYPE ty_ekpo.
* Select single will fetch only the First record
* from the PO Item table
SELECT SINGLE ebeln ebelp matnr werks lgort
FROM ekpo INTO wa_ekpo
WHERE ebeln = '3000000232'.
WRITE:/

'PO No.',
15 'Item No',
28 'Material',
48 'Plant',
55 'Storage'.

ULINE.
SKIP.
WRITE:/

wa_ekpo-ebeln,
15 wa_ekpo-ebelp,
28 wa_ekpo-matnr,

48 wa_ekpo-werks,
55 wa_ekpo-lgort.

Output of this:

The database contains 3 records here. But select single statement fetches only single record
from database. Here the first record is always fetched by this statement.

Select up to statement is used to mention the rows need to be selected from the database table.
If the database contains that number of rows then it will display accordingly. Here we are
declaring an internal table to store the multiple row records and print the output as well.
REPORT

zabap_gui.

TABLES: ekpo.
* Creating a custom structure of Item Table
TYPES:
BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,

END OF ty_ekpo.
* Creating a line type of predefined structure
DATA:
wa_ekpo TYPE ty_ekpo,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo.
* Select up to n rows fetches n rows
* from the PO Item table
SELECT ebeln ebelp matnr werks lgort
UP TO 5 ROWS
FROM ekpo INTO TABLE it_ekpo
WHERE ebeln = '3000000232'.
WRITE:/

'PO No.',
15 'Item No',
28 'Material',
48 'Plant',
55 'Storage'.

ULINE.
SKIP.
LOOP AT it_ekpo INTO wa_ekpo.
WRITE:/
wa_ekpo-ebeln,
15 wa_ekpo-ebelp,
28 wa_ekpo-matnr,
48 wa_ekpo-werks,
55 wa_ekpo-lgort.
ENDLOOP.

Output of this:

Since there are only three records in database, the system shows only 3 records in spite of
being mentioned UP TO 5 ROWS.

Select Distinct
Select distinct only selects the unique entries of the fields in the select statement. It will not allow any
duplicate entry into the internal table. In the below example we are having a selection screen where we
are defining a selection range of PO number by select option. At first we are fetching the records with
normal select statement and we find six records from the database.
REPORT

zabap_gui.

TABLES: ekpo.
* Creating a custom structure of Item Table
TYPES:
BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
END OF ty_ekpo.
* Creating a line type of predefined structure
DATA:
wa_ekpo TYPE ty_ekpo,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo.
SELECT-OPTIONS: s_ebeln FOR ekpo-ebeln.

SELECT ebeln ebelp matnr werks lgort


FROM ekpo INTO TABLE it_ekpo
WHERE ebeln IN s_ebeln.
WRITE:/
15
28
48
55

'PO No.',
'Item No',
'Material',
'Plant',
'Storage'.

ULINE.
SKIP.
LOOP AT it_ekpo INTO wa_ekpo.
WRITE:/
wa_ekpo-ebeln,
15 wa_ekpo-ebelp,
28 wa_ekpo-matnr,
48 wa_ekpo-werks,
55 wa_ekpo-lgort.
ENDLOOP.
Selection Range with select option:

The output is:

Now with the similar selection range we use select distinct statement and we are getting only three
records. This is because we have selected only the PO number in select statement with distinct clause.
Now distinct will not allow any duplicate entry of PO number.
REPORT

zabap_gui.

TABLES: ekpo.
* Creating a custom structure of Item Table
TYPES:
BEGIN OF ty_ekpo,

ebeln TYPE ekpo-ebeln,


END OF ty_ekpo.
* Creating a line type of predefined structure
DATA:
wa_ekpo TYPE ty_ekpo,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo.
SELECT-OPTIONS: s_ebeln FOR ekpo-ebeln.
SELECT DISTINCT ebeln
FROM ekpo INTO TABLE it_ekpo
WHERE ebeln IN s_ebeln.
WRITE:/
ULINE.
SKIP.

'PO No.'.

LOOP AT it_ekpo INTO wa_ekpo.


WRITE:/
wa_ekpo-ebeln.
ENDLOOP.
Hence the output is as follows.

Here we know that one PO can have multiple items. Hence in database table EKPO the PO entries are
having duplicate entries for different items. But selecting the PO number with distinct clause will fetch only
the unique PO number from the database. If we select here the item also with the distinct clause the SAP
system will treat both of those fields as unique. In that case the system will recognize PO number and
corresponding item number is the unique. In this way if we increase the fields in selection the system will
give uniqueness according to the combination of all those selected fields.

Select Distinct
Select distinct only selects the unique entries of the fields in the select statement. It will not
allow any duplicate entry into the internal table. In the below example we are having a selection
screen where we are defining a selection range of PO number by select option. At first we are
fetching the records with normal select statement and we find six records from the database.
REPORT

zabap_gui.

TABLES: ekpo.
* Creating a custom structure of Item Table
TYPES:
BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
END OF ty_ekpo.
* Creating a line type of predefined structure
DATA:
wa_ekpo TYPE ty_ekpo,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo.
SELECT-OPTIONS: s_ebeln FOR ekpo-ebeln.
SELECT ebeln ebelp matnr werks lgort
FROM ekpo INTO TABLE it_ekpo
WHERE ebeln IN s_ebeln.
WRITE:/

'PO No.',
15 'Item No',
28 'Material',
48 'Plant',
55 'Storage'.

ULINE.
SKIP.
LOOP AT it_ekpo INTO wa_ekpo.
WRITE:/
wa_ekpo-ebeln,
15 wa_ekpo-ebelp,

28 wa_ekpo-matnr,
48 wa_ekpo-werks,
55 wa_ekpo-lgort.
ENDLOOP.

Selection Range with select option:

The output is:

Now with the similar selection range we use select distinct statement and we are getting only
three records. This is because we have selected only the PO number in select statement with
distinct clause. Now distinct will not allow any duplicate entry of PO number.
REPORT

zabap_gui.

TABLES: ekpo.
* Creating a custom structure of Item Table
TYPES:
BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln,
END OF ty_ekpo.
* Creating a line type of predefined structure
DATA:
wa_ekpo TYPE ty_ekpo,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo.
SELECT-OPTIONS: s_ebeln FOR ekpo-ebeln.
SELECT DISTINCT ebeln
FROM ekpo INTO TABLE it_ekpo
WHERE ebeln IN s_ebeln.
WRITE:/

'PO No.'.

ULINE.
SKIP.
LOOP AT it_ekpo INTO wa_ekpo.
WRITE:/
ENDLOOP.

wa_ekpo-ebeln.

Hence the output is as follows.

Here we know that one PO can have multiple items. Hence in database table EKPO the PO
entries are having duplicate entries for different items. But selecting the PO number with distinct
clause will fetch only the unique PO number from the database. If we select here the item also
with the distinct clause the SAP system will treat both of those fields as unique. In that case the
system will recognize PO number and corresponding item number is the unique. In this way if
we increase the fields in selection the system will give uniqueness according to the combination
of all those selected fields.

Select with Appending


We can directly append records into an internal table with select statement by using
APPENDING clause. Syntax is as follows.
SELECT db_field1, db_field2,
FROM db_table APPENDING TABLE internal_table
WHERE db_field = condition.

Where is optional. By using APPENDING clause we can re-select and fetch another sort of
records into the same internal table. Here the system appends the records to the last position of
the internal table. After appending these records when we write the data then it will come one by
one (not in the same row).

In below example at first we have selected PO number. So the system will append the PO
numbers only. After that in the second select the system will select the materials and append
those to the last position of the internal table and so on.
REPORT

zabap_gui.

TABLES: ekpo.
* Creating a custom structure of Item Table
TYPES:
BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
END OF ty_ekpo.
* Creating a line type of predefined structure
DATA:
wa_ekpo TYPE ty_ekpo,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo.
REFRESH it_ekpo.
SELECT ebeln
FROM ekpo APPENDING TABLE it_ekpo
WHERE ebeln = '3000000232'.
SELECT matnr
FROM ekpo APPENDING TABLE it_ekpo
WHERE ebeln = '3000000232'.
SELECT werks
FROM ekpo APPENDING TABLE it_ekpo
WHERE ebeln = '3000000232'.
SELECT lgort
FROM ekpo APPENDING TABLE it_ekpo
WHERE ebeln = '3000000232'.
LOOP AT it_ekpo INTO wa_ekpo.

WRITE:/

wa_ekpo-ebeln,
wa_ekpo-matnr,
wa_ekpo-werks,
wa_ekpo-lgort.

ENDLOOP.

The output is like this. One by one record will come for same row information.

We can use CORRESPONDING FIELDS OF statement also.


SELECT db_field1, db_field2,
FROM db_table
APPENDING CORRESPONDING FIELDS OF TABLE internal_table
WHERE db_field = condition.

In this case the output will come with the corresponding fields. The system will put the
respective data on the respective fields of the output screen. But the records will come one by
one (different rows) rather the same row.
REPORT

zabap_gui.

TABLES: ekpo.
* Creating a custom structure of Item Table
TYPES:
BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
END OF ty_ekpo.
* Creating a line type of predefined structure
DATA:
wa_ekpo TYPE ty_ekpo,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo.
REFRESH it_ekpo.
SELECT ebeln
FROM ekpo APPENDING CORRESPONDING FIELDS OF TABLE it_ekpo
WHERE ebeln = '3000000232'.
SELECT matnr
FROM ekpo APPENDING CORRESPONDING FIELDS OF TABLE it_ekpo
WHERE ebeln = '3000000232'.
SELECT werks
FROM ekpo APPENDING CORRESPONDING FIELDS OF TABLE it_ekpo
WHERE ebeln = '3000000232'.

SELECT lgort
FROM ekpo APPENDING CORRESPONDING FIELDS OF TABLE it_ekpo
WHERE ebeln = '3000000232'.
LOOP AT it_ekpo INTO wa_ekpo.
WRITE:/

wa_ekpo-ebeln,
wa_ekpo-matnr,
wa_ekpo-werks,
wa_ekpo-lgort.

ENDLOOP.

The output is like this.

Average Sum Maximum Minimum by Select


We can calculate the average and sum of any quantity type field directly from select statement. Similarly
we can extract the maximum value or minimum value from quantity type field. In the below example the
system fetches the data of MENGE field from EKPO table and calculate its average and sum and then put
into the packed type variable average & sum respectively. Similarly it fetches the maximum and
minimum values from MENGE and put it packed type variable maximum & minimum. Here the WHERE
clause is optional. To avoid the entire field records we have used this clause.
In the database we find this MENGE field with PO number '3000000057'.

REPORT

zabap_gui.

DATA:
average
sum
maximum
minimum

TYPE
TYPE
TYPE
TYPE

p
p
p
p

DECIMALS
DECIMALS
DECIMALS
DECIMALS

2,
2,
2,
2.

* Here the MENGE field of EKPO table has been used


* to calculate the average, sum, maximum & minimum
SELECT AVG( menge )
SUM( menge )
MAX( menge )
MIN( menge )
FROM ekpo
INTO (average, sum, maximum, minimum)
WHERE ebeln = '3000000057'.
WRITE: /
/
/
/

'Average
'Sum
'Maximum
'Minimum

Here is the output.

=
=
=
=

',
',
',
',

average,
sum,
maximum,
minimum.

Client Specified Select


Client specified clause switches off the automatic client handling by open SQL. If we select the
MANDT (client) field then we have to use client specified clause like follows:
SELECT mandt field1 field2 ... fieldn
INTO TABLE internal_table FROM database_table
CLIENT SPECIFIED

"MANDT has been selected


"hence client specified is must

WHERE mandt = '800'


AND field1 IN select_option.

This statement is always mentioned after the FROM clause. If the addition CLIENT SPECIFIED
is specified, but the client ID in the WHERE condition is not mentioned, the SELECT statement
circumvents the SAP buffering.
REPORT

zabap_gui.

TABLES: kna1.
* Local structure for local internal table
* and work area
TYPES:
BEGIN OF ty_kna1,
mandt TYPE kna1-mandt,
kunnr TYPE kna1-kunnr,
land1 TYPE kna1-land1,
name1 TYPE kna1-name1,
ort01 TYPE kna1-ort01,
pstlz TYPE kna1-pstlz,
regio TYPE kna1-regio,
END OF ty_kna1.
* Local internal table & work area
DATA:
it_kna1 TYPE TABLE OF ty_kna1,
wa_kna1 TYPE ty_kna1.
* Selection range by select option internal table
SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.
START-OF-SELECTION.
* Selection of the specific fields

SELECT mandt kunnr land1 name1 ort01 pstlz regio


INTO TABLE it_kna1 FROM kna1
CLIENT SPECIFIED

"MANDT has been selected


"hence client specified is must

WHERE mandt = '800'


AND kunnr IN s_kunnr.
IF sy-subrc = 0.
WRITE:/

'Clnt',
5 'Customer No',
14 'Country',
24 'Name',

60 'City',
100 'Postal',
112 'Region'.
ULINE.
SKIP.
LOOP AT it_kna1 INTO wa_kna1.
WRITE:/
wa_kna1-mandt,
5 wa_kna1-kunnr,
14 wa_kna1-land1,
24 wa_kna1-name1,
60 wa_kna1-ort01,
100 wa_kna1-pstlz,
112 wa_kna1-regio.
ENDLOOP.
ENDIF.

Here is the output.

Bypassing Buffer in Select


One of an important feature of open SQL is that it fetches the data records from the buffer of
SAP system. Now fetching records directly from database may take time. Hence performance
will go down. Thats why SQL fetches data from buffer.
Now if the database table changes frequently (table like transaction table) then it will be a
problem to select updated data which will not be present in buffer. To avoid this problem SAP
system has introduced the BYPASSING BUFFER clause in the select statement after from
clause. This statement ensures that the records are updated data records fetched from the
database.
REPORT

zabap_gui.

TABLES: kna1.
* Local structure for local internal table
* and work area
TYPES:
BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr,
land1 TYPE kna1-land1,
name1 TYPE kna1-name1,
ort01 TYPE kna1-ort01,
pstlz TYPE kna1-pstlz,
regio TYPE kna1-regio,
END OF ty_kna1.
* Local internal table & work area

DATA:
it_kna1 TYPE TABLE OF ty_kna1,
wa_kna1 TYPE ty_kna1.
* Selection range by select option internal table
SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.
START-OF-SELECTION.
* Selection of the specific fields
SELECT kunnr land1 name1 ort01 pstlz regio
INTO TABLE it_kna1 FROM kna1
BYPASSING BUFFER "it ensures that the system fetches
"data directly from the database
"not from the buffer
WHERE kunnr IN s_kunnr.
IF sy-subrc = 0.
WRITE:
/5 'Customer No',
14 'Country',
24 'Name',
60 'City',
100 'Postal',
112 'Region'.
ULINE.
SKIP.
LOOP AT it_kna1 INTO wa_kna1.
WRITE:
/5 wa_kna1-kunnr,
14 wa_kna1-land1,
24 wa_kna1-name1,
60 wa_kna1-ort01,
100 wa_kna1-pstlz,
112 wa_kna1-regio.
ENDLOOP.
ENDIF.

Here is the output.

Select Dynamic Column


We can select the columns dynamically in a select statement. The syntax is like this:
SELECT (local_internal_table)
FROM database_table INTO TABLE internal_table.

Here the local internal table contains the field names dynamically. This table also has a line type
which holds the data of field names like this.
DATA: line TYPE char100,
itab TYPE TABLE OF line.
line = 'ebeln ebelp matnr werks lgort'.
APPEND line TO itab.

Now after appending the text to the itab it can be used dynamically in select statement. Here the
WHERE clause is optional. If we dont use it then the total rows/records of the fields will have
been fetched by the system.
REPORT

zabap_gui.

TABLES: ekpo.
* Creating a custom structure of Item Table
TYPES:
BEGIN OF ty_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
matnr TYPE ekpo-matnr,
werks TYPE ekpo-werks,
lgort TYPE ekpo-lgort,
END OF ty_ekpo.
* Creating a line type of predefined structure
DATA:
wa_ekpo TYPE ty_ekpo,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo,
* Creating a line type and internal table
* to use as dynamic columns specification
line TYPE char100,
itab TYPE TABLE OF line.
line = 'ebeln ebelp matnr werks lgort'.
APPEND line TO itab.
SELECT (itab)
FROM ekpo INTO TABLE it_ekpo
WHERE ebeln = '3000000232'.
WRITE:/

'PO No.',
15 'Item No',
28 'Material',
48 'Plant',
55 'Storage'.

ULINE.
SKIP.

LOOP AT it_ekpo INTO wa_ekpo.


WRITE:/
wa_ekpo-ebeln,
15 wa_ekpo-ebelp,
28 wa_ekpo-matnr,
48 wa_ekpo-werks,
55 wa_ekpo-lgort.
ENDLOOP.

Here is the output.

Group By
Group By clause categorizes and summarizes the lines of database table based on a single
field. That single field is mentioned in the group by clause. We can use multiple fields in the
group by clause also. Here the database table records will be summarized according to those
fields.
The fields mentioned in the group by clause cannot be specified for the aggregate function. We
have to use other fields which are not specified in group by clause to calculate the aggregate
function. Now we have the a PO with the following quantity.

REPORT

zabap_gui.

DATA:
ebeln TYPE ekpo-ebeln,
po_max TYPE p DECIMALS 2,
po_min TYPE p DECIMALS 2,
tq_max TYPE p DECIMALS 2,
tq_min TYPE p DECIMALS 2.
WRITE:/

'PO No',
15 'Max PO Quantity',
35 'Min PO Quantity',
55 'Max Target',
70 'Min Target'.

SELECT ebeln
MAX( menge ) MIN( menge )
MAX( ktmng ) MIN( ktmng )
FROM ekpo
INTO (ebeln,
po_max, po_min,
tq_max, tq_min)
GROUP BY ebeln.
WRITE:/

ebeln,
15 po_max,
35 po_min,
55 tq_max,
70 tq_min.

ENDSELECT.

Here is the output:

Using Cursor in ABAP


A cursor is a database object which is used to manipulate data in a set of row by row. We can
say that a cursor is a set of rows with a pointer and this pointer actually points to the current
row. Since cursor works row by row, it actually kills the performance. So it is better to go with
another way with the help ABAP logic. In ABAP we use cursor with the following four processes.

Declare the Cursor:


The cursor is declared by the DATA statement with keyword CURSOR.

Open Cursor Statement:


Open cursor opens a database cursor for a specific selection, defined after FOR.
It links the cursor variable (cr_spfli) to the database cursor.
If the cursor variable is already opened then it cannot be reopened.
The statement takes the cursor position at the first row of the resulting set.
The select statement declared after FOR doesnt enter any record into any table or work area.
Select single statement cannot be used here.
Only a limited number of database cursor can be open at the same time.
Open cursor actually initialize the cursor at the first position of database.
Fetch Next Cursor Statement:
It extracts the requested rows from the database.
We can enter the fetched data into a table or work area. The append work can also be done
here.
It changes the position of the database cursor to the next line to be extracted.
System can fetch one or more data records by this statement.
Sy-subrc will be zero when the system fetches data.
When the cursor is at the last position of rows then the next cursor will cause sy-subrc = 4.
Because no line will be extracted further.
Close Cursor Statement:
It closes the database cursor and initializes the cursor variable.
We should close all the open database cursor if they are no longer required.
Once the cursor is closed it no longer is accessed.
In the following example we have demonstrated a program where cursor has been used.
REPORT

zsr_test NO STANDARD PAGE HEADING.

TABLES spfli.
DATA: wa_spfli TYPE spfli.
"Declare cursor
data: cr_spfli TYPE cursor.
PARAMETERS p_from TYPE spfli-countryfr.
"Open Cursor
OPEN CURSOR cr_spfli FOR SELECT *
FROM spfli WHERE countryfr = p_from.
IF sy-subrc = 0.
WRITE: /

'Airline',

10 'Flight Number',
30 'Country From',
45 'City From',
66 'Departure airport',
86 'Country To',
100 'City To',
121 'Destination airport',
142 'Departure time',
160 'Arrival time',
175 'Distance'.
ULINE.
SKIP.
ENDIF.
DO.
"Fetch Next Cursor
FETCH NEXT CURSOR cr_spfli
INTO wa_spfli.
IF sy-subrc = 0.
CHECK wa_spfli-countryfr = p_from.
WRITE: /3 wa_spfli-carrid,
10 wa_spfli-connid,
30 wa_spfli-countryfr,
45 wa_spfli-cityfrom,
66 wa_spfli-airpfrom,
86 wa_spfli-countryto,
100 wa_spfli-cityto,
121 wa_spfli-airpto,
142 wa_spfli-deptime,
160 wa_spfli-arrtime,
175 wa_spfli-distance.
ELSE.
EXIT.
ENDIF.
ENDDO.
"Close Cursor
CLOSE CURSOR cr_spfli.

The output is as follows.

This program can be done in another way as follows.


REPORT

zsr_test NO STANDARD PAGE HEADING.

TABLES spfli.
DATA: wa_spfli TYPE spfli,
it_spfli TYPE TABLE OF spfli.
"Declare Cursor
DATA: cr_spfli TYPE cursor.
PARAMETERS p_from TYPE spfli-countryfr.
"Open Cursor
OPEN CURSOR cr_spfli FOR SELECT *
FROM spfli WHERE countryfr = p_from.
"Fetch Cursor
FETCH NEXT CURSOR cr_spfli
INTO TABLE it_spfli.

IF sy-subrc = 0.
WRITE: / 'Airline',
10 'Flight Number',
30 'Country From',
45 'City From',
66 'Departure airport',
86 'Country To',
100 'City To',
121 'Destination airport',
142 'Departure time',
160 'Arrival time',
175 'Distance'.
ULINE.
SKIP.
LOOP AT it_spfli INTO wa_spfli.
WRITE: /3 wa_spfli-carrid,
10 wa_spfli-connid,
30 wa_spfli-countryfr,
45 wa_spfli-cityfrom,
66 wa_spfli-airpfrom,
86 wa_spfli-countryto,
100 wa_spfli-cityto,
121 wa_spfli-airpto,
142 wa_spfli-deptime,
160 wa_spfli-arrtime,
175 wa_spfli-distance.
ENDLOOP.
ENDIF.
"Close Cursor
CLOSE CURSOR cr_spfli.

The output is similar as before.

You might also like