Once you have supplied a context instance with key values, you can query its dependent values. You do this using the DEMAND statement:
Syntax
DEMAND <val1> = <f
1> ... <val
n> = <f
n> FROM CONTEXT <inst>
[MESSAGES INTO <itab>].
This statement fills the fields <fn> with the derived values <val n> from context instance <inst>. The fields of the context are contained in the
Fields table.In doing this, the system carries out the following steps:
REPORT RSGCON01.
DATA: C_FROM LIKE SPFLI-CITYFROM,
C_TO LIKE SPFLI-CITYTO,
C_TIME LIKE SPFLI-FLTIME.
CONTEXTS DEMO_TRAVEL.
DATA: DEMO_TRAVEL_INST1 TYPE CONTEXT_DEMO_TRAVEL,
DEMO_TRAVEL_INST2 TYPE CONTEXT_DEMO_TRAVEL.
SUPPLY CARRID = 'LH'
CONNID = '400'
TO CONTEXT DEMO_TRAVEL_INST1.
SUPPLY CARRID = 'AA'
CONNID = '017'
TO CONTEXT DEMO_TRAVEL_INST2.
DEMAND CITYFROM = C_FROM
CITYTO = C_TO
FLTIME = C_TIME
FROM CONTEXT DEMO_TRAVEL_INST1.
WRITE: / C_FROM, C_TO, C_TIME.
DEMAND CITYFROM = C_FROM
CITYTO = C_TO
FLTIME = C_TIME
FROM CONTEXT DEMO_TRAVEL_INST2.
WRITE: / C_FROM, C_TO, C_TIME.
This program generates two instances of context DEMO_TRAVEL, supplies them both with key values and reads three dependent values from each of them.