Monday, May 1, 2023

Function Module Creation

 Function Modules are an essential aspect of SAP ABAP development. They are pre-defined blocks of reusable code that perform a specific task or set of tasks. These modules can be called from within ABAP programs or external applications using remote function calls (RFCs).

The Function Builder (transaction code SE37) is used to create Function Modules in ABAP, which can have both input and output parameters. Function Modules can be created with a specific set of parameters or can be flexible with the use of generic parameters. They can also be made available for external applications to use via RFCs.

One of the benefits of using Function Modules in ABAP is their reusability. As code can be used multiple times within an application or across several applications, it can significantly reduce development time. Also, changes made to a Function Module are automatically reflected wherever the Function Module is used, making it easy to maintain.

Function Modules in SAP ABAP can perform different tasks, including database operations, data conversion, and date calculations.

 Examples of commonly used Function Modules include:

CONVERT_TO_LOCAL_CURRENCY: used to convert amounts in foreign currency to the local currency.

GUI_DOWNLOAD: used to download internal tables into a file on the user's PC.

GUI_UPLOAD: used to upload data from a file on the user's PC into an internal table.

RFC_READ_TABLE: used to read data from an SAP database table.

To summarize, Function Modules in SAP ABAP are reusable blocks of code that perform specific tasks or a set of tasks. They offer several advantages, such as reusability and maintainability. These modules can perform various functions and can be called from within ABAP programs or external applications using RFCs.

Video show steps to create a Function Module in SAP 



Video show steps to call a Function Module in Report






Message Class in SAP ABAP

 In SAP ABAP, a message class is a set of messages that can be utilized in an ABAP program or application. These messages are important in providing users with information, warnings, and error messages during the execution of a program.

Transaction SE91 is used in creating a message class, and it contains one or more messages. Each message has a message type, message number, unique identifier, short and long text. The message text can also be written in different languages to support internationalization.

In ABAP programs, messages are called using the MESSAGE statement. It includes the message class, message number, and any variables needed for the message text. The MESSAGE statement can be used to write messages to the system log or display messages to the user.

Using message classes in SAP ABAP can enhance program consistency, simplify message maintenance, and support multi-language applications. By defining and using message classes, developers can guarantee that messages are consistently displayed throughout the application and that message changes can be made easily and efficiently.


Steps shown in the below video 



Database Tables in DDIC

 In SAP ABAP, Database Tables are a fundamental component for storing and organizing data in a structured manner. These tables are defined in the ABAP Data Dictionary (DDIC) using transaction code SE11. The DDIC is a central repository for all data definitions in SAP ABAP, including Database Tables.

Each Database Table is defined with a name, description, and fields that determine the table's structure. The fields are defined with a data type, length, and other properties that specify how the data is stored. Data Types can be elementary, like numbers and characters, or structured, like Structures and Table Types.

Database Tables are classified based on their usage. The classifications include transparent, pooled, and clustered tables. Transparent tables are used to store application data, while pooled and clustered tables are used to store system data and can only be accessed by SAP System Programs.

To maintain data integrity, Database Tables can have various constraints, such as Primary Keys, Foreign Keys, and Check Constraints. Primary Keys are used to uniquely identify rows in a table, while Foreign Keys define relationships between tables. Check Constraints are used to validate data stored in a table.

Database Tables can be accessed and modified using SQL statements or ABAP programming. They are used in various SAP application components, such as SAP ERP, SAP CRM, and SAP BW, and play a critical role in the functioning of the SAP system.

Creation of Database Table - 

  1. Open the ABAP Development Workbench using the transaction code SE80.
  2. Navigate to the ABAP Dictionary by selecting Tools → ABAP Dictionary or using the transaction code SE11.
  3. In the ABAP Dictionary screen, select "Database table" and click on the "Create" button.
  4. Enter a unique name for the table and select the "Delivery and maintenance" tab. Ensure that "Display/Maintenance Allowed" is selected and save the table.
  5. Define the fields of the table by clicking on the "Fields" tab and adding the required fields along with their data types, lengths, and attributes.
  6. Specify the Key Fields of the table by selecting the "Key" checkbox next to the fields.
  7. Add any additional properties for the table, such as Texts and Documentation.
  8. Once all the fields and properties are defined, save the table.
  9. Activate the table by selecting "Utilities" from the menu and clicking on the "Activate" option.
  10. Following these steps will create and activate a Database Table in SAP ABAP. The table can then be accessed and utilized by various SAP programs and applications.
 Refer to the below video for the complete steps for table creation and activation 



In Conclusion , Database Tables in ABAP are an essential component for storing and organizing data. They are defined in the ABAP Data Dictionary, and fields are defined with a data type, length, and other properties. Database Tables can be classified as transparent, pooled, or clustered and have various constraints to maintain data integrity. They are accessed and modified using SQL statements or ABAP programming and are used in various SAP application components.