A Usage Type determines the level of exposure of an object at a package interface or a client interface. Usage types are the user's perspective on ways of using an object.
Technically, such a "logical" way of using an object includes certain "technical" ways, i.e. Usage Operations. For example the usage type "derive a subclass" means using the name of the class, allowing references to the class, using public and protected section of the class and using the CLASS ... DEFINITION INHERITING FROM statement.
This example shows the possible usage type for ABAP Objects classes:
- "Access from Friend Classes", "Inheriting", and "Allow Event Handlers FOR ALL INSTANCES" can be set independently of each other
- Each of them implies "Using the PUBLIC SECTION", implies "Referring" and so on.
The following are some examples for actual usage types:
- For transparent tables:
- Only the type of the table line can be used.
- The table's contents can be read.
- The table's content can be modified.
- For classes (ABAP Objects), the above figure shows the implications of various Usage Types on ABAP Classes:
- Naming: The client can use the name of the class (to declare friendship for example).
- Referring: The client can only refer to the class, but cannot access it further. This still allows the client to declare reference variables, or to manage or pass around references to instances of the class.
- Using: The client can only invoke public methods and access public attributes of the class being exposed.
- Deriving: The client can also derive subclasses from the class being exposed.
- For interfaces (ABAP Objects):
- The client can only refer to the interface, but cannot access it further. This still allows the client to declare reference variables, or to manage or pass around references to instances of classes implementing the interface.
- The client can invoke the interface's methods and access the interface's attributes on instances of classes implementing the interface being exposed.
- The client additionally can create classes that implement the interface being exposed.