Entering content frameCreating an Instance of a Context Locate the document in its SAP Library structure

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 CONTEXTS statement:

Syntax

CONTEXTS <c>.

The context <c> must already exist as an object in the ABAP Workbench. 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 generates an instance <inst> of context <c>. You can create as many instances of a context as you like. 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