0% found this document useful (0 votes)
17 views34 pages

4.modularisation Techniques

The document discusses modularization techniques in programming, specifically focusing on dividing large programs into smaller, manageable modules. It covers various techniques such as macros, includes, subroutines, and function modules, explaining their syntax, usage, and differences. Additionally, it addresses concepts like parameter interfaces, memory management, and SQL commands relevant to modular programming.

Uploaded by

snehalchavan899
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views34 pages

4.modularisation Techniques

The document discusses modularization techniques in programming, specifically focusing on dividing large programs into smaller, manageable modules. It covers various techniques such as macros, includes, subroutines, and function modules, explaining their syntax, usage, and differences. Additionally, it addresses concepts like parameter interfaces, memory management, and SQL commands relevant to modular programming.

Uploaded by

snehalchavan899
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

MODULARIZATION TECHNIQUES

SR KRISHNA
WHAT IS MODULARIZATION ?

 Dividing large size program into small modules. MACROS: Mostly used in HR-ABAP Programming

 ADV: SYNTAX: DEFINE < MACRO NAME >.

1. Improves program Readability. < STATEMENT BLOCK >.

END OF DEFINITION.
2. Increases program Reusability.

3. Avoids code Redundancy.

MODULARIZATION TECHNIQES ARE CLASSIFIED AS:

1. SOURCE CODE MODULES 2. PROCEDURES


•MACROS •SUBROUTINES
•INCLUDES •FUNCTION MODULES
•METHODS
INCLUDES

 INCLUDE is a collection of statements which perform unique operation.

 Belongs to program type ‘ i ’.

 Not self executable.

 Used in Executable programs.

 SYNTAX: INCLUDE < INCLUDE PRG NAME >.


EXAMPLE ON INCLUDE
SUBROUTINES

 1. SUBROUTINE is a collection of statements which perform unique operation.

 2. Belongs to program type ‘ S ’.

 3. Not self executable.

 4. Used in executable programs. Differences between includes & subroutines

INCLUDES SUBROUTINES
 SUBROUTINES are defined by FORM…ENDFORM statement.
PROGRAM TYPE i PROGRAM TYPE S
 SYNTAX:

PARAMETER INTERFACE NOT POSSIBLE POSSIBLE


FORM < SUBROUTINE NAME >.

< STATEMENT BLOCK >.

ENDFORM.

 SUBROUTINES are called by PERFORM statement.

 SYNTAX:

PERFORM < SUBROUTINE NAME >.


PARAMETER INTERFACE

 What we declared in SE38 EXECUTABLE PROGRAM are called as ACTUAL PARAMETERS.

 What we calling from SE38 SUBROUTINE PROGRAM are called as FORMAL PARAMETERS.

 Data is always passed from ACTUAL to FORMAL parameters .

 The connection between ACTUAL to FORMAL is called as parameter interface.

 Data transfer techniques are :

1. PASS BY REFERENCE 2. PASS BY VALUE

SAME DIFFERENT
A F A F

N1 N2 N1 N2

ADD MEM ADD MEM


PASS BY REFERENCE & PASS BY VALUE
CALCULATING EMPLOYEE SALARY USING SUBROUTINES
DEFINE LOCAL VARIABLES WITH IN THE PROGRAM USING ---------------LOCAL , DATA , STATICS KEYWORDS
FUNCTION MODULE

 Function Module is an independent program which perform unique operation .

 Every Function Module belongs to one Function group.

 Mainly used for Global Modularization.

 All Function Modules are stored in TFDIR Transparent Table.

 UNIQUE OPERATION OF FUNCTION MODULE:

1. IMPORT – Values from calling program

2. Perform the operation

3. EXPORT – Values to calling program

SUBROUTINES
Difference between Subroutine and FUNCTION
Function MODULES
Module
 SE37 is the TCODE for Function Builder.
Used for Local Modularization Global Modularization  Using Function Builder Function Groups & Function Modules are created.

No Handles Exceptions

Called by PERFORM statement CALL FUNCTION


FUNCTION GROUP & FUNCTION MODULE CREATION

CLICK ON CONTINUE
SE80
SE37

SE37
CLICK ON CONTINUE
WORKING WITH FUNCTION MODULE --- SE37
WORKING WITH FUNCTION MODULE --- SE38
How Function module works ---- Simple ALV Report
ALV Report
FUNCTION MODULE
LOCK OBJECT --- SE11

 It is used to restrict simultaneous access of table record by several users at a time.

I.e. One user editing particular table entry at that time that entry must be locked, so that other users can’t perform other operation.

 SAP supports Row level or Record level locks.

USER2 USER3
USER1 INSERT DELETE
UPDATE

KUNNR LAND1

100 US

200 IN

DATABASE TABLE
MESSAGES --- SE91

 To know the operation result, while working with sap screens.

 Created under Message Class.

 We can create 1000 messages per class.

 All Messages are stored in T100 Table.

 Types of Messages:

 I - Information message SE91 SE91

 S - Status Message

 E - Error Message

 W - Warning Message

 A - Abort Message SE38

 X - Termination Message

 SYNTAX:

MESSAGE < MESSAGE TYPE >< MESSAGE NO >( MESSAGE CLASS ) WITH < F1 > < F2 > …….. < Fn >
SAP MEMORY & ABAP MEMORY

 ABAP MEMORY:
 SAP MEMORY:
 Data sending between internal sessions using EXPORT, IMPORT parameters.
 Data sending between main sessions using GET, SET parameters.
 Memory is Local.
 Memory is Global..

SAP MEMORY
SESSION1 SESSION2

SESSION1 SESSION2 IMPORT


SAP MEMORY
A
A
B
B
A
GET A
SET P
P
M
M INTERNAL SESSION E
E
M
M
O
O
R
R
Y
Y EXPORT
SYNTAX:

 SET PARAMETER ID < PID > FIELD < FIELD NAME >.
 SYNTAX:

 GET PARAMETER ID < PID > FIELD < FIELD NAME >.
 EXPORT < DATA OBJECT > FROM < GLOBAL STRUCTURE > TO MEMORY ID < PID > .

 IMPORT < DATA OBJECT > TO < GLOBAL STRUCTURE > FROM MEMORY ID < PID > .
PROGRAM ON ABAP MEMORY & SAP MEMORY
INTER PROGRAM COMMUNICATION

 This topic deals with program to program communication.


SELECTION SCREEN

 SCREEN between program and list screen.

 Interface between user and program.

 Accept values from user and display result.

 3 KEYWORDS generate selection screen.

1. PARAMETERS

2. SELECT-OPTIONS

3. SELECTION-SCREEN

 SYNTAX:

1. PARAMETERS < FIELD NAME > TYPE < DATA TYPE >.

2. SELECT-OPTIONS < FIELD > FOR < DATA BASE TABLE FIELD >.

3. SELECTION-SCREEN: BEGIN OF BLOCK < BLOCK NAME > WITH FRAME TITLE < TIT >.

< DECLARE ELEMENTS USING PARAMETERS OR SELECT-OPTIONS >.

SELECTION-SCREEN: END OF BLOCK < BLOCK NAME >.


PARAMETERS
SELECT-OPTIONS
SELECTION-SCREEN
OPEN SQL STATEMENTS
DISTINCT ADDITION
OPEN SQL COMMANDS
AGGREGATE FUNCTIONS IN SQL

 COUNT( FIELD NAME ) : It returns the field COUNT

 SUM( FIELD NAME ) : It returns SUM of field value

 AVG(FIELD NAME ) : It returns AVG field value

 MAX( FIELD NAME ) : It returns MAX field value

 MIN( FIELD NAME ) : It returns MIN field value


OPEN SQL COMMANDS
Using a Cursor to Read Data
TABLE JOINS

INNER JOIN

LEFT-OUTER JOIN ( FOR ALL ENTRIES )

KNA1 KNB1
INNER JOIN LEFT-OUTER JOIN
THANK YOU

You might also like