The following example demonstrates how to create a context called DOCU_TEST2 which uses a function module as a module.
Function module
The function module is called SUBTRACTION, and is part of the function group TESTCONTEXT. It has the following interface:
and the following source code:
FUNCTION SUBTRACTION.
RESULT = V1 - V2.
ENDFUNCTION.
The function module subtracts import parameter V2 from the other import parameter V1, and returns the value in RESULT.
To create the context:
All of the interface parameters for the function module are used as fields in the context. The system generates the names of the context fields. The interface of the SUBTRACTION module shows that the import parameters V1 and V2 are assigned to the key fields SEATSMAX and SEATSOCC, and that the export parameter RESULT is assigned to the dependent field SEATSOCC_1.
The context is finished and can be tested (see
Testing a Context ) and used in programs (see Using Contexts in ABAP Programs).