MODULARISATION
MODULARISATION
Need of modularization
Improve program structure
Make the program easier to maintain and update
Improve readability
Reduce redundancy
Allow for component reuse
Modules in an ABAP program
ABAP/4 offers three types of modularization units:
Events
Subroutines
Functional Module
What is an event?
5.Show list
Category & Events
Driver
Initialization
At selection-screen
Start-of-selection
Get
End-of-selection
Category & Events
Initialization
– Processed before the presentation of the selection
screen
– Can be used to initialize values in the selection
screen
Run-Time Events
At selection-screen
– Processing block is started after the user has
specified all the criteria in the selection screen
– If an error message is displayed from this processing
block the system displays the selection screen again
and all input fields can be changed
Run-Time Events
Start-of-selection
– Processing block that is executed after processing the
selection screen and before accessing database tables
using a logical database
– Use this processing block to set the value of internal
fields
– All statements that are not attached to an event
keyword or in a subroutine are processed in this
event
END-OF-SELECTION :
This is the last of the events called by the runtime environment
to occur. It is triggered after all of the data has been read from
the logical database, and before the list processor is started
Control Level Statements
Internal subroutine:
PERFORM <subr> [USING ... ... ] [CHANGING... ... ].
External subroutine
PERFORM <subr> IN PROGRAM <prog>
Parameters
Formal parameters - defined within FORM
Actual parameter - specified with PERFORM
Parameter types
– Input - used to pass data to subroutines
– Output - used to pass data from subroutines
– Input/output - pass data to & from subroutines
Call by reference
Call by value
Calling by reference