Objective - In
this document we will see how to create a very simple module pool programming
using a single screen, with radio buttons, list box and check box on the
screen.
At the end of the Program we will see the output screen
as shown below

Table - ZKPROJ_MASTER

From the MPP we will update the data in above table

Enter the T. code SE80

Select Program from the Drop box, enter program name as
ZKMP_01 and press enter.

As this program does not exit, click yes to create it.

Select the check box with top includes and press enter.
Top include, we will use for all data declaration.

Give the name for top include program and press enter.

Here enter the Title of the Program, the type will be M -
module Pool, which will come automatically and click on save.

if we want to transfer this program , enter the package
name, or click on Local Object, here we will save in local object.

Here we can see one main program ZKMP_01 with include ZKMP_01_TOP created.

To activate, right click on Program ZKMP_01 then select
Activate.

Press enter.

we can see both the program are active now,

Now we will create a screen, Program ZKMP_01-> Create
->Screen.

Enter the screen no 0100 and press enter.

Enter the Description, by default the screen type will be
normal, keep as it is, the Hold Data -> Hold data will hold the data on
screen, if we have multiple screen and navigating from one to another, Hold
Scroll Position, will hold the position, if we have big screen also select the Without application toolbar.
Then click on flow logic Tab.

We can see two blocks PROCESS BEFORE OUTPUT and PROCESS
AFTER INPUT , and modules in that are comment, open the comment, to create it.

Now first double click on MODULE STATUS_0100 to create
it.

Click on Yes.

Here we will provide won include name which is to be
create.

Enter the name as ZKMP_01_PBO and press enter

Again press enter.

We can see the module get created in the include which we
have mention, with pf status and title bar as comment.

Un comment both and enter the name which we want to
create
PF STATUS 'PF1'
TITLEBAR 'T1'.
to create it double click on 'PF1'.

Click yes, we can also create it using SE41.

Enter the short
text, and press enter.

Expand the Function key, as we want to create Save, back
and Exit button.

Enter the name as save, back, exit and cancel,
save check and activate the PF status.

once it is activated click on Back button on the screen.

Now double click on 'T1' to create the title bar.

Click on Yes.

Enter the Title which we want to print on the screen, and
click on All title to activate it.

Save check, activate and click on Back button.

Activate the include program and click on back button.

Now in the top include declare the data which we want to
use in the program.
Activate it, and then open the screen 0100.

Click on Layout icon, as shown above.

To add the fields on the screen, click on icon,
Dictionary/Program fields.

Enter the internal structure name which we have declared
in the top include data declaration and click on Get from program.

Select all the fields which we want to add on the screen
and click on Enter.

Just drag and drop selected fields on the screen.

If field length is more than screen visible area, system
will prompt the message as shown above press enter.

Now arrange the fields on the screen.

First field is the project id as per our table, to open
its properties, just double click on field.

To add a text field, click on Text Icon as shown on the
scree.

just drag and drop the text field on the screen, and
double click on it, for its properties.

Enter the name, text, click on Display tab and select as
label on left. and close the property window.

Now project id field we want to make as output only, to
make as output double click on Project id field.

Click on Program tab, and uncheck the check box, Input
field.

Now as the address field length is more we will just make
it scrollable on the screen, for that double click on the field then in
properties select the check box scrollable and enter the visible length press
enter and close the property window.

Add the text field for address. Follow the same for all
other field on the screen.

Now for the field active, as it is single char filed , we
will make this field as check box.

right click on the field active, select
Convert -> Checkbox -> Left button

We can see that field as check box.
Now we will add the push button on the screen,

select the icon Push button and drag and drop it on the
screen.

Double click on it.

Here enter the name, text which we want to display on
button and enter the Function code as 'SAVE',
the use of functional code is when user will click on
this button in PAI, user command we will get the value as 'SAVE'.

Now save, check and activate.

Press enter.

Close the screen.

Now we will create the PAI module, double click on the
MODULE USER_COMMAND_0100.

Click on Yes

Change the PAI include name as per requirement.

Include ZKMP_01_PAI, press enter.

Again press enter.

Write the required logic in the include module, PAI will
get triggered when we press any gui function on the screen, like back, save,
cancel etc.

when user click back or cancel or exit button, system
will leave the program, as we have only one screen, set screen 0 , leave to
previous screen.
When save button is clicked, perform save, will get
perform.
Double click on perform save, to create the save module.

Click Yes.

Give the include name, in which we want to add the form
logic.

Include name - ZKMP_01_FORM and press enter.

Press enter.

Add the logic in the form routine.


as per the logic mention above,
if project name is not entered, system will give the message as 'please enter the project name'
else, system will select the last i.e max project id from
the table and for the new project id 1 will be added in the last project id, if
there is no project created in the system , first no. will be start with 100.
save, check and activate the new include.

Now activate the main program.
ZKMP_01 -> Activate.

Press enter.

as the module pool program can be executed using a
transaction code only, for this create the transaction.
zkmp_01 -> create -> transaction

Enter Transaction code, short text select the radio
button, Program and screen (dialog transaction) , and press enter.

Enter the Program name, first screen no, select all the
check box, in the GUI support, save and then click on test, button.

We can see the screen created as shown above.

Enter the test data, and then, click on SAVE button.

we can see the message, Project 0103 created.

We can see in the table.
Here we have finish our first module pool program
Now we will make the radio button, check box and drop
down list on the same screen.

on the screen, 100 click on layout.

we will make the highlighted Type field with radio
buttons, as the project type can be a Residential or Commercial or both.

Delete the type field and click on Dictionary/Program
Fields.

as we have declare three single char variables R1, R2, R3
in the top include of the program. select the variables and clcik on enter (4)
on the screen.

Drag and drop the R1, R2 and R3 variables on the screen.

To convert the variables as radio button, right click on
the field then -> convert -> radio button -> left button

Double click on radio button.

In the attributes window, give the name as Residential.

In the same way, convert the remaining two variables into
radio button, and provide the name as Commercial and Residential/Commercial.

Now as we want that any one radio button should get
select at a time, for this select all the radio button by pressing the ctrl
key.

Right click -> Radio Button Group -> Define.
Save and activate the screen.
Now next , we need to make the state and city as list
box, with dependent values, like depending on the state which is selected, show
the cities in the city list box, for this first take the city up and state down
on the screen.

Double click on the state field.

In the attribute view, select the list box with key.

as the element getting overlapped, take the pin code
field below the state.

we can see the state field , converted as list box, in
the attribute window, we can set the visible length of the list box on the screen.

as we want that, depending on the value, which is
selected in state, we need to show the values in city, for this an event should
get trigger, when user select any value in the state, in the attribute window
of state assign any function code here we are using Fun. Code as 'STATE'.

in the same way, convert the city as list box.
For the values which we want in the state field, add the
required code in the PBO of screen 100.

we will display 3 states in the list, Maharashtra, Goa
and Karnataka.
Here for the display the values in the list box we need
to use the Function module vrm_set_values
by providing the id of the field 'GS_MASTER-STATE'.

In the PAI module of the screen, write the logic for
getting the cities based on the state which is selected.

Double click on the perform
get_city and then click Yes.

Select the existing includes ZKMP_01_FORM and press
enter.


Add the required logic, save check and activate the
include.
as we have also convert the type as radio button, add the
required logic, in the save, routine.

Depending on the radio button which is selected, set the
project type.

Activate the main program.

Now test the transaction.

we can see the radio button, and also the list box, now
select the state as Maharashtra from the list box.

select the city from the list box.

Enter all the details and click on save button.

We can see the message of new project creation.

Check the entry in table
Here we have completed our first Module Pool Program
with Radio button, check box and list box.......Thank You.....
0 Comments