SAP - Modularization Techniques
Modularization is a techniques which is used to divide the application program into smaller units.
Modularization techniques in ABAP help in structuring code efficiently, improving reusability, readability, and
maintainability.
▶️There are two primary types:
1. Procedural Modularization
Include Programs ( INCLUDE Zname_of_prg. )
Function Modules (FUNCTION...ENDFUNCTION.)
Subroutines (FORM...ENDFORM.)
2. Object-Oriented Modularization
Methods (CLASS...METHODS...ENDMETHOD)
Global Classes (SE24)
Local Classes and Methods
1️⃣ Include Programs in SAP ABAP
Used to modularize large programs by dividing them into separate files. Helps in code organization.
T-code SE38 is used to create INCLUDE program. Type of program is I .
INCLUDE zinclude_program.
Better Understanding.
SAP - Modularization Techniques 1
2️⃣ Functional Module in SAP ABAP :
A function is reusable piece of code or small program that provided an interface for data exchange.
SE37 T-code is used to make Function module.
Function Module need to Stored into Function Group .
What is Function Group ?
Function Group is container in SAP which is used to Stored function module. up to 99 function module
can be stored into single function group.
SE80 T-code is used to create Function Group.
As the Function module is add into the Function group they will be seen into INCLUDE in function Group.
SAP - Modularization Techniques 2
T-code = SE37 is used to create function module. SAP already has many pre-defined function module which are used during
Programming.
Most Used SAP Standard Function Modules
Category Function Module Description
General Utility RPY_TRANSACTION_READ Checks if a transaction code exists.
JOB_OPEN Opens a background job.
Closes and submits a background
JOB_CLOSE
job.
BP_JOBLOG_READ Reads background job logs.
String Removes special characters from a
SCP_REPLACE_STRANGE_CHARS
Manipulation string.
STRING_SPLIT Splits a string into parts.
CONVERSION_EXIT_ALPHA_INPUT Removes leading zeros.
CONVERSION_EXIT_ALPHA_OUTPUT Adds leading zeros.
Date & Time
DATE_COMPUTE_DAY Finds the day of the week for a date.
Handling
Retrieves the week number of a given
DATE_GET_WEEK
date.
Calculates the difference in days
FIMA_DAYS_BETWEEN_DATES
between two dates.
File Handling GUI_UPLOAD Uploads a file from the frontend.
GUI_DOWNLOAD Downloads a file to the frontend.
WS_UPLOAD Uploads a file to the SAP system.
WS_DOWNLOAD Downloads a file from SAP.
Number Range Retrieves the next number in a
NUMBER_GET_NEXT
Handling number range.
NUMBER_RANGE_INTERVAL_UPDATE Updates a number range interval.
ALV Reporting REUSE_ALV_GRID_DISPLAY Displays an ALV grid report.
REUSE_ALV_LIST_DISPLAY Displays an ALV list report.
REUSE_ALV_VARIANT_F4 Allows users to select an ALV variant.
Currency & Unit Converts amounts between
CONVERT_TO_FOREIGN_CURRENCY
Conversion currencies.
UNIT_CONVERSION_SIMPLE Converts measurement units.
Email &
SO_NEW_DOCUMENT_SEND_API1 Sends an email from SAP.
Communication
SO_DOCUMENT_READ_API1 Reads an email document from SAP.
SO_OBJECT_SEND Sends an object as an email.
BAPI (Business
BAPI_USER_CREATE1 Creates a new SAP user.
APIs)
BAPI_USER_CHANGE Changes an existing SAP user.
BAPI_MATERIAL_SAVEDATA Creates or updates a material.
SAP - Modularization Techniques 3
BAPI_CUSTOMER_CREATEFROMDATA1 Creates a new customer.
BAPI_PO_CREATE1 Creates a purchase order.
Error Handling
BAL_LOG_CREATE Creates an application log.
& Logs
BAL_LOG_MSG_ADD Adds messages to an application log.
BAL_LOG_SAVE Saves log entries.
RFC (Remote Checks if an RFC destination is
RFC_PING
Function Calls) reachable.
RFC_CONNECTION_CLOSE Closes an RFC connection.
RFC_READ_TABLE Reads data from a table using RFC.
Dialogs & Displays a Yes/No confirmation
POPUP_TO_CONFIRM
Popups popup.
POPUP_TO_SELECT_SINGLE_ENTRY Displays a selection popup.
POPUP_GET_VALUES Displays a popup for value input.
Common Function Groups for SAP Standard Function Modules
Function Group Purpose Example Function Modules
SCPX String and text manipulation SCP_REPLACE_STRANGE_CHARS , STRING_SPLIT
SDTX Text handling READ_TEXT , SAVE_TEXT
CONVERSION_EXIT_ALPHA_INPUT ,
SDIFRUNTIME Data conversion
CONVERSION_EXIT_ALPHA_OUTPUT
BDC_OPEN_GROUP , BDC_INSERT ,
SBDC Batch Input (BDC)
BDC_CLOSE_GROUP
SVAR System Variables & Configurations GET_SYSTEM_VARIABLES
STXD SAPscript text processing SAVE_TEXT , READ_TEXT , DELETE_TEXT
ZGUI File handling (GUI) GUI_UPLOAD , GUI_DOWNLOAD
WS_DOWNLOAD File handling (WS) WS_UPLOAD , WS_DOWNLOAD
REUSE_ALV_GRID_DISPLAY ,
ALV ALV (ABAP List Viewer)
REUSE_ALV_LIST_DISPLAY
NUMBER_GET_NEXT ,
NRIV Number Range Handling
NUMBER_RANGE_INTERVAL_UPDATE
SO_NEW_DOCUMENT_SEND_API1 ,
SOI Email & SAPoffice
SO_DOCUMENT_READ_API1
BAL_LOG_CREATE , BAL_LOG_MSG_ADD ,
APPL_LOG Application Logs
BAL_LOG_SAVE
RFC_PING , RFC_READ_TABLE ,
SYST System & RFC utilities
RFC_CONNECTION_CLOSE
POPUP Dialog popups POPUP_TO_CONFIRM , POPUP_GET_VALUES
DATE_COMPUTE_DAY , DATE_GET_WEEK ,
DATE_TIME Date & Time Handling
FIMA_DAYS_BETWEEN_DATES
BAPI_USER_CREATE1 , BAPI_MATERIAL_SAVEDATA ,
BAPI BAPIs (Business APIs)
BAPI_PO_CREATE1
3️⃣ Subroutines
In SAP ABAP, subroutines are modular units of code that can be reused multiple times within a program. They help
in organizing and structuring the code for better readability and maintainability.
SYNTAX
FORM subroutine_name.
" Your ABAP logic here
ENDFORM.
Subroutines will crated in the end of the program or in the include forms.
SAP - Modularization Techniques 4
PERFORM key work is use to call the subroutines in the program.
SYNTAX
PERFORM subroutine_name.
SAP - Modularization Techniques 5
SAP - Modularization Techniques 6