Sei sulla pagina 1di 22

Module Pool Programming.

+ -
It is a special type of programming which is used to create custom SAP screens.
Transaction code for creating module pool programs is SE8.
E!ery module pool program must "e e#ecuted with a transaction $T-code%.
E!ents in Module pool programming
There are four e!ents a!aila"le in module pool programming.
PBO (Process Before Output):Triggered "efore MPP screen is displayed.
PAI (Process After Input): Triggered after MPP screen is displayed whene!er user
raises an action. Also&'ow P() is also triggered.
POV (Process On Value Request): Triggered when *ser +lic,s on search help or -.
(utton.
POH (Process On Help Request): Triggered when *ser +lic,s on search help or -.
(utton.
Modulari/ation techni0ues in Module Pool
(asically there are four include programs which are created automatically for an MPP
program.
1MPP name23T)P 4top include program &All data declarations.
1MPP name23)5 4P() include program & All logic related to P() e!ent
1MPP name23I5 4PAI include program & All logic related to PAI e!ent
1MPP name23-5 4-orms include program & All logic related to su"routines
S+6EE'
It is a !isi"le layout which is displayed in the output. The components of the Screen are
+omponents of Screen7
Attri"utes 7 Properties of screen
Element 8ist 7 8ist of *I98i"rary elements
-low-8ogic 7 A"ap logic related to MPP
8ayout 7 Screen :esigning Area
-low 8ogic in module pool
It will contain the logic related to screen in the form of modules (y default& ; e!ents will
"e a!aila"le with their corresponding modules as "elow7 <ust uncomment the modules
and create them and write the a"ap logic.
P6)+ESS (E-)6E )*TP*T.
=M):*8E STAT*S35.
P6)+ESS A-TE6 I'P*T.
=M):*8E *SE63+)MMA':35.
M):*8E7
It is an su"-program which contains the A(AP code for a screen .
-low-8ogic cannot understand A(AP statements. So the entire A(AP code is
written in the form of modules.
Since the entire a"ap logic is di!ided in the form of modules& that is why it is
called M):*8E P))8 P6)>6AMMI'>
In the "elow e#ample we will create a simple Module Pool Program to display
hello world.
>o to SE8& select program from drop down& pro!ide name as
?SAP'3@E88)3A)68: and press enter.

A pop up will open clic, Bes.

Pro!ide a program name ?SAP'3@E88)3A)68: $same name as gi!en a"o!e%&


select create with top include chec, "o# and enter.

Pro!ide a top include name& enter.

+lic, Sa!e on the pop up window.

Sa!e it in a local o"Cect.


>o to change mode& dou"le clic, on program name& uncomment all include
programs& dou"le clic, on each include and create $TIP- <ust dou"le clic, on each
include enter& enter& sa!e in local o"Cect& sa!e& "ac,$-D%% .'ow to dou"le clic, on
program name& right clic, & acti!ate.

6ight clic, on program name& create& screen.

Pro!ide Screen num"er as $5%& enter.

Pro!ide short description and clic, on Eow logic ta".

*ncomment the a!aila"le M):*8ES& dou"le clic, to create them.

:ou"le clic, on M):*8E STAT*S35&yes& select main include and enter.

Sa!e& clic, "ac, $-D% and create another module.


+lic, on 8ayout $ tool"ar "utton%& it will open Module Pool layout designer $If you
are using it Frst time it might ta,e some time...If you failed to open layout it
might "e due to some missing conFguration& at that time contact "asis9admin%.

The layout will "e li,e "elow& drag and drop Te#t -ield element on to screen area.

Pro!ide name and te#t.

Sa!e& close windows& go to Eow logic& dou"le clic, on each module and add
"elow code.

:ou"le clic, on menu name and title to create >*I status for the
program...chec,out creating a custom menu in SAP to create menu.
:ou"le clic, on program name& right clic,& acti!ate.
To e#ecute a module pool program we need to create a t-code& to create a t-code
right clic, on program name& create& transaction.

Pro!ide a T-code name& short te#t and enter.

Pro!ide program name& screen num"er& sa!e.

'ow T-code is created& e#ecute the T-code and test.

+ -
6e0uirement7 :isplay material details for a material input "y designing a module
pool screen.
>o to SE8& select program from drop down& pro!ide name and press enter.

A popup will come Cust clic, yes.

+hec, G+reate with T)P moduleG and enter.

Pro!ide a top include name and enter.

Select module pool and sa!e.

E#pand program& dou"le clic, on top include and add "elow code.

6ight clic, on program name& create -2 screen.

Pro!ide a screen num"er and enter.

Pro!ide short description and clic, on layout.

Module Pool layout designer will open& clic, on G:ictionary9Program Felds iconG
$see "elow image%& a popup will open& pro!ide name as AA3MA6A& clic, on G>et
from programG& select all rows and enter.

Mo!e mouse cursor on layout and place the form in suita"le position.

'ow clic, on te#t icon& put it "efore any input Feld and enter te#t.

Similarly create la"els for all Felds.

Insert "utton& pro!ide te#t as G>et :ataG& dou"le clic,& pro!ide a name & fct code&
enter and close.
Sa!e and Acti!ate.

+lose the layout and go to program and clic, on Eow logic.


uncomment modules.

:ou"le clic, on each module and create them in main program.

After creating two modules& go to PAI and add "elow code.


I- SB-*+)MM H G>ETMG .

SE8E+T SI'>8E = -6)M MA6A I'T) +)66ESP)':I'> -IE8:S )- AA3MA6A


A@E6E MAT'6 H AA3MA6A-MAT'6.
E':I-.

6ight clic, on program& create -2 transaction.

Pro!ide transaction code as ?SAP'3MAT3MPP& pro!ide short te#t and enter.

Pro!ide program name as ?SAP'3MPP3MATE6IA8& screen no as 5 and sa!e in a


local o"Cect.

'ow go to t-code ?SAP'3MAT3MPP& pro!ide a material no and clic, on get data


"utton& it will get output.

Potrebbero piacerti anche