Ansicht
Dokumentation

MCLI/SPE/CLS_FCTR_C - MCLI/SPE/CLS FCTR C

MCLI/SPE/CLS_FCTR_C - MCLI/SPE/CLS FCTR C

CL_GUI_FRONTEND_SERVICES - Frontend Services   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

Short Description of Function

In the ABAP OO, it is technically possible to replace classes with inherited classes. You could do this class replacement by making source modifications. However, the class factory has been created to enable you to replace classes easily class without having to make modifications to the source.

You can replace the following by using the class factory:

  • global
  • local

classes with their inherited classes, provided the original code (e.g. standard code) has been prepared for class replacement.

In the original code, the classes (that should later be replaceable for other software layers or for the customers) should be created via the /SPE/CL_CLASS_FACTORY -> CREATE_CLASS method of the class factory and not via the CREATE instruction.

This method searches for the class type name in the system table /SPE/CLS_FCTR and in the Customizing table /SPE/CLS_FCTR_C.

The table /SPE/CLS_FCTR_C is a Customizing table. The table /SPE/CLS_FCTR is a system table for other SAP layers. The system table has priority during class replacement.

When the type name of the class is found in one of the tables and a replacement class type name is also entered, then the class factory creates a new class with the replacement type name. The pointer of the new instance is returned to the caller.

By maintaining the customizing table /SPE/CLS_FCTR_C, the core classes in the table can be replaced with their inherited classes without any source modification. This table has the following structure:

Field,,,,,,Data element,,,,,,,,Type,,Length,,Description

RPL_CLASS,,,,/SPE/REPL_CLASS_NAME,,CHAR,,30,,,,Name of a Replaceable Class

CHG_CLASS,,/SPE/CHANGE_CLASS_NAME,,CHAR,,30,,,,Name of the New (Replace) Class

RPL_ENABLED,,/SPE/CLS_ENABLED,,,,CHAR,,1,,,,Replacement of the Class is Enabled/Disabled

USER_PARAMID,,MEMORYID,,,,,,,,CHAR,,20,,,,Set/Get Parameter ID

Prerequisites for class replacement:

  • The class should contain the interface /SPE/IF_REPL_CLASS (if not, the class is not a replaceable class)
  • There must be an entry for the replaceable class in the system table /SPE/CLASS_FACTORY

Example for the class creation in the CORE source:

DATA: go_cls TYPE REF TO zcl_borgr_asn_POST.

go_cls ?= /spe/cl_class_factory=>create_class(

i_name = '/spe/cl_inb_asn_post' ).

CALL METHOD go_cls->select.

Procedure for class replacement:

  • Create and activate a new class inherited from the original one
  • Redefine methods containing the new functionality
  • Modify the core system table /SPE/CLS_FCTR, fill the field CHG_CLASS with the name of the new class, and fill the field RPL_ENABLED with X

If the field USER_PARAMID has an entry in it, then an additional check is activated. Class replacement only takes place if the user has a user parameter with the value X.

The class factory has a second table /SPE/CLS_FCTR_C. This is a Customizing table. You can use this table to provide the customer with classes for replacement. (The system table has priority. This means that if one class is already in the system table, then the customer can't replace it.)

Recommendations for Multi-Client Operations






rdisp/max_wprun_time - Maximum work process run time   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 3803 Date: 20240523 Time: 195241     sap01-206 ( 64 ms )