Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АрхитектураБиологияГеографияДругоеИностранные языки
ИнформатикаИсторияКультураЛитератураМатематика
МедицинаМеханикаОбразованиеОхрана трудаПедагогика
ПолитикаПравоПрограммированиеПсихологияРелигия
СоциологияСпортСтроительствоФизикаФилософия
ФинансыХимияЭкологияЭкономикаЭлектроника

SELECT-OPTIONSname FORdata_object.

Pa_int1 TYPE i, pa_op(1) TYPE c, pa_int2 TYPE i. | DATA result TYPE p DECIMALS 2. | ENDLOOP. ENDIF. | Wa_flight-seatsocc / wa_flight-seatsmax. | INSERT wa_flight INTO TABLE it_flight. | ID ’ACTVT’ FIELD ’02’. | WRITE: / ’Authority-Check Error’(001). ENDCASE. | Wa-percentage, ’%’. | CALL SCREEN 100. | CLEAR wa_sbook. |


Читайте также:
  1. SELECT-OPTIONSname FORdata_object.

 

statement, where name is the name of the select option and data_object is an already defined variable. Such a definition creates an internal table of the specified name within the program (here so_car) and generates a selection screen with an input option for limiting the specified variable (here: wa_spfli-carrid).

 

User entries are transported to the automatically generated internal table when Execute is chosen. This table always has four columns: sign, option, low, and high. The above graphic shows, which entries are created for which user input:

 

• If ’LH’ is entered, a row is generated with the values ’I’ (inclusive), ’EQ’ (equal), ’LH’ and Space.

• If the interval ’AA’ to ’DL’ is entered, a row is generated with the values

’I’ (inclusive), ’BT’ (between), ’AA’ and ’DL’.

• If ’BA’ is entered as the single value to be excluded, a row is generated with the values ’E’ (exclusive), ’EQ’ (equal), ’BA’ and Space.

 

The internal table filled with the entered selection criteria can be used for the database selection, as illustrated in the graphic. The table content is interpreted as follows:

 

If I_1,..., I_n and E_1,..., E_m are the inclusive/exclusive conditions of the internal table, then the following composite condition is used to limit the data selection:


 

( I_1 OR... OR I_n ) AND (NOT E_1 ) AND... AND (NOT E_m )

 

If the table is empty because there are no restrictions, the WHERE conditions always applies to the respective field.

 

Hint: The IN operator can also be used in logical expressions:

 

IF wa_spfli-carrid IN so_car.

 

For defining a selection option, the same three particularities apply as for the

PARAMETERS statement (see above).

 

If the internal table of the selection option is filled using the DEFAULT addition or APPEND statement before the selection screen is displayed (INITIALIZATION, then its content is displayed on the selection screen as suggested conditions that can be overwritten.

 

For further details, refer to the keyword documentation for SELECT-OPTIONS.

 

 

Event after the Selection Screen

 

 

 

 

Figure 150: AT SELECTION-SCREEN Event


 

On the selection screen the AT SELECTION-SCREEN event is triggered both by choosing Enter as well as Execute (F8). After the corresponding processing block has been processed, the following START-OF-SELECTION event is triggered and the relevant processing started, if Execute was used. However, if Enter was chosen, the selection screen is displayed again.

 

 

 

 

Figure 151: Error Dialogs in AT SELECTION-SCREEN

 

Immediately before processing the AT SELECTION-SCREEN block, the user entries are automatically transferred to the corresponding variables in the program. Hence, it makes sense to implement required input and authorization checks in this processing block. If the check result is negative, you can simply send out an error message to the user and have the selection screen displayed again. The user then has then option of making new entries.

 

In contrast, an error message in the START-OF-SELECTION block would be displayed under program termination.

 

The following graphic illustrates a simple example program with authorization check and error dialog on the selection screen.


 

 

 

 
Figure 152: Syntax Example: Authorization Check with Error Dialog

 

Additional information can be found in the keyword documentation for “AT SELECTION-SCREEN”.


 

 

243 Exercise 13: Selection Screen

 

Exercise Duration: 30 Minutes

 

 

Exercise Objectives

 

After completing this exercise, you will be able to:

• Use the ABAP statement SELECT-OPTIONS to implement a complex selection criterion on the selection screen

• Use complex restrictions for database selections

• Program error dialogs using the standard selection screen

 

 

Business Example

 

On the selection screen, users should be able to enter complex restrictions for the database selection instead of a single value.

 

Furthermore, the selection screen should be displayed again with a corresponding error message when the user does not have the authorization for the requested data.

 

System Data

 

System: Will be assigned Client: Will be assigned User ID: Will be assigned Password: Will be assigned

Set up instructions: No special instructions when using a standard training system

 

Task 1:

 

Define and use selection options.

 

1. Copy your program ZBC400_##_DETAIL_LISTor the corresponding template SAPBC400UDS_DETAIL_LIST to the new program ZBC400_##_SEL_SCREEN.

 

2. On your selection screen, make it possible to enter complex restrictions for the connection number (CONNID).

 

Hint: When you assign a type to the airline and the connection number, refer to fields of the same structure, so that the user gets context-sensitive search helps.

 

3. Use the restrictions entered by the user for the selection from the database table SFLIGHT.

 

Continued on next page


 

Task 2:

 

Implement an authorization check with an error dialog on the selection screen

 

1. Change your program in such a way that, in case of a missing authorization for the airline entered, an appropriate error message is sent and the selection screen is displayed again for re-entry.

 

Hint: Message class BC400 already contains a suitable message, which you can use.


 

Solution 13: Selection Screen

 

Task 1:

 

Define and use selection options.

 

1. Copy your program ZBC400_##_DETAIL_LISTor the corresponding template SAPBC400UDS_DETAIL_LIST to the new program ZBC400_##_SEL_SCREEN.

 

a) Carry out this step as usual.

 

2. On your selection screen, make it possible to enter complex restrictions for the connection number (CONNID).

 

Hint: When you assign a type to the airline and the connection number, refer to fields of the same structure, so that the user gets context-sensitive search helps.

 

a) See source code excerpt in the model solution.

 

3. Use the restrictions entered by the user for the selection from the database table SFLIGHT.

 

a) See source code excerpt in the model solution.

 

Task 2:

 

Implement an authorization check with an error dialog on the selection screen

 

1. Change your program in such a way that, in case of a missing authorization for the airline entered, an appropriate error message is sent and the selection screen is displayed again for re-entry.

 

Hint: Message class BC400 already contains a suitable message, which you can use.

 

a) See source code excerpt in the model solution.

 

Result

 

Source code excerpt: SAPBC400UDS_SEL_SCREEN

 

 

REPORT sapbc400uds_sel_screen.

 

 

CONSTANTS actvt_display TYPE activ_auth VALUE ’03’.

 

 


DATA: wa_flight TYPE sbc400focc,


 

Continued on next page


 

 

wa_sbook TYPE sbook.

 

 

PARAMETERS pa_car LIKE wa_flight-carrid.

 

 


Дата добавления: 2015-11-16; просмотров: 76 | Нарушение авторских прав


<== предыдущая страница | следующая страница ==>
Wa_sbook-loccurkey.| MESSAGE e045(bc400) WITH pa_car. ENDIF.

mybiblioteka.su - 2015-2024 год. (0.014 сек.)