Show TOC

Creating an Instance of a ContextLocate this document in the navigation structure

 Contexts are obsolete and should not be used. Contexts were introduced in Release 4.0 for high-performance access to frequently required data. Since the introduction of ABAP Objects for Release 4.5, contexts have not been developed further. Since Release 6.40, contexts can be replaced by shared objects .

As objects within ABAP Workbench, contexts store the relationships between data, but not the data itself. In your ABAP programs, you work with instances of contexts. Context instances are the ABAP runtime objects of contexts and contain the actual data.

To create a context instance, you must first declare the context in the program. You do this using the CONTEXTS statement:

Syntax

CONTEXTS c.

The context c must already exist as an object in the development environment. The statement implicitly generates the special data type CONTEXT_c, which you can use to create context instances in a DATA statement:

Syntax

DATA inst TYPE CONTEXT_c.

This statement creates an instance inst of context c. You can create as many number of instances of a context as you wish. Once you have created an instance, you can supply it with keywords (see Supplying Context Instances with Key Values ).

Tip

REPORT rsgcon01.

CONTEXTS demo_travel.

DATA: demo_travel_inst1 TYPE context_demo_travel,      demo_travel_inst2 TYPE context_demo_travel.

This program extract creates two instances of the context demo_travel.