Entering content frame

Creating an Instance of a Context Locate the document in its SAP Library structure

Caution Contexts are obsolete and should not be used. Contexts were introduced for Release 4.0 for good-performing access to data frequently required. 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 Structure linkshared objects.

 

As objects within the ABAP Workbench, contexts store the relationships between data, but no data itself. In your ABAP programs, you work with instances of contexts. These are runtime instances of contexts containing the actual data.

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

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).

Example

REPORT rsgcon01.

CONTEXTS demo_travel.

DATA: demo_travel_inst1 TYPE context_demo_travel,
      demo_travel_inst2 TYPE context_demo_travel.

This program extract generates two instances of the context demo_travel.

 

 

Leaving content frame