Entering content frame

Using Function Modules as Modules 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 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 Structure linkshared objects.


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:

This graphic is explained in the accompanying text

and the following source code:

  RESULT = V1 - V2.

The function module subtracts import parameter V2 from the other import parameter V1, and returns the value in RESULT.

To create the context:


       1.      Enter SUBTRACTION in the Name or Table/Module column of the Modules table and choose Enter. The system fills the tables on the context maintenance screen as follows:

This graphic is explained in the accompanying text

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.

       2.      You do not have to adopt these generated names. You can, instead, overwrite the context field names in the Fields and Modules table. For example, as follows:

This graphic is explained in the accompanying text

       3.      Choose Save. Save the context.

       4.      Choose Check. The system checks the context for errors.

       5.      Choose Network graphic. The following graphic shows how values are derived within the context.

This graphic is explained in the accompanying text

       6.      Choose Generate. The system checks and saves your context before generating it.

The context is finished and can be tested (see Testing a Context ) and used in programs (see Using Contexts in ABAP Programs).





Leaving content frame