Modularization Principle of Modularization Principle of Modularization Modularization Data Exchange Modularization Data Exchange Why use modularization in ABAP? IMPROVE PROGRAM STRUCTURE EASE FUTURE MAINTENANCE ENCOURAGE CODE REUSABILITY Types of Modularization in ABAP Include Programs Subroutines Function Modules Methods & Classes Modularization – Include Programs • Top Include • Selection Screen Include • Subroutine Include • Class Include Include Programs – Top Include • Declare Global Data (Variables, Type Structures, Table Types, Internal Tables, etc.) • Declare Tables to be used for Select-Options Include Programs – Selection Screen Include • Declare fields to be displayed • FRAME TITLE text-001 • • Indicate Text Element to be used to display Selection Screen title arithmetic_op, comparison_op, numbers • • Name of the Selection Screen Block (max of 20 characters long) PARAMETERS: • • Used to declare single entries p_xxxxxx • Parameter name (max of 8 characters long) Include Programs – Subroutine Include Contains Subroutines (block of codes) that can be called throughout the program Normally have an <Include_Name_FORM> name Modularization – Function Module Function modules are ABAP routines that encapsulate program code and provide an interface for data exchange. Function modules are stored in a central function library. They are not application-specific and are available system-wide. The ABAP Workbench comes with a large number of standard function modules. Include Programs – Class Include Contains Classes that will be called throughout the program Normally have an <INCLUDE_NAME_CLS> name PUBLIC SECTION • This statement can only be used in the declaration part of a class. It defines the public visibility section of the class class. • All components of the class that are declared after the statement PUBLIC SECTION are accessible from outside the class, in their subclasses, and in the class itself as long as this permitted by the package concept. • Public methods in particular can be redefined in subclasses. PROTECTED SECTION • This statement can only be used in the declaration part of a class. It defines the protected visibility section of the class class. • All components of the class declared in the area behind the statement PROTECTED SECTION can be addressed directly only in the subclasses of the class and in the class itself (plus its friends), if allowed by the package concept. • Protected methods in subclasses can be redefined. PRIVATE SECTION • This statement can only be used in the declaration part of a class. • It defines the private visibility section of the class class. • All components of the class defined in the area after the statement PRIVATE SECTION can only be addressed in the class itself, and in its friends.