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

Message e149(bc400). Endif.

ID ’ACTVT’ FIELD ’02’. | 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 |


Читайте также:
  1. Ads and Messages
  2. Answering Machine Messages
  3. Chapter 6. Massage and message
  4. ENDLOOP. ENDIF.
  5. Error Messages
  6. Getting the message
  7. III. Effective speakers learn to control their voices to enhance the impact of their message.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT


 

LessonSummary

You should now be able to:

• Search for function modules

• Acquire information on the functionality and use of function modules

• Call a function module in your program


 


Lesson:

331


Working with Methods

 

Lesson Duration: 80 Minutes

 

 

Lesson Overview

 

SAP provides many functions in the SAP system as classes or methods. In this lesson, you will learn about some basic object-oriented syntax elements of ABAP objects using the ALV List Viewer as an example. You can use the List Viewer to display an internal table graphically formatted on a screen.

 

This lesson is not intended to provide you with in-depth knowledge on programming the ALV List Viewer, but rather to provide a brief introduction to the benefits of existing classes and methods.


 

 

LessonObjectives

After completing this lesson, you will be able to:

 

• Execute the basic steps in object-oriented ABAP programming (instantiation and method calls) to use the classes and methods shipped in the SAP standard system.

• Use the SAP Grid Control (ALV List Viewer) to display an internal table on a screen

 

 

 
The didactic concept of this course — maximum use with minimum effort

— should also be emphasized in this lesson. Therefore, the subject of object orientation will only be discussed in as much detail as is required for a user of the predefined components.

 

At this point, it is certainly worth mentioning the follow-up course BC401, which provides a complete introduction to object orientation. Participants wanting to find out more about control programming should be referred to course BC412.

 

However, it should become clear that object-oriented programming is not mandatory in ABAP, but is used in some standard SAP applications.

 

Business Example

 

You want to use the standard functions in your program that are encapsulated in global classes.


 

Working with Methods

 

 

 

 

Figure 205: Classes and Objects

 

A class is a formal description of objects (instances). You can create several instances of a class at runtime, each of which will have its own attributes and methods. You can access the corresponding attributes of the affected instance by calling an instance method.

 

Let's take flight bookings as an easy-to-follow example. Each instance of this class corresponds to an actual booking and has its own booking-specific attributes such as booking ID, booking date, cancellation flag, and so on. A method of a booking instance could, for example, execute the cancellation of the booking.

The call of this method of an actual booking instance would then change the corresponding attribute of the booking, the “cancellation flag”.

 

Classes can be defined either locally within a program or globally in the class library.


 

SAP has shipped many global classes with methods that encapsulate the required functionality for reusability. Hence, these classes and methods also belong to

the reuse components.

 

Hint: SAP has extended the ABAP language with object-oriented syntax elements (ABAP Objects) since release 4.6. However, due to time restrictions, not all of them can be dealt with in this course. This

lesson will only illustrate the basic steps in order to enable you to use the classes and methods shipped by SAP. For more detailed information on object-oriented programming refer to course BC401.

 

 

 

 

 

Figure 206: Creating Objects and Calling Methods

 

As instances do not have names, you have to define reference variables in order to be able to generate and address instances of classes. They are pointers that can be directed to corresponding instances. Reference variables each have a name that can be used to address the corresponding instance.

 

Reference variables are defined using:

 


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


<== предыдущая страница | следующая страница ==>
MODULE status_0100.| DATAreference_name TYPE REF TOclass_name.

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