133798929 Module Pool Programming

99
* Module Pool Programming* BY ----Arjun

Transcript of 133798929 Module Pool Programming

Page 1: 133798929 Module Pool Programming

*Module Pool

Programming* BY ----Arjun

Page 2: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 2

Objective

Introduction:It is a special type of programming which is used to

create custom SAP Screen as per business requirement.

SE80 is the TCODE for creating MPP programs.Every MPP program must be executed with a

transaction.

Page 3: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 3

Events in MPP

Page 4: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 4

Events in MPP

Events in Module Pool Programming

There are four events available.PBO (Process Before Output):Triggered before MPP screen is

displayed

PAI (Process After Input): Triggered after MPP screen is displayed whenever user raises an action.

Also,Now PBO is also triggered.

POV (Process On Value Request): Triggered when User Clicks on search help or F4 Button

POH (Process On Help Request): Triggered when User Clicks on search help or F4 Button

Page 5: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 5

Execution Flow of MPP prg

Page 6: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 6

Execution Flow of MPP prg:

PBO is triggered

User Enters input

Screen is displayed

PAI triggered

Page 7: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 7

Modularization technique in MPP program

Page 8: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 8

Modularization technique in MPP program

Include prg’s:

Basically there are four include programs which are created automatically for an MPP program

• <MPP name>_TOP top include program All data declarations.

• <MPP name>_o01PBO include program All logic related to PBO event

• <MPP name>_I01PAI include program All logic related to PAI event

• <MPP name>_F01Forms include program All logic related to subroutines

Page 9: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 9

Screen

Page 10: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 10

Screen

SCREEN: It is a visible layout which is displayed in the output. The components of the Screen are

Components of Screen: Attributes : Properties of screen Element List : List of UI/Library elements Flow-Logic : Abap logic related to MPP Layout : Screen Designing Area

Page 11: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 11

FLOW-LOGIC

Page 12: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 12

FLOW-LOGIC

It will contain the logic related to screen in the form of modules

By default, 2 events will be available with their corresponding modules as below:

Just uncomment the modules and create them and write the abap logic.

PROCESS BEFORE OUTPUT. *MODULE STATUS_0100.

PROCESS AFTER INPUT. *MODULE USER_COMMAND_0100.

Page 13: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 13

MODULE

Page 14: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 14

MODULE

MODULE: It is an sub-program which contains the ABAP code for a

screen . Flow-Logic cannot understand ABAP statements. So the

entire ABAP code is written in the form of modules Since the entire abap logic is divided in the form of

modules, that is why it is called MODULE POOL PROGRAMMING

Page 15: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 15

Simple program in MPP

Page 16: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 16

STEPS TO CREATE AN MPP PROGRAM

STEPS: Go to SE80 Select program from dropdown list Give a name & press enter Click on YES Click on Continue Give a name for TOP include program Press ENTER The program will be created Uncomment each include program and create them Right click on the program nameACTIVATE

Page 17: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 17

Page 18: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 18

STEPS TO CREATE A SCREEN

Page 19: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 19

STEPS TO CREATE A SCREEN

Creating a Screen: Right click on program nameCreateScreen Give the screen number as 0100 and Press ENTER Give the description Click on Flow-Logic Uncomment the modules and create them as below

Page 20: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 20

STEPS TO CREATE A SCREEN

Click on Layout Button Drag and drop text UI element onto the screen Double click on it Provide the name and texts Name T1. Text ‘This is a sample Program’. Check the below screen shot

Page 21: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 21

Click on FlowLogic Double click on PBO module And write the below code

Page 22: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 22

STEPS TO CREATE A SCREEN

Module Set PF-STATUS ‘MENU100’. Set Title bar ‘TITLE01’.

End module Click on Save and Back Double click on PAI module

Write the below code

Module User-command-0100 input.

If sy-ucomm = ‘BACK’.

Leave to screen 0.

Endif.

End module.

Page 23: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 23

STEPS TO CREATE A SCREEN

Save and activate. Right click on Program name

create.Transaction.

Give the text, program name, screen number. Select all the checkboxes at the bottom. Save it. Execute the transaction and test the program.

Page 24: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 24

A Real time Ex on MPP

Page 25: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 25

Business Req: Create a MPP which displays material details for a given material no

Create a MPP prg in SE80 and create all include programs

Create a Screen and create PBO and PAI Modules

Goto TOP Include prg and declare the following .

Page 26: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 26

Save & Activate TOP Include prg immediately

Now goto Screen 0100 layout.

Click on Dictionary/Program fields ICON

Give the name as wa_mara

and click on

Select all fields and press enter

Place all the fields on the screen

Page 27: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 27

Now Drag and drop text fields from library and place them before each input field .

Now Drag and drop a button also and provide the details as below:

Also provide FCT code as GET

Finally the screen should look as below.

Page 28: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 28

FCT CODE : It is a function code which is used to identify the button which is clicked

The FCTCODE is automatically stored in a system variable SY-UCOMM.

Now go to PAI module and write the below code.

Save,Activate,Test it.

Page 29: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 29

The output is : Enter the Material no

Click on GET button

The details should be displayed

Page 30: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 30

Making Input Fields Disable

Page 31: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 31

Making Input Fields Disable

Making Input Fields Disable: Double click on any input field

The properties screen is displayed

Set the property as below

Select program input not possible

Page 32: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 32

Single Field Validation

Page 33: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 33

Single Field Validation

It is Used to Validate a single field or particular field on MPP screen. It is similar to ‘AT SELECTION SCREEN ON FIELD’.

Syntax :-

Field <Field-name> Module <Module-Name>.

Example :-

Field V_matnr Module Validate_matnr.

Ex Prg:

Create a prg as below:

Page 34: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 34

Write the below code under PAI event.

Double click and create the module .

Write the below code in the module

Save, activate and test it .

Page 35: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 35

Multiple Field Validation

Page 36: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 36

Multiple Field Validations

CHAIN---------ENDCHAIN is the Keyword which is used to validate multiple fields.

It is similar to AT SELECTION-SCREEN

CHAIN.

Field : <Field-Name1>,

<Field-Name2>,

<Field-Namen> .

Module <Module name>.

ENDCHAIN.

Ex Prg:

Create same prg as above:

Page 37: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 37

Here I want to validate both MATNR and MTART fields.

Write the below code under PAI event.

Create the module and write the below code

Page 38: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 38

Save, activate and test it .

The difference b/w single field and multiple field validation is :

Single field validation:

It is used to validate a single field.

Only that particular field which is validated is input enabled when there is an error.

The remaining fields will be input disabled.

With Multiple field validation:

It is used to validate multiple fields.

All the fields which are in between CHAIN..ENDCHAIN are input enabled when there is an error.

The remaining fields will be input disabled.

Page 39: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 39

USING CHECKBOX in MPP

Page 40: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 40

USING CHECKBOX in MPP

Steps:- Create a program in se80.

Define the below data declarations in the Top include file.

Creating a Screen:

Create Screen 0100.

Create a PBO module and PAI module.

PROCESS BEFORE OUTPUT. MODULE STATUS_0100.

PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

 

Page 41: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 41

SCREEN LAYOUT Click on layout button.

Click on dictionary/program fields icon.

Give the field name as V_CH1.

Select radionutton as below

 

Place it on the screen. Click on dictionary/program fields icon again .

Give the field name V_TEXT  Place it on the layout

Page 42: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 42

Dobule click on the check and set the below properties : NAME,TEXT,FCTCODE

Now go to PAI module and write the below code.

Save,Activate,Test it.

Page 43: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 43

USING RADIOBUTTON in MPP

Page 44: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 44

RADIOBUTTON IN MPP

Steps:-

Create a program in se80.

Define the below data declarations in the Top include file.

DATA  : v_RB1(1) TYPE C VALUE 'X'.DATA  : V_RB2(1) TYPE C.DATA  : V_TEXT1(25) TYPE C.

Creating a Screen:

Create Screen 0100.

Create a PBO module and PAI module.

PROCESS BEFORE OUTPUT. MODULE STATUS_0100.

PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

Page 45: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 45

SCREEN LAYOUT Click on layout button.

Click on dictionary/program fields icon.

Give the field name as *.

Select the following as below:

Place them on screen

Now Select two radiobuttonsRightclickRadiobuttonGroup Deine

Page 46: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 46

Provide the properties as below or each radiobutton:

Write the below code in PAI Module.

Save activate and test

Page 47: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 47

USING TABSTRIP in MPP

Page 48: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 48

TABSTRIP

Tab strip’s are used to divide the main screen into sub screens to display mass amount of data.

Each sub screen is called as a TAB. Each sub screen Should be designed separately with a no. Each sub screen must have an area to display the sub screen called as Sub

screen area When you drag and drop the TABSTRIP from the library, two tabs will be

displayed by default For each tab create the sub screens and sub screen areas CONTROLS is the keyword used to declare a tab strip.

Ex: CONTROLS : TABSTR TYPE TABSTRIP. ACTIVETAB is the property to set a particular tab to be active.

EX: TABSTR-ACTIVETAB = ‘TAB1’ .

TABSTR-ACTIVETAB = ‘TAB2’ .

Page 49: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 49

Finally use the below syntax under the PBO event to assign each sub screen no to its corresponding sub screen area

Syntax :-

Call subscreen <subscreen area >including <program name> <sub screen>.

Ex:-

Call subscreen SUBAREA1 including sy-repid 0200.

Call subscreen SUBAREA2 including sy-repid 0300.

Page 50: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 50

Syntax to declare tabstrip:-

CONTROLS<tabstrip mane >type tabstrip.

Ex :- controls TBSTR type tabstrip.

Active tab:- It is an option in the tab strip to activate the corresponding TAB.

Syntax:-

<tabstrip name >-active tab=‘TABNAME’.

Ex :- TBSTR-active tab =‘tab1’.

TBSTR-active tab =‘tab2’.

Page 51: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 51

Real Time Ex on TABSTRIP

BR: Develop a MPP prg which display material details and description details in 2 separate tabs.

Page 52: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 52

• STEPS:

• Create an MPP Prog

• Create a MAIN screen by no 1000

• Goto top include prg and declare a TBASTRIP and other data declarations as below

• Save activate immediately

Page 53: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 53

Designing Screen

Goto screen 1000layout

Click on Dictionary/program fields icon

Give the fieldname as V_MATNR and click on GET FROM PROGRAM button

Place the field on layout

Provide the text lable for the field.

The screen should look as below.

Page 54: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 54

Drag and Drop tabstrip onto layout.

Double click on tabstrip (exactly at center) and set the name as TBSTR(name given in top include prog)

By default 2 tabs will be created.

Double click on TAB1, give the text as ‘GEN.DATA’,give the FCT code as TAB1.

Similarly, Double click on TAB2, give the text as ‘DESC.DATA’, give the FCT code as TAB2.

Page 55: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 55

Click on TAB1,Drag and drop a subscreen under TAB1

This is because each TAB should have a subscreen area to display subscreen

give the name as SUB1.

Similarly click on TAB2,Drag and drop a subscreen under TAB2 , give the name as SUB2.

Click on FLOW-LOGIC

Write the below code under PBO event. This is because we need to assign each sub screen no to its corresponding sub screen area

Page 56: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 56

Write the below code under PAI event.

Create the GET_DATA module and write the below code

Page 57: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 57

CREATING sub screens

Now create 2 sub screens by the numbers 0100 and 0200

Page 58: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 58

Goto subscreen 0100

Click on layout button

Click on Dictionary/program fields icon

Give the fieldname as WA_MARA and click on GET FROM PROGRAM button

Select and Place all the fields on layout

Provide the text lable for all fields.

The screen should look as below.

Page 59: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 59

Now Goto subscreen 0200

Click on layout button

Click on Dictionary/program fields icon

Give the fieldname as WA_MAKT and click on GET FROM PROGRAM button

Select and Place all the fields on layout

Provide the text lable for all fields.

The screen should look as below.

Page 60: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 60

Finally write the below code to activate the tabs in PAI module.

SaveactivateTest it

Page 61: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 61

GIVE MATERIAL NO AND PRESS ENTER

Page 62: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 62

CLICK ON 2ND TAB.

CHECK THE DESCRIPTION DETAILS ALSO

Page 63: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 63

Steps for tabstrip:-

STEPS: Create an mpp program. Declare TABSTRIP in top include program. Drag and drop tab strip on to the screen. By default, 2 tabs will be available Create subscreen areas for each TAB. Cerate subscreen for each TAB. Assign each subscreen to subscreen area under PBO event. Write code in PAI to activate tabs based on user action.

Page 64: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 64

USING TABLE CONTROL in MPP

Page 65: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 65

TABLE CONTROL

o TABLE CONTROL : It is an element which is used to display the data in the form of a table format is called TABLE CONTROL.

There are 3 important points to be followed, when working with table control.

1. Table control declaration.

2. Loop at ITAB into WA with control <table control name>(IN PBO).

1. Endloop

3. Loop at ITAB (IN PAI).

1. Endloop.

Page 66: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 66

TABLE CONTROL

Table control declaration

Syntax :-

Controls : <table control> name type table view using screen <screen no>.

Loop at PBO

The loop at ITAB into WA…………end loop must be used in PBO event to read each record from ITAB internal table into work area and then work area to table control columns

Page 67: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 67

TABLE CONTROL

Loop at PAI

The loop at ITAB into WA…………end loop must be used in PAI event to read each record from table control columns into internal table

PBO event

ITAB --------------WA----------------Table control.

Loop at ITAB into WA with control <table control name>

Endloop

Page 68: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 68

TABLE CONTROL

PBO EVENT

PAI EVENT

Page 69: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 69

TABLE CONTROL

PAI Event

Table Control ---------Internal Table ------------- Work area.

Loop at ITAB .

Endloop.

Vertical scrollbar : In Table control by default, we don’t get vertical scroll bar.

To display it, use the below syntax

<TABLECONTROLNAME>-LINES = <NO>

Horizontal & Vertical Lines : In Table control by default, we don’t get vertical and

Horizontal lines.

To display them, Set the below property.

Page 70: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 70

Ex on Table control

Busniess Req : Develop a MPP program which displays list of the material for a material type.

Steps:- Create a program in se80.

Define the below data declarations in the Top include file. 

Save & activate.

Page 71: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 71

SCREEN Create Screen 0100.

Write the below statement under the PBO event.

SCREEN LAYOUT Click on layout button.

Click on dictionary/program fields icon.

Give the field name as v_mtart.

Place it on the screen.

Provide a text(MATERIAL TYPE ) for the input field.

Page 72: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 72

Drag and drop a button & define the properties.

Name: GET

Text : GET DATA

Fctcode: GET

The screen should look as above

Drag and drop table control UI element on the screen.

Double click on it, set the properties as below.

Name = TBCL (same as top include file name)

Separators:-  

Vertical

Horizontal 

Click on the dictionary / program fields icon.

Give the field name as wa_mara.

Click on continue.

Place them on the table control UI element.

Each field will be displayed as column.

Page 73: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 73

Provide the column headings by drag & drop using text label. Click on text field, place it on the first column.

Give the name as T1, text as matnr. Repeat for all fields

Textfield1 Textfield2 Textfield3 Textfield4

Name :T1 Name :T2 Name :T3 Name :T4

TEXT: Matnr TEXT: mtart TEXT: mbrsh TEXT: meins

Click on the flow logic.

Double click on the PAI module, write the below code.

Save & activate.

Create a transaction & test it.

Page 74: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 74

TESTING

Execute the TCODE.

The output is as below:

Page 75: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 75

Table Control With Modification

Page 76: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 76

Table Control With Modification.

Create same program as below. Do the below changes

Declare a new Workarea and internal table as below:

Go to the screen layout, add a button by

name = save,

text = save data,

Fct code = save.

write the below logic under PAI Event

 

Page 77: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 77

Double click on the module get_modified_recs.

Write the code as here

Double click on the PAI module & write the below code.

  IF SY-UCOMM = 'SAVE'.    MODIFY MARA FROM TABLE I_MARA2. "UPDATE DATABASE     IF SY-SUBRC = 0.      MESSAGE : 'THE DATA IS SUCCESSFULLY MODIFIED' TYPE 'I'.    ENDIF.

*********Move THE MODIFIED DATA BACK TO ORIGINAL ITAB(I_MARA)*********    REFRESH I_MARA.    LOOP AT I_MARA2 INTO WA_MARA2.      MOVE-CORRESPONDING WA_MARA2 TO WA_MARA.      APPEND WA_MARA TO I_MARA.    ENDLOOP.  ENDIF.

save , activate & test it.

Page 78: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 78

CALL SCREEN AND SET SCREEN

Page 79: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 79

Navigation between Screens

o Whenever we want to move from one screen to another screen we use below two statements.

CALL SCREEN.SET SCREEN.

Page 80: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 80

CALL SCREEN

CALL SCREEN

This statement is used to call the new screen by suspending the current screen

Once the new screen processing is finished it will come back or resume back to the old screen and continuous its processing.

Page 81: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 81

SET SCREEN

SET SCREEN This statement will not call any new screen, but it will

set a new screen as a next screen Once the current screen is finished totally, then it will

call new screen Once the new screen is processed it will not come

back automatically to the previous screen If we want to came back, use the statement LEAVE TO SCREEN <SCREEN NO>.

Page 82: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 82

POV and POH EVENTS

Page 83: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 83

USING POV,POH EVENTS

PROCESS ON VALUE REQUEST :

This event is triggered whenever the user clicks on search help button for an input field.

Syntax :-

PROCESS ON VALUE REQUEST.

FIELD <FIELD NAME> MODULE <MODULE NAME> .

Page 84: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 84

PROCESS ON HELP REQUEST

PROCESS ON HELP REQUEST :

This event is triggered whenever the user clicks on F1(Help Button).

Syntax : -

PROCESS ON HELP REQUEST.

FIELD <FIELD NAME> MODULE <MODULE NAME> .

Page 85: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 85

Ex on POV Event:

→ create a MPP programe

→ create a screen 0100.

→ Declare a below STMT in top include file.

Data : v_file type RLGRAP-filename.

→ save , active.

→ Go to screen 0100 layout.

→ Place an input field & text field on screen as below.

Page 86: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 86

→ click on flow logic.

→ Write the below code.

PROCESS ON VALUE-REQUEST . FIELD V_FILE MODULE GET_F4 .

Create the module and write the below code:

MODULE GET_F4 INPUT.CALL FUNCTION 'KD_GET_FILENAME_ON_F4' EXPORTING   PROGRAM_NAME        = SYST-REPID   DYNPRO_NUMBER       = SYST-DYNNR   FIELD_NAME          = 'V_FILE'  CHANGING    FILE_NAME           = V_FILE .ENDMODULE.                 " GET_F4  INPUT

→ Save , Active & Text it.

Page 87: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 87

The output is :

Click on F4 button and below is the screen

Page 88: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 88

Ex on POV Event:

Same prg as above…but just write the below event in screen 100

Flowlogic

Process on Help-Request

Field V_File module GET_F1.

→ create the module and write the below code in the module.

Module GET_F1 INPUT.

Message ‘please select file name’ type ‘I’.

Endmodule.

Page 89: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 89

MANDATORY FIELDS ON MPP SCREEN

Page 90: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 90

MANDATORY FIELDS ON MPP SCREEN

Mandatory fields steps:

→ Double click on the field where you want to set mandatory parameter.

→ Go to the ‘program’ tab,

set as Input = Required.

→ Save , Active & Test it.

Note: If we don’t enter any value on mandatory field and click on the back button system will throw an error message

Page 91: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 91

Ignoring the Mandatory fields:-

o If we want to ignore or exit an MPP screen without entering the mandatory fields, then please follow the below steps.

→ Create or Activate ‘EXIT’ button in the ‘ SET PF-STATUS’

with fctcode as EXIT

→ Double click on the Exit button set the function type = ‘E’

Where E stands for Exit command.

→Then we need to create a separate module in the PAI event for this ‘ EXIT’ command

Page 92: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 92

Syntax:- Module xxx at Exit Command.

→ Click on the flow logic & write the below code.

PROCESS AFTER INPUT.Module module_EXIT AT EXIT-Command.

→ Create the module and write the below code.

Module module_EXIT Input.

Case sy-ucomm.

When ‘EXIT’.

Leave program.

Endcase

Endmodule.

→ Save, Active & Text it.

Page 93: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 93

ASSIGNING SEARCH HELP’S FOR INPUT FIELD

Page 94: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 94

ASSIGNING SEARCH HELP’S FOR INPUT FIELD

If we want to assign a search help to an input field, double click on it.

1. Goto dictionary tab.

2. Set the property Search help = ‘xxxx’.

Page 95: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 95

TYPES OF SCREENS

Page 96: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 96

TYPES OF SCREENS

There are basically Three types of screensNORMAL SCREEN : A main screen with minimize,

maximize and close buttons is called a NORMAL SCREEN

SUBSCREEN : A part of screen with in a main screen is called a SUBSCREEN.

Generally subscreens are used in TABSTRIPS.

MODEL DIALOG BOX : A screen with only close button is called MODEL DIALOG BOX.

Generally this screen is used to display POP-UP’s

Page 97: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 97

INTERVIEW QUESTIONS

What are the various events available in MPP, explain with example?

What are the various include programs in MPP? What do you write in the Flow-Logic ? What is a MODULE? How do you create a transaction? What is the system variable where FCT code is stored? How do you disable an input field? How do you validate a single field? How do you validate a multiple fields? What is the exact diff b/w single field& multiple fields

validation?

Page 98: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 98

INTERVIEW QUESTIONS

What is the use of sub-screen area? What is a table control? What is the use of loop at itab into PBO and PAI? Tell me about table control with modifications? How do you vertical scroll bar in table control? What is the difference between call screen and set screen? How do you create mandatory fields? How do you exit an MPP screen without entering the

mandatory fields? How do you assign a search help? What are the various types of screens and explain each?

Page 99: 133798929 Module Pool Programming

SAP AG 2001, Smart Forms - the Form Printing Solution,Claudia Binder / Jens Stumpe 99

.THANK YOU