21 Ocak 2011 Cuma

Classic List Processing

The main purpose of a list is to display data with a minimum of programming


efforts. Lists also take the special requirements of business data into account:

• Lists can be designed in multiple languages: Texts and headers appear in the

logon language whenever a corresponding translation is available.

• Lists can display monetary values in the appropriate currency.

The following options are available when programming a list:

• Screen: You can add colors and icons

• Printers

• Internet/Intranet: The system is able to automatically convert to HTML.

• Save: You can save lists within the SAP system as well as outside (for further

processing, for example, using spreadsheet programs).
 
Each list can have a single line list header and up to four lines of column


headers. If no list header is defined, the program title (short description) is used

as the header.

For the initial maintenance of the headlines, you must first activate your program.

Afterwards, create the list by running the program. You can then maintain the

headers directly above your list using the menu System → List → List Header.

The next time you start the program, they will appear in the list automatically.

If you want to change the maintained header (follow-up maintenance), then you

do not have to start the program again and generate the list. Instead, starting

from the editor into which the program is loaded you can get to the maintenance

environment for changing the headers by choosing Goto → Text Elements →

List Headers .
 
The text elements of a program - this also includes the header - can be translated


into different languages. When a user executes a program, relevant text elements

are always automatically displayed in the logon language of the user (automatic

language).

To translate the text elements of your program choose the Menu Goto →

Translation from the ABAP-Editor.
 
In order to design texts in the list body in multiple languages and use the


automatic language, text symbols are used. A text symbol consists of a three-digit

alphanumeric ID xxx as well as a translatable text and, like the headers,

belongs to the text elements of a program. There are two options for defining

text symbols for your program:

• FromtheABAP Editor, choose the menu Goto → Text Elements → Text

Symbols or

• you address the text symbol in your source code using the syntax described

below and double-click its ID (Forward navigation).

From your program, you address a text symbol with TEXT-xxx. At runtime the

text is inserted in the logon language of the user if the appropriate translation

exists (see “translating the text elements” above).

In order to make specifying a text symbol more intuitive you can also use the

following syntax instead of TEXT-xxx: ’...’(xxx). Here, ’...’ should be

the text of the text symbol in the original language of the program.

Hint: Please note that text elements also have to be activated.
The above graphic shows the generation of the basic list as an introduction to


the details list. In addition to the WRITE statement, you can also use SKIP and

ULINE to structure the list. Refer to the ABAP keyword documentation for

these two statements.
 
When the user selects a basic list by means of double-click or function key F2,


the ABAP event AT LINE-SELECTION is triggered. If you want to have the

system display a list with the required detailed information (interactive list) as the

response to this user action, then you must implement this in your program in the

form of a corresponding processing block. There, you can read the data requested

by the user and output them with the WRITE statement. The details list with the

output data, which “overwrites” the basic list, is generated automatically. By

pressing the pushbutton with the “green arrow” or the F3 function key, the user

can return to the basic list and choose another row.

Hint: If an AT LINE-SELECTION block is implemented in the

program, then a pushbutton with the magnifying glass symbol also

appears above the list. Marking the list row and then choosing this button

has the same effect as double-clicking the list row.

The row selection on the detail list also triggers the AT LINE-SELECTION

event. This means that the corresponding processing block in the program is

executed in this case as well. Hence you must be able to determine within this

block on which list the current row selection was made so that you can react

adequately. You can use the sy-lsind system field for this. This field shows

the current list level: “0” for the basic list, “1” for the first details list, and so on.

The above graphic shows the value of sy-lsind and how it is set in each case:

Each row selection automatically increases sy-lsind by 1; each return to the

previous list level reduces sy-lsind by 1. Up to 20 list levels are possible.

The value of sy-lsind should be used to control processing in the AT

LINE-SELECTION block (for example, by means of a CASE statement).

A WRITE statement is always executed on the current list level.

If no details list is generated for a row selection in the AT LINE-SELECTION

block, then sy-lsind is automatically reduced by one. Afterwards, the system

displays the same level where the row selection took place.
The above example program has the following function:


• On the basic list, the text “Basic list” is output followed by the current

sy-lsind value of 0.

• When a basic list row is selected, the text “1st details list” is displayed on the

details list followed by the current sy-lsind value of 1.

• When the user selects a row from the details list, he or she gets a second

details list on which the text “2nd details list” appears followed by the

current sy-lsind value of 2.

• If a line of the seconds details list is selected, sy-lsind is increased to 3

but no further details list is generated. Hence sy-lsind is automatically

reduced by 1 and the second details list is displayed again.
In order to be able to access the key values of the selected row when a basic list

row is selected, you have to implement the following concept:

• Foreach basic list row, the relevant key values are stored in the HIDE area

within the program.

• When a row is selected the data that has been hidden for that particular

row will be made available again.

The row-specific holding of key values in the HIDE area happens by

means of the HIDE statement (here: HIDE: wa_spfli-carrid,

wa_spfli-connid.), which must be executed directly after generating each

basic list row. When the row is selected, the relevant key values are transported

back to the source fields (here: wa_spfli-carrid and wa_spfli-connid)

and the AT LINE-SELECTION event is triggered. The following graphic

illustrates this.

Hint: You do not have to output the HIDE fields with the WRITE

statement first. That means: For each basic list row, you can also store

information that does not appear on the basic list in the HIDE area by

means of the HIDE statement. The HIDE field can also be a “flat”

structure.

Hint: Details lists do not have fixed standard headers like basic lists as


they can be varied dynamically. Hence, you might have to implement

your own headers using WRITE statements.

The following graphic shows the entire AT LINE-SELECTION block of the

example program. In this block, basically data (here: flight schedules) is read

and output by means of the HIDE values that have been transported back to the

source fields.

Hiç yorum yok:

Yorum Gönder