- SAP ABAP Reports
- Report Types and Events
- Message Class
- Example of Classical Report
- Example of Interactive Report
- Example of ALV Report
- Example of Blocked ALV Report
- Example of Hierarchical Report
- Module Pool Programming
- Screen Painter Components
- Events in Flow Logic Editor
- Screen Elements and Creation Steps
- Working with Validations
- Database Operations
- OO Programming in ABAP
- Types of Programming Structure
- Key Features of OO Programming
- Classes and Objects
- Types of Visibility Section
- Class Defination and Implementation
- Object Creation for Class
- Method Declaration and Implementation
- Types of Component Class
- Global Class and implement GLOBAL methods
- OOP's ALV
- OOP's BDC
24MPP2308 – working with Validations in MPP
Validations in SAP ABAP module pool programming (MPP) are essential for ensuring data integrity and providing immediate feedback to users. Here’s how you can work with validations in MPP:
Steps to Implement Validations
- Define the Validation Logic:
- Determine what needs to be validated (e.g., mandatory fields, value ranges, format checks).
- Create PAI Module:
- Write the validation logic in the PAI (Process After Input) module of the screen. This module is triggered after user input.
- Use ABAP Statements for Validation:
- Use ABAP statements like IF, CASE, and CHECK to implement the validation logic.
- Display Error Messages:
- Use the MESSAGE statement to display error messages if validation fails.
- Example: Mandatory Field Validation
Let’s say you have an input field for a material number (MATNR) that must not be empty.
- Define the Screen Element:
- Create an input field for MATNR in the Screen Painter.
- Write PAI Module:
- In the PAI module, write the validation logic.
MODULE validate_input.
IF matnr IS INITIAL.
MESSAGE ‘Material number cannot be empty’ TYPE ‘E‘.
ENDIF.
ENDMODULE.
- assign PAI Module to Screen:
- Assign the validate_input module to the PAI event of the screen.
- Example: Value Range Validation
Suppose you need to ensure that the quantity entered is between 1 and 100.
- Define the Screen Element:
- Create an input field for QUANTITY in the Screen Painter.
- Write PAI Module:
- In the PAI module, write the validation logic.
MODULE validate_quantity.
IF quantity < 1 OR quantity > 100.
MESSAGE ‘Quantity must be between 1 and 100’ TYPE ‘E’.
ENDIF.
ENDMODULE.
- Assign PAI Module to Screen:
- Assign the validate_quantity module to the PAI event of the screen.
- Tips for Effective Validations
- Modularize Validation Logic: Break down validation logic into smaller modules for better readability and maintenance.
- Use Clear Messages: Ensure error messages are clear and informative to guide users in correcting their input.
- Combine Validations: You can combine multiple validations in a single PAI module if they are related.
- Example of combine Validations
MODULE validate_inputs.
IF matnr IS INITIAL.
MESSAGE ‘Material number cannot be empty’ TYPE ‘E’.
ENDIF.
IF quantity < 1 OR quantity > 100.
MESSAGE ‘Quantity must be between 1 and 100’ TYPE ‘E‘.
ENDIF.
ENDMODULE.
By implementing these steps, you can ensure that your SAP module pool programs are robust and user-friendly.
Author : Aniket Pawar, 9373518385
24MPP2308 – working with Validations in MPP
Validations in SAP ABAP module pool programming (MPP) are essential for ensuring data integrity and providing immediate feedback to users. Here’s how you can work with validations in MPP:
Steps to Implement Validations
- Define the Validation Logic:
- Determine what needs to be validated (e.g., mandatory fields, value ranges, format checks).
- Create PAI Module:
- Write the validation logic in the PAI (Process After Input) module of the screen. This module is triggered after user input.
- Use ABAP Statements for Validation:
- Use ABAP statements like IF, CASE, and CHECK to implement the validation logic.
- Display Error Messages:
- Use the MESSAGE statement to display error messages if validation fails.
- Example: Mandatory Field Validation
Let’s say you have an input field for a material number (MATNR) that must not be empty.
- Define the Screen Element:
- Create an input field for MATNR in the Screen Painter.
- Write PAI Module:
- In the PAI module, write the validation logic.
MODULE validate_input.
IF matnr IS INITIAL.
MESSAGE ‘Material number cannot be empty’ TYPE ‘E‘.
ENDIF.
ENDMODULE.
- assign PAI Module to Screen:
- Assign the validate_input module to the PAI event of the screen.
- Example: Value Range Validation
Suppose you need to ensure that the quantity entered is between 1 and 100.
- Define the Screen Element:
- Create an input field for QUANTITY in the Screen Painter.
- Write PAI Module:
- In the PAI module, write the validation logic.
MODULE validate_quantity.
IF quantity < 1 OR quantity > 100.
MESSAGE ‘Quantity must be between 1 and 100’ TYPE ‘E’.
ENDIF.
ENDMODULE.
- Assign PAI Module to Screen:
- Assign the validate_quantity module to the PAI event of the screen.
- Tips for Effective Validations
- Modularize Validation Logic: Break down validation logic into smaller modules for better readability and maintenance.
- Use Clear Messages: Ensure error messages are clear and informative to guide users in correcting their input.
- Combine Validations: You can combine multiple validations in a single PAI module if they are related.
- Example of combine Validations
MODULE validate_inputs.
IF matnr IS INITIAL.
MESSAGE ‘Material number cannot be empty’ TYPE ‘E’.
ENDIF.
IF quantity < 1 OR quantity > 100.
MESSAGE ‘Quantity must be between 1 and 100’ TYPE ‘E‘.
ENDIF.
ENDMODULE.
By implementing these steps, you can ensure that your SAP module pool programs are robust and user-friendly.
Author : Aniket Pawar, 9373518385