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

DATAreference_name TYPE REF TOclass_name.

WRITE: / ’Authority-Check Error’(001). ENDCASE. | Wa-percentage, ’%’. | Wa_sbook-loccurkey. | SELECT-OPTIONSname FORdata_object. | MESSAGE e045(bc400) WITH pa_car. ENDIF. | CALL SCREEN 100. | CLEAR wa_sbook. | MODULE user_command_100. | SET PF-STATUSand SET TITLEBAR | MODULE status_0100. |


Читайте также:
  1. DATAreference_name TYPE REF TOclass_name.

 

 

When the program is started, a reference variable still has its initial value (“does not point to an instance”). Once it has been used to create an instance, it no longer has the initial value points to that instance.


 

Selection options are defined when you use the

 

CREATE OBJECT reference_name.

 

created an instance of the class that was specified in the definition of the reference variables. Afterwards, the reference variable points to the newly created instance.

 

When you use CREATE OBJECT, you might have to supply the import parameters of the special method CONSTRUCTOR with data. This special method is automatically executed directly after the creation of the instance. With its import parameters, it supplies the corresponding attributes of the new instance with values.

 

You call methods of an instance using the statement

 

CALL METHOD reference_name->method_name.

 

In contrast to calling a function module, the method name alone does not suffice here. You have to specify the relevant instance as well, as it is possible that the program has several instances of that class.

 

 

 

 

 

Figure207:ExampleofStandardClasses:ClassesofEnjoySAPControls

 

 
In addition to the control overview depicted in the above graphic, you should show the participants the menu path Environment → Examples → Control Examples

in the Object Navigator and refer to course BC412.


 

With release 4.6, SAP has shipped many EnjoySAP Controls, with which you can design screens more ergonomically and interestingly. The above graphic shows a selection of these controls:

 

• Grid Control: To display an internal table on a screen with many interesting functions such as sort, filter, total and others.

• Picture Control: To display a picture on the screen

• HTML-Viewer Control: To display an HTML file or Web page on the screen

• Tree Control: To depict a hierarchical list in the form of a tree structure on the screen

 

The controls are addressed by using the classes and methods that are shipped in the SAP standard system. In the following, we will use class CL_GUI_ALV_GRID as an example of the reuse of existing classes in order to address the most interesting and popular ALV Grid Control.

 

For detailed information on all EnjoySAP controls as well as interactions between them, refer to course BC412.

 

 

 

 

Figure 208: Application Example: ALV Grid Control

 

ALV Grid Control, also called SAP List Viewer (ALV) is used for displaying an internal table on a screen. It has numerous user functions.

 

On the screen, the user can vary the width of the columns, or the width can be automatically adjusted to the current data. The display position of the columns can also be changed by means of drag-and-drop.


 

The standard pushbuttons of the control can be used to execute, amongst others, the following functions:

 

The detailed display shows the fields which were previously selected with the cursor in a modal dialog window.

The sorting function provides the user with the option of specifying complex sorting criteria for the columns.

Within the selected area, you can use the search function for searching for a character string in rows or columns.

You can form totals for one or each of several numerical columns. You can then use the Subtotals function to set up control level lists. Select the non-numeric columns that you want to use before choosing this function and the corresponding control level totals are displayed.

You can also Print and Download with the corresponding pushbuttons.

The user can save his or her settings in the Grid Control as a display variant and reuse them at a later time.

 

 

 

 

Figure 209: Runtime Architecture of the SAP Grid Control

 

An EnjoySAP Control must always be embedded in a SAP Container Control (from now on referred to as container). The container must be integrated into a prepared control area on the screen. (See the left part of the above graphic)


 

In order to implement the Grid Control and the container from a GUI perspective, corresponding instances have to be created as substitutes within the program.

You can use these instances to address the elements in the GUI. To do so, your SAP system has standard classes from which you can generate the container and grid control instance.

 

 

 

 

 

Figure 210: Classes for Accessing Containers and Grid Controls

 

When you create an instance, the class-specific constructor (special method CONSTRUCTOR of the class) is called implicitly. The task of this method is to use its own input parameters to fill the attributes of the instance to be created. Hence, you must supply the required import parameters of the constructor with values when you create an instance (CREATE OBJECT).


 

 

 

 
Figure 211: The CONSTRUCTOR Method of the Container Class

 

To obtain detailed information on a global class or method, you can navigate to the Class Builder:

 

Display the object list of the class in the navigation area of the Object Navigator. Double-clicking on the class takes you to the detailed display in the Class Builder. (Alternatively, you can also go to the Class Builder by double-clicking the class names from within an ABAP program.) Select the required method with the cursor and press the Parameter pushbutton to display the interface parameters of the method.

 

Method CONSTRUCTOR of global class CL_GUI_CUSTOM_CONTAINER (class for the container) has the required parameter CONTAINER_NAME. Hence, as a minimum, this parameter has to be supplied with data when the container instance is created, namely with the name of the control area available on the screen.


 

 

 
Figure 212: Important Methods for the Grid Control Class

 

Global class CL_GUI_ALV_GRID has numerous methods that can be called for the corresponding grid control functions. To display the contents of an internal table with an ALV Grid Control, it suffices to know details about the following three methods:

 

CONSTRUCTOR

The grid class, too, has a constructor. The only required parameter is i_parent, to which the already created container instance (in the form of a pointer) has to be transferred (when the grid control instance is created).

 


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


<== предыдущая страница | следующая страница ==>
MESSAGE e149(bc400). ENDIF.| REFRESH_TABLE_DISPLAY

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