SlideShare a Scribd company logo
1 of 123
©India SAP CoE, Slide 1
Topic: ABAP report – Module Pool Programming
Created By: SAP Team
Approved By: Sachin Dayma
Date of Release: July, 2008
Version: 1.0
©India SAP CoE, Slide 2
Module pool programmingModule pool programming
1 Introduction
2 Syntax Description
3 Demonstration
4 Exercises
5 HelpMe
©India SAP CoE, Slide 3
Module Pool program.
Module Pool Program (also called Online programs , dialog programs,
or transactions) do not produces lists. These programs are a collection
of screens, their Flow Logic, and the code within the main ABAP
program.
A dialog program offers:
• A user-friendly user interface
• Format and consistency checks for the data entered by the user
• Easy correction of input errors
• Access to data by storing it in the database.
©India SAP CoE, Slide 4
PurposePurpose
For performing any kind of task in SAP R/3 system, a transaction is used.For performing any kind of task in SAP R/3 system, a transaction is used.
SAP provides a standard set of transactions to manipulate data in theSAP provides a standard set of transactions to manipulate data in the
system. But sometimes, the need to create a customer specific transactionsystem. But sometimes, the need to create a customer specific transaction
arise due to following reasons :arise due to following reasons :
 Standard SAP may not support that task.Standard SAP may not support that task.
 A particular transaction needs to be customized to suit the customerA particular transaction needs to be customized to suit the customer
requirements .requirements .
A transaction (also called module pool programs, dialog programs) isA transaction (also called module pool programs, dialog programs) is
defined as a collection of screens (the actual, physical image that the usersdefined as a collection of screens (the actual, physical image that the users
sees), their Flow Logic (code behind the screens ), and the code within thesees), their Flow Logic (code behind the screens ), and the code within the
main ABAP program.main ABAP program.
©India SAP CoE, Slide 5
Program Attributes
Title
Type “M”
Application
Online program name
must begin with either a
“Y” or “Z”.
Go back to Repository
Browser, not source
code.
“With TOP INCL.”
should be checked.
Creating an Online ProgramCreating an Online Program
©India SAP CoE, Slide 6
Module Pool Program ComponentsModule Pool Program Components
Top Include
PBO Modules
PAI Modules
ABAP
Subroutines
©India SAP CoE, Slide 7
• An online program consists not only of the screens and their Flow Logic,An online program consists not only of the screens and their Flow Logic,
but also ABAP program components: Global data, PBO modules, PAIbut also ABAP program components: Global data, PBO modules, PAI
modules, and subroutines.modules, and subroutines.
• Global data: It is declared in the Top Include program.Global data: It is declared in the Top Include program.
• PBO and PAI modules: It contain the main processing logic of onlinePBO and PAI modules: It contain the main processing logic of online
program and are “called” from within the Flow Logic of the screens.program and are “called” from within the Flow Logic of the screens.
• The subroutines (if necessary) are in a separate include program.The subroutines (if necessary) are in a separate include program.
Module Pool ProgramModule Pool Program
©India SAP CoE, Slide 8
Transaction Code
Transaction
Text
F8
Program Name Initial Screen
required required required
Executing an Online ProgramExecuting an Online Program
©India SAP CoE, Slide 9
Module pool programmingModule pool programming
1 Introduction
2 Syntax description
3 Demonstration
4 Exercises
5 HelpMe
©India SAP CoE, Slide 10
Tools used:Tools used:
When creating an module pool program, you will use many tools withinWhen creating an module pool program, you will use many tools within
the ABAP Development Workbench: Screen Painter, ABAP Editor,the ABAP Development Workbench: Screen Painter, ABAP Editor,
Menu Painter, ABAP Dictionary, and Repository Browser.Menu Painter, ABAP Dictionary, and Repository Browser.
• ABAP Editor (SE38) – To maintain main ABAP program. Program
contains data declarations and modules.
Online Programming | 2.01 | August-2003Slide 2
IBM Global Services
© Copyright IBM Corporation 2003
Developing Online Programs
Repository Browser
Screen Painter ABAP Editor
ABAP Dictionary
Menu Painter
©India SAP CoE, Slide 11
•Screen Painter(SE51)– used to maintain components of screen.
•Menu Painter(SE41) – Used to design GUI.
•Maintain Transaction(SE93) – To create transaction code for program.
•Object Navigator (Repository Browser)(SE80) - You should always use
the object navigator for online programs because you will be able to see the
hierarchy. From this hierarchy list, you will be able to branch to the Screen
Painter, ABAP Editor, Menu Painter, and ABAP Dictionary.
•You should always use the Repository Browser to create online programs
because the system will automatically maintain an online program’s sub-
objects and you will be able to see the hierarchy list of these sub-objects.
From this hierarchy list, you will be able to branch to the Screen Painter,
ABAP Editor, Menu Painter, and ABAP Dictionary.
Tools used:Tools used:
©India SAP CoE, Slide 12
Creating a ProgramCreating a Program
• Create a program using transaction SE38. Program name as
Z_MODULE_TRAINING.
• Program type should be Module Pool. Save and activate the program.
• Use object navigator(SE80) to further develop the object.
©India SAP CoE, Slide 13
Program StructureProgram Structure
• Module pool program when viewed from SE80 transaction will haveModule pool program when viewed from SE80 transaction will have
structure as below,structure as below,
©India SAP CoE, Slide 14
Assigning transaction codeAssigning transaction code
• Dialog program is executed using transaction code. We can not executeDialog program is executed using transaction code. We can not execute
this like normal report using execute or pressing F8 button.this like normal report using execute or pressing F8 button.
• Transaction is created using SE93 transaction or from object browser byTransaction is created using SE93 transaction or from object browser by
right clicking on transaction, click on create. Give name and descriptionright clicking on transaction, click on create. Give name and description
and select the radio button Program and screen (dialog transaction)and select the radio button Program and screen (dialog transaction)
©India SAP CoE, Slide 15
Use of ScreenUse of Screen
• Screen is a interface between user and SAP.Screen is a interface between user and SAP.
• Using screen user can provide input to program and in turn program willUsing screen user can provide input to program and in turn program will
display result on screen.display result on screen.
• Screen is made up of screen elements such as text box, input/outputScreen is made up of screen elements such as text box, input/output
field, check box, radio button etc.field, check box, radio button etc.
• One of the strength is that screen elements are combined with theOne of the strength is that screen elements are combined with the
ABAP dictionary to allow check the consistency of the data that userABAP dictionary to allow check the consistency of the data that user
has entered.has entered.
©India SAP CoE, Slide 16
Screen PainterScreen Painter
• To start the Screen Painter, choose the corresponding pushbutton on theTo start the Screen Painter, choose the corresponding pushbutton on the
initial screen of the ABAP Workbench or enter Transaction SE51.initial screen of the ABAP Workbench or enter Transaction SE51.
• Best practice is to go to transaction SE80, enter program name and youBest practice is to go to transaction SE80, enter program name and you
can perform one of the below,can perform one of the below,
1. Create new screens.1. Create new screens.
2. Test an existing screen.2. Test an existing screen.
3. Create new components for an existing screen3. Create new components for an existing screen..
• Screen is always created for an existing program.Screen is always created for an existing program.
©India SAP CoE, Slide 17
Overview of Screen PainterOverview of Screen Painter
Screen Painter
Screen
Attributes
Screen
Layout
Field
Attributes
Flow Logic
©India SAP CoE, Slide 18
Developing ScreenDeveloping Screen
• From Object navigator (SE80) we can create the screen as shown,From Object navigator (SE80) we can create the screen as shown,
• Click on Screen, right click and select create option.Click on Screen, right click and select create option.
• Now enter screen number.Now enter screen number.
©India SAP CoE, Slide 19
Developing ScreenDeveloping Screen
Screen numbers can be up to 4 characters long, all of which must beScreen numbers can be up to 4 characters long, all of which must be
digits.digits.
The number 1000 is reserved for table screens and report selectionThe number 1000 is reserved for table screens and report selection
screen.screen.
Screen numbers from 9000 are reserved for customer-specific screens.Screen numbers from 9000 are reserved for customer-specific screens.
The use of screen numbers is namespace-dependent.The use of screen numbers is namespace-dependent.
For screens in programs in the SAP namespace, numbers less than 9000For screens in programs in the SAP namespace, numbers less than 9000
are reserved for SAP screens, numbers between 9000 and 9500 areare reserved for SAP screens, numbers between 9000 and 9500 are
reserved for SAP partners, and numbers greater than 9500 are forreserved for SAP partners, and numbers greater than 9500 are for
customers.customers.
©India SAP CoE, Slide 20
• For screens in programs in the Customize namespace, any four digitFor screens in programs in the Customize namespace, any four digit
number can be used as screen number except 1000 as mentioned above.number can be used as screen number except 1000 as mentioned above.
• Usual practice is to have screen numbers for customize module poolUsual practice is to have screen numbers for customize module pool
program, starting with 100 then continue as 200, 300 etc.program, starting with 100 then continue as 200, 300 etc.
• Enter screen number and click on create.Enter screen number and click on create.
Developing ScreenDeveloping Screen
©India SAP CoE, Slide 21
Developing ScreenDeveloping Screen
Enter description and save.Enter description and save.
Check the screen and activate it.Check the screen and activate it.
©India SAP CoE, Slide 22
Screen AttributesScreen Attributes
• Short descriptionShort description – Describes screen purpose– Describes screen purpose
• Original languageOriginal language – Default logon language– Default logon language
• PackagePackage – Identifies the package with which screen is saved– Identifies the package with which screen is saved
• Last changed on/byLast changed on/by – Date & time screen is last changed– Date & time screen is last changed
• Last generationLast generation – Date & time screen is last generated.– Date & time screen is last generated.
©India SAP CoE, Slide 23
Screen AttributesScreen Attributes
Screen Type –Screen Type –
• NormalNormal – Default setting– Default setting
• SubscreenSubscreen – To indicate the screen as a subscreen– To indicate the screen as a subscreen
• Modal dialog boxModal dialog box – used to display details in a dialog box. Used for data– used to display details in a dialog box. Used for data
input, confirmation/error/help messages.input, confirmation/error/help messages.
• Selection screenSelection screen – Identifies selection screen. The system sets this– Identifies selection screen. The system sets this
attribute automatically.attribute automatically.
SettingsSettings
• Hold dataHold data –– On checking this, system can hold entries made on theOn checking this, system can hold entries made on the
screen at runtime. System automatically displays this data if the user callsscreen at runtime. System automatically displays this data if the user calls
the particular screen again.the particular screen again.
©India SAP CoE, Slide 24
Screen AttributesScreen Attributes
SettingsSettings
• Switch off runtime compressSwitch off runtime compress –– On setting this option, the screen is notOn setting this option, the screen is not
compressed at runtime.compressed at runtime.
• Template non executableTemplate non executable –– This attribute is primarily for internal use byThis attribute is primarily for internal use by
SAP.SAP.
• Hold scroll positionHold scroll position – On setting the attribute, the scroll position is– On setting the attribute, the scroll position is
retained when the user returns to the screen after processing anotherretained when the user returns to the screen after processing another
screen.screen.
• Without application tool barWithout application tool bar –– To suppress the display of the applicationTo suppress the display of the application
toolbar belonging to the current program status.toolbar belonging to the current program status.
Other AttributesOther Attributes
• Next ScreenNext Screen –– Next screen number to be displayed.Next screen number to be displayed.
©India SAP CoE, Slide 25
Screen AttributesScreen Attributes
Other AttributesOther Attributes
• Cursor positionCursor position –– Identifies the screen element that contains the cursor when aIdentifies the screen element that contains the cursor when a
screen is first displayed. If you leave this field blank, the system uses the firstscreen is first displayed. If you leave this field blank, the system uses the first
screen field that can accept input.screen field that can accept input.
• Screen groupScreen group –– Specifies a four-character identifier of a group of associatedSpecifies a four-character identifier of a group of associated
screens.screens.
• Line/ColumnsLine/Columns ––
OccupiedOccupied –– Specifies the size of the screen area currently occupied withSpecifies the size of the screen area currently occupied with
screen elementsscreen elements
MaintainedMaintained –– Size of the screen in rows/columns.Size of the screen in rows/columns.
• Context menuContext menu – It will hold a routine name required to set up the context– It will hold a routine name required to set up the context
menu in the program. This routine connects the screen (elements) from themenu in the program. This routine connects the screen (elements) from the
Screen Painter to the context menu of the program.Screen Painter to the context menu of the program.
©India SAP CoE, Slide 26
Screen Layout ModeScreen Layout Mode
The Screen Painter has a layout editor that you use to design your screenThe Screen Painter has a layout editor that you use to design your screen
layout.layout.
It works in two modes:It works in two modes:
• Graphical modeGraphical mode –– Drag and drop interface is used, similar to a drawingDrag and drop interface is used, similar to a drawing
tool.tool.
• Alphanumeric modeAlphanumeric mode –– Keyboard and menus are used for designing.Keyboard and menus are used for designing.
Both modes offer the same functions but use different interfaces. GraphicalBoth modes offer the same functions but use different interfaces. Graphical
mode of screen designing is commonly used.mode of screen designing is commonly used.
©India SAP CoE, Slide 27
Screen DesigningScreen Designing
• We have learnt about creating a screen.We have learnt about creating a screen.
• To start screen design, click on layout button on screen.To start screen design, click on layout button on screen.
• Graphical Screen painter will start loading.Graphical Screen painter will start loading.
©India SAP CoE, Slide 28
Components of Layout EditorComponents of Layout Editor
• Element paletteElement palette – Used for creating screen elements. These can be drag– Used for creating screen elements. These can be drag
& dropped on screen.& dropped on screen.
• Work AreaWork Area –– Screen design is done in this area.Screen design is done in this area.
• Element barElement bar – screen element attributes appear in this line. You can also– screen element attributes appear in this line. You can also
change these attributes in the corresponding field.change these attributes in the corresponding field.
©India SAP CoE, Slide 29
Creating Radio Button
Radio ButtonRadio Button
•Click on the Radio Button Icon and Click on the Screen.
•Create at least two Radio Buttons
•Name the Radio Buttons and Activate it.
©India SAP CoE, Slide 30
Defining Radio Button GroupDefining Radio Button Group
Assign Radio Buttons into one
Group.
Select the Radio Buttons
and Follow the steps.
©India SAP CoE, Slide 31
• Click on the Check Box Icon and Click on the Screen.
• Name the Check Box and Activate it.
• Special input/output fields that the user can either select (value ‘X’) or
deselect (value SPACE). Checkbox elements can be linked with
function codes.
Creating Check Box
Check BoxCheck Box
Name the Check box
©India SAP CoE, Slide 32
Screen ComponentsScreen Components
• Screen element properties can be seen inScreen element properties can be seen in
detail by double clicking on the element.detail by double clicking on the element.
• Properties of an element can be set here,Properties of an element can be set here,
such as variable length, F4 help,such as variable length, F4 help,
input/output, mode of display etc.input/output, mode of display etc.
• Best practice is to define screenBest practice is to define screen
elements by adopting the correspondingelements by adopting the corresponding
field from the ABAP Dictionary.field from the ABAP Dictionary.
However, you can also use fieldHowever, you can also use field
descriptions that you defined in yourdescriptions that you defined in your
program. To do this you must generateprogram. To do this you must generate
the program first.the program first.
©India SAP CoE, Slide 33
Screen ElementsScreen Elements
Screen elements are,Screen elements are,
• Text fieldText field
• Input/Output fieldInput/Output field
• Check boxCheck box
• Radio buttonRadio button
• Push buttonPush button
• Tab stripTab strip
• BoxBox
• Sub screen areaSub screen area
• Table controlTable control
• Custom controlCustom control
• Status IconStatus Icon
Each element will have unique name.Each element will have unique name.
Function code will be assigned for pushFunction code will be assigned for push
buttons, tab titles in tab strip controls,buttons, tab titles in tab strip controls,
Input/output fields with the "Dropdown box"Input/output fields with the "Dropdown box"
attribute.attribute.
Each element will have its position onEach element will have its position on
screen, visible/definite length, mode ofscreen, visible/definite length, mode of
display etc.display etc.
©India SAP CoE, Slide 34
Screen ElementsScreen Elements
Push Button –Push Button –
• Can be placed on screen by dragCan be placed on screen by drag
& drop from Element palette.& drop from Element palette.
• To set the properties, doubleTo set the properties, double
click on it.click on it.
• Each screen element shouldEach screen element should
have unique name.have unique name.
• In addition to that push buttonIn addition to that push button
will have text and function codewill have text and function code
assigned to it.assigned to it.
©India SAP CoE, Slide 35
Function Code for Push Buttons, check box, Radio Button
Assign Parameter ID to Input / Output Field
Dict. Tab is Selected
Program Tab is Selected
Tick If Input or Output Box
Entries in (*********)
Choose if want to Make the Field Mandatory
Screen ElementsScreen Elements
©India SAP CoE, Slide 36
Screen ElementsScreen Elements
Once screen is designed, it should be saved and checked for errors and activated.Once screen is designed, it should be saved and checked for errors and activated.
Screen looks as below,Screen looks as below,
Input Box
©India SAP CoE, Slide 37
Testing ScreenTesting Screen
• Screen can tested by executing F8 or click on buttonScreen can tested by executing F8 or click on button
©India SAP CoE, Slide 38
Testing ScreenTesting Screen
©India SAP CoE, Slide 39
Flow LogicFlow Logic
• Default flow logic for any screen is generated as shown below,Default flow logic for any screen is generated as shown below,
©India SAP CoE, Slide 40
Menu PainterMenu Painter
• In all programs GUI consists of a menu bar, a standard toolbar, anIn all programs GUI consists of a menu bar, a standard toolbar, an
application toolbar and title bar.application toolbar and title bar.
• A program’s GUI is created inA program’s GUI is created in Menu PainterMenu Painter..
• To Create a Menu for a screen, in flow logic uncomment MODULETo Create a Menu for a screen, in flow logic uncomment MODULE
STATUS_0400. in PBO eventSTATUS_0400. in PBO event
PROCESS BEFORE OUTPUT.PROCESS BEFORE OUTPUT.
MODULE STATUS_0400.MODULE STATUS_0400.
PROCESS AFTER INPUT.PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0400.* MODULE USER_COMMAND_0400.
©India SAP CoE, Slide 41
Menu PainterMenu Painter
• Now double click onNow double click on STATUS_0400. A pop up window will appear. ClickSTATUS_0400. A pop up window will appear. Click
on Yes.on Yes.
• Module will be created as below,Module will be created as below,
*&---------------------------------------------------------------------**&---------------------------------------------------------------------*
*& Module STATUS_0400 OUTPUT*& Module STATUS_0400 OUTPUT
*&---------------------------------------------------------------------**&---------------------------------------------------------------------*
module STATUS_0400 output.module STATUS_0400 output.
* SET PF-STATUS 'xxxxxxxx'.* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.* SET TITLEBAR 'xxx'.
• endmodule. " STATUS_0400 OUTPUTendmodule. " STATUS_0400 OUTPUT
©India SAP CoE, Slide 42
Menu PainterMenu Painter
• Uncomment the lineUncomment the line SET PF-STATUS 'xxxxxxxx'. aSET PF-STATUS 'xxxxxxxx'. and replacend replace
'xxxxxxxx‘ with name ‘STATUS_400’.'xxxxxxxx‘ with name ‘STATUS_400’.
• Click on STATUS_400. Click Yes on the pop-up.Click on STATUS_400. Click Yes on the pop-up.
©India SAP CoE, Slide 43
Menu PainterMenu Painter
• Enter description and choose the status type as Normal screen which isEnter description and choose the status type as Normal screen which is
default.default.
©India SAP CoE, Slide 44
Menu PainterMenu Painter
• Click on to expand the menu bar, application toolbar and functionClick on to expand the menu bar, application toolbar and function
keys.keys.
• System and Help are default in menu barSystem and Help are default in menu bar
©India SAP CoE, Slide 45
Creating Menu barCreating Menu bar
• To create a user defined menu enter the name of the menu and doubleTo create a user defined menu enter the name of the menu and double
click on it. We can define options for the menu here as below,click on it. We can define options for the menu here as below,
©India SAP CoE, Slide 46
Creating Application Tool barCreating Application Tool bar
• Application tool bar can also be created in same way as menu bar.Application tool bar can also be created in same way as menu bar.
©India SAP CoE, Slide 47
Assigning function keysAssigning function keys
• We can assign code to existing function keys. Only keys for which codeWe can assign code to existing function keys. Only keys for which code
is assigned will be active. We can see this when the menu painter isis assigned will be active. We can see this when the menu painter is
executed.executed.
©India SAP CoE, Slide 48
ExecutionExecution
• We can test the menu painter by clicking on F8 key or execute buttonWe can test the menu painter by clicking on F8 key or execute button
• Enter a screen number and title if you want to simulate a whole screen.Enter a screen number and title if you want to simulate a whole screen.
If you do not enter a screen number, the system simulates the statusIf you do not enter a screen number, the system simulates the status
using an empty test screen.using an empty test screen.
©India SAP CoE, Slide 49
ExecutionExecution
• Output as below, New Menu is added, Find Item in Application tool bar,Output as below, New Menu is added, Find Item in Application tool bar,
Save, Back & Print button on standard tool bar enabled.Save, Back & Print button on standard tool bar enabled.
©India SAP CoE, Slide 50
More on Flow LogicMore on Flow Logic
• Flow logic refers to code behind the screens. It is the code that processesFlow logic refers to code behind the screens. It is the code that processes
a screen.a screen.
• Flow Logic commands are different than ABAP commandsFlow Logic commands are different than ABAP commands
(e.g., IF … ENDIF is not valid in Flow Logic).(e.g., IF … ENDIF is not valid in Flow Logic).
• Dynamic Processor (DYNPRO) controls the flow logic and preparesDynamic Processor (DYNPRO) controls the flow logic and prepares
data to be displayed on the screen.data to be displayed on the screen.
©India SAP CoE, Slide 51
More on Flow LogicMore on Flow Logic
• Each screen has its own Flow Logic which is divided into four main events:Each screen has its own Flow Logic which is divided into four main events:
• PROCESS BEFORE OUTPUT (PBO)PROCESS BEFORE OUTPUT (PBO) - event processed before the- event processed before the
screen is displayed.screen is displayed.
• PROCESS AFTER INPUT (PAI) -PROCESS AFTER INPUT (PAI) - event processed after the user hasevent processed after the user has
invoked a function code (e.g., clicked on a pushbutton) or pressed theinvoked a function code (e.g., clicked on a pushbutton) or pressed the
‘Enter’ key.‘Enter’ key.
• Process on Value Request (POV) -Process on Value Request (POV) - Triggered when the user requestsTriggered when the user requests
Value help (F4)Value help (F4)
• Process on Value Request (POH) -Process on Value Request (POH) - Triggered when the user requestsTriggered when the user requests
field help (F1)field help (F1)
• Each screen must be generated. If you make a change to any component of aEach screen must be generated. If you make a change to any component of a
screen, the screen must be re-generated before execution.screen, the screen must be re-generated before execution.
©India SAP CoE, Slide 52
Keywords supportedKeywords supported
• Keywords supported by flow logic events are as below,Keywords supported by flow logic events are as below,
KeywordKeyword FunctionFunction
MODULEMODULE Calls a dialog module in an ABAP programCalls a dialog module in an ABAP program
FIELDFIELD Specifies the point at which the contents of a screenSpecifies the point at which the contents of a screen
field should be transportedfield should be transported
ONON Used in conjunction with FIELDUsed in conjunction with FIELD
VALUESVALUES Used in conjunction with FIELDUsed in conjunction with FIELD
CHAINCHAIN Starts a processing chainStarts a processing chain
ENDCHAINENDCHAIN Ends a processing chainEnds a processing chain
CALLCALL Calls a sub screenCalls a sub screen
LOOPLOOP Starts processing a screen tableStarts processing a screen table
ENDLOOPENDLOOP Stops processing a screen tableStops processing a screen table
©India SAP CoE, Slide 53
PBO EventPBO Event
• By default the module created in PBO event will be likeBy default the module created in PBO event will be like
MODULE STATUS_<screen number>MODULE STATUS_<screen number>
Ex:-MODULE STATUS_0100.Ex:-MODULE STATUS_0100.
• This module will be processed before the screen is displayed.This module will be processed before the screen is displayed.
• By default this module will be commented. To use this uncomment andBy default this module will be commented. To use this uncomment and
double click on it to get the module created.double click on it to get the module created.
*&---------------------------------------------------------------------**&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------**&---------------------------------------------------------------------*
module STATUS_0100 output.module STATUS_0100 output.
* SET PF-STATUS ‘XXX'.* SET PF-STATUS ‘XXX'.
* SET TITLEBAR 'xxx'.* SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUTendmodule. " STATUS_0100 OUTPUT
©India SAP CoE, Slide 54
PBO EventPBO Event
• Menu bar and title bar can be set in this module.Menu bar and title bar can be set in this module.
Menu Bar-Menu Bar-
• To set menu bar uncomment the SET PF_STATUS and give a name toTo set menu bar uncomment the SET PF_STATUS and give a name to
status as ,status as ,
SET PF-STATUS 'STATUS100'.SET PF-STATUS 'STATUS100'.
• Double click on STATUS100 and click yes to create GUI status.Double click on STATUS100 and click yes to create GUI status.
©India SAP CoE, Slide 55
PBO EventPBO Event
Title BarTitle Bar
• To assign a title uncomment SET TITLEBAR and give a name as,To assign a title uncomment SET TITLEBAR and give a name as,
SET TITLEBAR 'TITLE100'.SET TITLEBAR 'TITLE100'.
• Double click on TITLE100 and click yes to create GUI title. Enter titleDouble click on TITLE100 and click yes to create GUI title. Enter title
as below and click on , save and activate.as below and click on , save and activate.
• Once all the modules in the PBO block are processed, the system copiesOnce all the modules in the PBO block are processed, the system copies
the content of the fields in the ABAP work area to their correspondingthe content of the fields in the ABAP work area to their corresponding
fields in the screen work area.fields in the screen work area.
©India SAP CoE, Slide 56
PAI EventPAI Event
• Default module in PAI event will beDefault module in PAI event will be
MODULE USER_COMMAND_<screen number>.MODULE USER_COMMAND_<screen number>.
Ex:-Ex:- MODULE USER_COMMAND_0100.MODULE USER_COMMAND_0100.
• This event is triggered once the user invokes function code or pressesThis event is triggered once the user invokes function code or presses
Enter key on the screen.Enter key on the screen.
• System variableSystem variable SY-UCOMMSY-UCOMM will hold the function code assigned towill hold the function code assigned to
the screen elements (push button, radio button, check box etc).the screen elements (push button, radio button, check box etc).
• Within the above module code has to written to branch to group of codeWithin the above module code has to written to branch to group of code
based on the function code from SY-UCOMM.based on the function code from SY-UCOMM.
• The system copies the contents of the fields in the screen work area toThe system copies the contents of the fields in the screen work area to
their corresponding fields in the ABAP work area once user clicks Entertheir corresponding fields in the ABAP work area once user clicks Enter
key on screen or any function code is invoked.key on screen or any function code is invoked.
©India SAP CoE, Slide 57
PAI Event- Sample CodePAI Event- Sample Code
*&---------------------------------------------------------------------**&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------**&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.MODULE user_command_0100 INPUT.
CASE sy-ucomm.CASE sy-ucomm.
WHEN 'ENT'.WHEN 'ENT'.
SELECT ebeln ebelp bukrsSELECT ebeln ebelp bukrs
INTO CORRESPONDING FIELDS OF TABLE it_poINTO CORRESPONDING FIELDS OF TABLE it_po
FROM ekpoFROM ekpo
WHERE ebeln = po_no.WHERE ebeln = po_no.
WHEN 'BCK'.WHEN 'BCK'.
LEAVE TO SCREEN 0.LEAVE TO SCREEN 0.
ENDCASE.ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUTENDMODULE. " USER_COMMAND_0100 INPUT
©India SAP CoE, Slide 58
IncludesIncludes
• To have structured way of code it is best practice to have includes.To have structured way of code it is best practice to have includes.
• There should be a TOP include which will have the data declarations.There should be a TOP include which will have the data declarations.
• Include for PBO modules, include for PAI modules.Include for PBO modules, include for PAI modules.
• Include for POV and POH modules if any.Include for POV and POH modules if any.
©India SAP CoE, Slide 59
IncludesIncludes
• To create include right click on object name, select Include from theTo create include right click on object name, select Include from the
Create menu.Create menu.
©India SAP CoE, Slide 60
IncludesIncludes
• We can gave the include names as Z<Program>_TOP,We can gave the include names as Z<Program>_TOP,
Z<Program>_PBO, Z<Program>_PAI. This will help to understandZ<Program>_PBO, Z<Program>_PAI. This will help to understand
which modules are covered in each include.which modules are covered in each include.
• Each include program will insert a include statement in the mainEach include program will insert a include statement in the main
program.program.
©India SAP CoE, Slide 61
Message StatementMessage Statement
• The “MESSAGE” statement is used to issue user messages.The “MESSAGE” statement is used to issue user messages.
• Syntax isSyntax is MESSAGE <tnnn> [WITH <var1> <var2> <var3> <var4>].MESSAGE <tnnn> [WITH <var1> <var2> <var3> <var4>].
t – Message typet – Message type
nnn –Message Numbernnn –Message Number
WITH – This is optional. It is needed if variables are used in a message.WITH – This is optional. It is needed if variables are used in a message.
A message can contain up to four variables, indicated with anA message can contain up to four variables, indicated with an
ampersand (&) in the message text.ampersand (&) in the message text.
• We can code the Message statement in the PAI event.We can code the Message statement in the PAI event.
©India SAP CoE, Slide 62
Message TypesMessage Types
• S: success
• I: information
• A: abend
• X: exit
• W: warning
• E: error X
The message type determines where the message is displayed and what
action the user can or must take on the current screen.
I
©India SAP CoE, Slide 63
MessagesMessages
• SuccessSuccess message is displayed at the bottom of the screen.message is displayed at the bottom of the screen.
• If you have next screen then the message will be displayed at the bottomIf you have next screen then the message will be displayed at the bottom
of the next screen.of the next screen.
• InformationInformation message is displayed in a dialog box in same screen.message is displayed in a dialog box in same screen.
• After pressing Enter key on dialog box user will be taken to next screen.After pressing Enter key on dialog box user will be taken to next screen.
The user is not restricted from going on to the next screen.The user is not restricted from going on to the next screen.
©India SAP CoE, Slide 64
MessagesMessages
• AbendAbend message is displayed on the current screen in a dialog box.message is displayed on the current screen in a dialog box.
• The user cannot make any changes to the values on the current screen.The user cannot make any changes to the values on the current screen.
• After pressing the ‘Enter’ key on the dialog box, transaction will beAfter pressing the ‘Enter’ key on the dialog box, transaction will be
terminated.terminated.
• ExitExit message is identical to the ABEND message except that themessage is identical to the ABEND message except that the
transaction is terminated with a short dump instead of the message in atransaction is terminated with a short dump instead of the message in a
dialog box.dialog box.
• WARNINGWARNING message is displayed at the bottom of the current screen.message is displayed at the bottom of the current screen.
• On pressing the ‘Enter’ key on the current screen, the user will be taken toOn pressing the ‘Enter’ key on the current screen, the user will be taken to
the next screen even if no changes were made on the current screen . Thusthe next screen even if no changes were made on the current screen . Thus
user is not restricted from going on to the next screen.user is not restricted from going on to the next screen.
©India SAP CoE, Slide 65
MessagesMessages
• ERRORERROR message is displayed at the bottom of the current screen.message is displayed at the bottom of the current screen.
• The user must make changes to the values on the current screen.The user must make changes to the values on the current screen.
• On pressing the ‘Enter’ key on the current screen, the user will be takenOn pressing the ‘Enter’ key on the current screen, the user will be taken
to the next screen only if the appropriate corrections were made on theto the next screen only if the appropriate corrections were made on the
current screen.current screen.
• If no corrections were made, the error message would be redisplayed atIf no corrections were made, the error message would be redisplayed at
the bottom of the current screen.the bottom of the current screen.
• When a warning or error message is triggered the system will stop atWhen a warning or error message is triggered the system will stop at
current screen, prompting the user to make corrections. However thecurrent screen, prompting the user to make corrections. However the
input fields on the screen will be disabled for input.input fields on the screen will be disabled for input.
©India SAP CoE, Slide 66
Handling Error messagesHandling Error messages
• There are 2 ways to issue error/warning messages.There are 2 ways to issue error/warning messages.
– Issue an error or warning message with the Flow Logic SELECTIssue an error or warning message with the Flow Logic SELECT
statement.statement.
– Define valid values for a screen field with the Flow Logic VALUESDefine valid values for a screen field with the Flow Logic VALUES
statement.statement.
• FIELDFIELD statement is a Flow Logic command, not an ABAP command.statement is a Flow Logic command, not an ABAP command.
• The purpose of the “FIELD” statement is to keep a single screen field openThe purpose of the “FIELD” statement is to keep a single screen field open
for input after an error or warning message is issued.for input after an error or warning message is issued.
• FIELD statement is used in PAI event.FIELD statement is used in PAI event.
• Syntax is:Syntax is: FIELDFIELD <screen field><screen field> MODULEMODULE <module name>.<module name>.
©India SAP CoE, Slide 67
FIELD with select statementFIELD with select statement
• Screen field can be validated against entry in database table.Screen field can be validated against entry in database table.
• To validate Purchase order number in PAI module,To validate Purchase order number in PAI module,
PROCESS AFTER INPUT.PROCESS AFTER INPUT.
field PO_NO module PO_CHECK.field PO_NO module PO_CHECK.
MODULE USER_COMMAND_0100.MODULE USER_COMMAND_0100.
Module PO_CHECK is as below,Module PO_CHECK is as below,
module paycheck input.module paycheck input.
data: lv_ebeln type ekko-ebeln.data: lv_ebeln type ekko-ebeln.
select single ebeln into lv_ebelnselect single ebeln into lv_ebeln
from ekko where ebeln = PO_NO.from ekko where ebeln = PO_NO.
if sy-subrc ne 0.if sy-subrc ne 0.
message e003(Z6).message e003(Z6).
endif.endif.
endmodule. " po_check INPUTendmodule. " po_check INPUT
©India SAP CoE, Slide 68
Error for invalid inputError for invalid input
• Error for Purchase order when invalid number is entered.Error for Purchase order when invalid number is entered.
©India SAP CoE, Slide 69
FIELD with Values CheckFIELD with Values Check
• The Flow Logic VALUES statement defines a set of valid values for the
screen field specified in the FIELD statement.
• If the value entered in this field is not in the valid set, an error message
will be issued by the system.
PROCESS AFTER INPUT.
field PO_NO values ('1', '100').
• This indicates PO_NO can take input as either 1 or 100. For any other
value system will through error and the field will be open for input.
• With VALUES parameter for field, we can get a list of possible values
by clicking on the drop-down arrow of the screen fields or pressing the
‘F4’ key. It will list the values mentioned.
©India SAP CoE, Slide 70
Values optionValues option
• PO_NO with values 1 and 100.PO_NO with values 1 and 100.
©India SAP CoE, Slide 71
CHAIN StatementCHAIN Statement
• To keep multiple screen fields open for input after an error or warningTo keep multiple screen fields open for input after an error or warning
message is displayed, you need to use the “CHAIN” and “ENDCHAIN”message is displayed, you need to use the “CHAIN” and “ENDCHAIN”
Flow Logic commands.Flow Logic commands.
• These statements group the “FIELD” statements and the “MODULE”These statements group the “FIELD” statements and the “MODULE”
statements together.statements together.
• The basic syntax of these statements is:The basic syntax of these statements is:
CHAIN.CHAIN.
FIELD: <f1>, <f 2>,...FIELD: <f1>, <f 2>,...
MODULE <mod1>.MODULE <mod1>.
FIELD: <g1>, <g 2>,...FIELD: <g1>, <g 2>,...
MODULE <mod2>.MODULE <mod2>.
......
ENDCHAIN.ENDCHAIN.
• If an error or warning message is issued in <module name>, all theIf an error or warning message is issued in <module name>, all the
screen fields listed in the “FIELD” statements will be open for input.screen fields listed in the “FIELD” statements will be open for input.
©India SAP CoE, Slide 72
Cursor PositionCursor Position
• By default, the cursor will be positioned in the first fieldBy default, the cursor will be positioned in the first field
open for input on a screen.open for input on a screen.
• Cursor position can be changed in two ways –Cursor position can be changed in two ways –
1. By setting the cursor position in PBO event-1. By setting the cursor position in PBO event-
Syntax -Syntax - SET CURSOR FIELD <field name>SET CURSOR FIELD <field name>
Cursor will be placed on the screen field mentioned.Cursor will be placed on the screen field mentioned.
2. Cursor position in screen attributes-2. Cursor position in screen attributes-
Mention the field name where cursor to be placed onMention the field name where cursor to be placed on
screenscreen in cursor position attribute .in cursor position attribute .
©India SAP CoE, Slide 73
Screen commandsScreen commands
• TheThe LEAVE SCREENLEAVE SCREEN statement ends the current screen andstatement ends the current screen and
calls the subsequent screen.calls the subsequent screen.
• When the system encounters theWhen the system encounters the “SET SCREEN <screen“SET SCREEN <screen
#>”#>” ABAP statement, itABAP statement, it temporarilytemporarily overrides the “Nextoverrides the “Next
Screen” attribute with this <screen #> and the PAIScreen” attribute with this <screen #> and the PAI
processing continues. After all PAI modules are executed,processing continues. After all PAI modules are executed,
the system goes to the PBO event ofthe system goes to the PBO event of
<screen #>.<screen #>.
©India SAP CoE, Slide 74
Screen commandsScreen commands
• ““LEAVE TO SCREEN <screen #>”LEAVE TO SCREEN <screen #>” ABAP statement,ABAP statement,
terminates the screen’s PAI event and immediately goes toterminates the screen’s PAI event and immediately goes to
the PBO of <screen #>.the PBO of <screen #>.
• The “LEAVE TO SCREEN <screen #> statement performsThe “LEAVE TO SCREEN <screen #> statement performs
the functionality of two statements: “SET SCREEN <screenthe functionality of two statements: “SET SCREEN <screen
#>“ and “LEAVE SCREEN”.#>“ and “LEAVE SCREEN”.
• ““CALL SCREEN <screen #>”CALL SCREEN <screen #>” ABAP statement,ABAP statement,
temporarily suspends the current screen’s PAI processingtemporarily suspends the current screen’s PAI processing
and immediately goes to the PBO event of <screen #>.and immediately goes to the PBO event of <screen #>.
When control returns back to the “calling” screen, its PAIWhen control returns back to the “calling” screen, its PAI
processing will resume.processing will resume.
©India SAP CoE, Slide 75
More on PAI modulesMore on PAI modules
All modules listed in the PAI event get executed from top toAll modules listed in the PAI event get executed from top to
bottom.bottom.
• We can control the execution of the modules using additionsWe can control the execution of the modules using additions
to MODULE.to MODULE.
• Additions are,Additions are,
 ON INPUTON INPUT
 ON REQUESTON REQUEST
 AT EXIT-COMMANDAT EXIT-COMMAND
 AT CURSOR-SELECTIONAT CURSOR-SELECTION
©India SAP CoE, Slide 76
ON INPUTON INPUT
• With the “ON INPUT” addition to the “MODULE” statement, a module willWith the “ON INPUT” addition to the “MODULE” statement, a module will
be executed only if the specified field’s value is not equal to the initial valuebe executed only if the specified field’s value is not equal to the initial value
appropriate to its data typeappropriate to its data type
• Ex- blanks for character fields and zeroes for numeric fields.Ex- blanks for character fields and zeroes for numeric fields.
• The basic syntax for this conditional execution Flow Logic command is:The basic syntax for this conditional execution Flow Logic command is:
– FIELD <screen field> MODULE <module> ON INPUT.FIELD <screen field> MODULE <module> ON INPUT.
– The PAI <module> will be executed only if the value in <screen field> isThe PAI <module> will be executed only if the value in <screen field> is
not equal to its initial value.not equal to its initial value.
– The “ON INPUT” addition must be used with a “FIELD” statementThe “ON INPUT” addition must be used with a “FIELD” statement
because this condition depends on the value of a particular field.because this condition depends on the value of a particular field.
©India SAP CoE, Slide 77
ON REQUESTON REQUEST
• With the “ON REQUEST”, a module will be executed only if a value hasWith the “ON REQUEST”, a module will be executed only if a value has
been entered in the specified field since the screen was displayed.been entered in the specified field since the screen was displayed.
• The basic syntax for this conditional execution Flow Logic command is:The basic syntax for this conditional execution Flow Logic command is:
FIELD <screen field> MODULE <module> ON REQUEST.FIELD <screen field> MODULE <module> ON REQUEST.
– The PAI <module> will be executed only if a value was entered inThe PAI <module> will be executed only if a value was entered in
<screen field> since the screen was displayed.<screen field> since the screen was displayed.
– The “ON REQUEST” addition must be used with a “FIELD” statementThe “ON REQUEST” addition must be used with a “FIELD” statement
because this condition depends on the value of a particular field.because this condition depends on the value of a particular field.
• If you want to conditionally execute a module that is coded within aIf you want to conditionally execute a module that is coded within a
“CHAIN … ENDCHAIN”, you must use ““CHAIN … ENDCHAIN”, you must use “ON CHAIN-REQUEST”.ON CHAIN-REQUEST”.
©India SAP CoE, Slide 78
AT EXIT-COMMANDAT EXIT-COMMAND
• With the “AT EXIT-COMMAND” addition to theWith the “AT EXIT-COMMAND” addition to the
“MODULE” statement, a module will be executed only if“MODULE” statement, a module will be executed only if
the user invokes a function code with the ‘E’ function type.the user invokes a function code with the ‘E’ function type.
• Function type assigning is explained in slide 73.Function type assigning is explained in slide 73.
• The basic syntax for this conditional execution Flow LogicThe basic syntax for this conditional execution Flow Logic
command is:command is:
MODULE <module> AT EXIT-COMMAND.MODULE <module> AT EXIT-COMMAND.
©India SAP CoE, Slide 79
AT EXIT-COMMANDAT EXIT-COMMAND
– The PAI <module> will be executed only if the user invokes aThe PAI <module> will be executed only if the user invokes a
FUNCTION type ‘E’.FUNCTION type ‘E’.
– The “AT EXIT-COMMAND” addition cannot be used with aThe “AT EXIT-COMMAND” addition cannot be used with a
“FIELD” statement.“FIELD” statement.
• If the user invokes a type ‘E’ function code, a module with the “ATIf the user invokes a type ‘E’ function code, a module with the “AT
EXIT-COMMAND” addition will be executed immediately.EXIT-COMMAND” addition will be executed immediately.
• It will be executed even before the automatic field checks.It will be executed even before the automatic field checks.
©India SAP CoE, Slide 80
Assigning Function typeAssigning Function type
• Function type can beFunction type can be
assigned for screenassigned for screen
buttons and for menubuttons and for menu
painter keys.painter keys.
• In menu painter, clickIn menu painter, click
on the required key.on the required key.
In the pop-up windowIn the pop-up window
select function type asselect function type as
‘E’ from drop down.‘E’ from drop down.
©India SAP CoE, Slide 81
AT CURSOR-SELECTIONAT CURSOR-SELECTION
• You can specify that a module should only be called if the cursor isYou can specify that a module should only be called if the cursor is
positioned on a particular screen element.positioned on a particular screen element.
• Syntax -Syntax - MODULE <mod> AT CURSOR-SELECTIONMODULE <mod> AT CURSOR-SELECTION..
• The module <mod> is called whenever the function code of the userThe module <mod> is called whenever the function code of the user
action is CS with function type S.action is CS with function type S.
• The module is called in the sequence in which it occurs in the flow logic.The module is called in the sequence in which it occurs in the flow logic.
• It does not bypass the automatic input checks.It does not bypass the automatic input checks.
©India SAP CoE, Slide 82
AT CURSOR-SELECTIONAT CURSOR-SELECTION
• You can also combine this MODULE statement with the FIELDYou can also combine this MODULE statement with the FIELD
statement:statement:
FIELD <f> MODULE <mod> AT CURSOR-SELECTION.FIELD <f> MODULE <mod> AT CURSOR-SELECTION.
• For more than one field:For more than one field:
CHAIN.CHAIN.
FIELD: <f1>, <f 2>,...FIELD: <f1>, <f 2>,...
MODULE <mod> AT CURSOR-SELECTION.MODULE <mod> AT CURSOR-SELECTION.
ENDCHAIN.ENDCHAIN.
©India SAP CoE, Slide 83
Modifying Screen FieldsModifying Screen Fields
• All fields of the current screen are stored in the system tableAll fields of the current screen are stored in the system table SCREENSCREEN
with their attributes.with their attributes.
• TheThe LOOP AT SCREENLOOP AT SCREEN statement places this information in thestatement places this information in the
header line of the system table.header line of the system table.
• We can modify the attributes of the fields and update the screen tableWe can modify the attributes of the fields and update the screen table
usingusing MODIFY SCREENMODIFY SCREEN..
• Sample code:Sample code:
loop at screen.loop at screen.
if screen-name = 'GV_MATNR'.if screen-name = 'GV_MATNR'.
screen-input = 1.screen-input = 1.
modify screen.modify screen.
endif.endif.
endloop.endloop.
©India SAP CoE, Slide 84
Modifying Screen FieldsModifying Screen Fields
• You can dynamically modify the following attributes of a field:You can dynamically modify the following attributes of a field:
– ACTIVEACTIVE
– REQUIREDREQUIRED
– INPUTINPUT
– OUTPUTOUTPUT
– INTENSIFIEDINTENSIFIED
– INVISIBLEINVISIBLE
– LENGTHLENGTH
– DISPLAY 3DDISPLAY 3D
– VALUE HELPVALUE HELP
• A field attribute is turned “on” with a value of 1. It is turned “off” withA field attribute is turned “on” with a value of 1. It is turned “off” with
a value of 0.a value of 0.
• The statements LOOP AT SCREEN ... ENDLOOP define a loop aroundThe statements LOOP AT SCREEN ... ENDLOOP define a loop around
a statement block.a statement block.
©India SAP CoE, Slide 85
Logical Unit of Work (LUW)Logical Unit of Work (LUW)
• LUW refers to a collection of actions performed at the database level as aLUW refers to a collection of actions performed at the database level as a
complete unit.complete unit.
In this ex: LUW is selecting A and B from the database, updating A, andIn this ex: LUW is selecting A and B from the database, updating A, and
deleting B.deleting B.
This would be the desired LUW because we would want to rollback allThis would be the desired LUW because we would want to rollback all
changes if any of these actions failed.changes if any of these actions failed.
Screen
2
Screen
1
Screen
3
SELECT A
SELECT B
UPDATE A DELETE B
Database
Transaction
Database
Transaction
Database
Transaction
©India SAP CoE, Slide 86
LUWLUW
• Changes will be saved (commit work) in database at the end of thirdChanges will be saved (commit work) in database at the end of third
screen.screen.
• An SAP LUW will end with either the COMMIT WORK orAn SAP LUW will end with either the COMMIT WORK or
ROLLBACK WORK statement.ROLLBACK WORK statement.
• A logical unit consisting of dialog steps, whose changes are written toA logical unit consisting of dialog steps, whose changes are written to
the database in a single database LUW is called an SAP LUW.the database in a single database LUW is called an SAP LUW.
• If an SAP LUW contains database changes, you should either write allIf an SAP LUW contains database changes, you should either write all
of them or none at all to the database.of them or none at all to the database.
• Include a database commit when the transaction has ended successfully,Include a database commit when the transaction has ended successfully,
and a database rollback in case the program detects an error.and a database rollback in case the program detects an error.
©India SAP CoE, Slide 87
LUWLUW
• Since database changes from a database LUW cannot be reversed in aSince database changes from a database LUW cannot be reversed in a
subsequent database LUW, you must make all of the database changes forsubsequent database LUW, you must make all of the database changes for
the SAP LUW in a single database LUW.the SAP LUW in a single database LUW.
• In our example, we need to perform UPDATE A and DELETE B at theIn our example, we need to perform UPDATE A and DELETE B at the
end of third screen.end of third screen.
©India SAP CoE, Slide 88
SAP LocksSAP Locks
• R/3 system contain lock mechanism for SAP LUWs called SAP Locks.R/3 system contain lock mechanism for SAP LUWs called SAP Locks.
• Lock object is created in ABAP Dictionary.Lock object is created in ABAP Dictionary.
• A lock object definition contains the database tables and their key fieldsA lock object definition contains the database tables and their key fields
on the basis of which you want to set a lock.on the basis of which you want to set a lock.
• System automatically generates two function modules with the namesSystem automatically generates two function modules with the names
ENQUEUE_<lock object name> and DEQUEUE_<lock object name>ENQUEUE_<lock object name> and DEQUEUE_<lock object name>
when a lock is generated.when a lock is generated.
• Locks can be set and released on corresponding database table by callingLocks can be set and released on corresponding database table by calling
these function modules in program.these function modules in program.
©India SAP CoE, Slide 89
SAP LocksSAP Locks
• Consider below example,Consider below example,
• When user clicks on change, the program locks the relevant databaseWhen user clicks on change, the program locks the relevant database
object by calling the corresponding ENQUEUE function.object by calling the corresponding ENQUEUE function.
• You can release the lock by calling DEQUEUE function when user clicksYou can release the lock by calling DEQUEUE function when user clicks
on SAVE or when user clicks on BACK button.on SAVE or when user clicks on BACK button.
©India SAP CoE, Slide 90
Table ControlTable Control
• A table control is an area on the screen where the system displays data in aA table control is an area on the screen where the system displays data in a
tabular form. It is processed using a loop.tabular form. It is processed using a loop.
• To create a table control, drag & drop table control from screen elementsTo create a table control, drag & drop table control from screen elements
on screen painter. Give a name to table control.on screen painter. Give a name to table control.
• Select the table definition and fields clicking on Dictionary/ProgramSelect the table definition and fields clicking on Dictionary/Program
fields object button.fields object button.
• Each table control need to be declared in declaration part of the programEach table control need to be declared in declaration part of the program
as,as,
CONTROLS <ctrl> TYPE TABLEVIEW USING SCREEN <scr>.CONTROLS <ctrl> TYPE TABLEVIEW USING SCREEN <scr>.
where <ctrl> is the name of the table control on a screen.where <ctrl> is the name of the table control on a screen.
©India SAP CoE, Slide 91
Table ControlTable Control
• YouYou mustmust code a LOOP statement in both the PBO and PAI events for eachcode a LOOP statement in both the PBO and PAI events for each
table in your screen.table in your screen.
• This is because the LOOP statement causes the screen fields to be copiedThis is because the LOOP statement causes the screen fields to be copied
back and forth between the ABAP program and the screen field.back and forth between the ABAP program and the screen field.
• For this reason, at least an empty LOOP...ENDLOOP must be there.For this reason, at least an empty LOOP...ENDLOOP must be there.
©India SAP CoE, Slide 92
Processing Table ControlProcessing Table Control
Database
Internal Table with header
Internal Table with header
Screen
©India SAP CoE, Slide 93
Table ControlTable Control
Sample code -Sample code -
PROCESS BEFORE OUTPUT.PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.MODULE STATUS_0100.
LOOP AT it_po INTO wa_ekpo WITH CONTROL tab2 CURSORLOOP AT it_po INTO wa_ekpo WITH CONTROL tab2 CURSOR
tab2-current_line.tab2-current_line.
ENDLOOP.ENDLOOP.
PROCESS AFTER INPUT.PROCESS AFTER INPUT.
field po_no module po_check.field po_no module po_check.
module exit_mod at exit-command.module exit_mod at exit-command.
MODULE USER_COMMAND_0100.MODULE USER_COMMAND_0100.
loop at it_po.loop at it_po.
endloop.endloop.
©India SAP CoE, Slide 94
SubscreenSubscreen
• A subscreen is a screen that is displayed in a specified area of the mainA subscreen is a screen that is displayed in a specified area of the main
screen.screen.
• A subscreen cannot be displayed by itself.A subscreen cannot be displayed by itself.
• The subscreen displayed in the predefined area will depend on the user’sThe subscreen displayed in the predefined area will depend on the user’s
request on the main screen.request on the main screen.
• Subscreen is used to vary the fields displayed on a screen. As anSubscreen is used to vary the fields displayed on a screen. As an
example:example:
– The “main” screen contains the customer number, name, and aThe “main” screen contains the customer number, name, and a
predefined area for a subscreen.predefined area for a subscreen.
– One subscreen contains customer address information.One subscreen contains customer address information.
– Another subscreen contains customer bank information.Another subscreen contains customer bank information.
©India SAP CoE, Slide 95
Creating SubscreenCreating Subscreen
• In main screen,In main screen,
– In the screen layout, place the screen element ‘subscreen’ on layout.In the screen layout, place the screen element ‘subscreen’ on layout.
– You can set the length and width of the subscreen by double clickingYou can set the length and width of the subscreen by double clicking
on subscreen.on subscreen.
– Provide unique name to subscreen, save and activate it.Provide unique name to subscreen, save and activate it.
Subscreen
©India SAP CoE, Slide 96
Creating SubscreenCreating Subscreen
• Create a subscreenCreate a subscreen
– Create a screen as given in earlier slides.Create a screen as given in earlier slides.
– Screen type should be subscreen.Screen type should be subscreen.
– Specify the screen length and height as in main screen.Specify the screen length and height as in main screen.
– Save the subscreen and go to screen layout. Here subscreen are willSave the subscreen and go to screen layout. Here subscreen are will
be displayed.be displayed.
©India SAP CoE, Slide 97
Creating SubscreenCreating Subscreen
• User can design in the subscreen area as below,User can design in the subscreen area as below,
©India SAP CoE, Slide 98
Call subscreen in PBOCall subscreen in PBO
• To include a subscreen in a predefined area on the “main” screen, use theTo include a subscreen in a predefined area on the “main” screen, use the
“CALL SUBSCREEN” statement in the “main” screen’s PBO event.“CALL SUBSCREEN” statement in the “main” screen’s PBO event.
• syntax :syntax :CALL SUBSCREEN <area> INCLUDING <program> <subscreenCALL SUBSCREEN <area> INCLUDING <program> <subscreen
#>.#>.
– <area> : name of the subscreen area defined on the “main” screen. This<area> : name of the subscreen area defined on the “main” screen. This
subscreen area will be the location of the subscreen. This <area>subscreen area will be the location of the subscreen. This <area> cannotcannot
be enclosed in single quotes.be enclosed in single quotes.
– <program> : name of the program where the subscreen exists<program> : name of the program where the subscreen exists..
©India SAP CoE, Slide 99
Call subscreen in PBOCall subscreen in PBO
– <subscreen #> : number of the subscreen to display in the subscreen<subscreen #> : number of the subscreen to display in the subscreen
area.area.
– The <program> and <subscreen #> can be literals (i.e. enclosed inThe <program> and <subscreen #> can be literals (i.e. enclosed in
single quotes) or variables.single quotes) or variables.
• When the “CALL SUBSCREEN” statement is encountered in theWhen the “CALL SUBSCREEN” statement is encountered in the
“main” screen’s PBO event, the system executes the PBO event of the“main” screen’s PBO event, the system executes the PBO event of the
subscreen. Then, the system returns to finish the PBO event of thesubscreen. Then, the system returns to finish the PBO event of the
“main” screen“main” screen..
©India SAP CoE, Slide 100
Call subscreen in PAICall subscreen in PAI
• If the subscreen contains any PAI code, use the “CALL SUBSCREEN”If the subscreen contains any PAI code, use the “CALL SUBSCREEN”
statement in the PAI event of the “main” screen.statement in the PAI event of the “main” screen.
• Syntax :Syntax : CALL SUBSCREEN <area>.CALL SUBSCREEN <area>.
– The <area> is the name of the subscreen area defined on the “main”The <area> is the name of the subscreen area defined on the “main”
screen. This <area>screen. This <area> cannotcannot be enclosed in single quotes.be enclosed in single quotes.
• The “CALL SUBSCREEN” statement must be used to invoke the PAIThe “CALL SUBSCREEN” statement must be used to invoke the PAI
event of the subscreen.event of the subscreen.
- When the “CALL SUBSCREEN” statement is- When the “CALL SUBSCREEN” statement is
encountered in the “main” screen’s PAI event, theencountered in the “main” screen’s PAI event, the systemsystem
executes the PAI event of the subscreen.executes the PAI event of the subscreen.
©India SAP CoE, Slide 101
Call subscreen in PAICall subscreen in PAI
– Then, the system returns to finish the PAI event of the “main”Then, the system returns to finish the PAI event of the “main”
screen.screen.
– Without this “CALL SUBSCREEN” statement in the PAI event ofWithout this “CALL SUBSCREEN” statement in the PAI event of
the “main” screen, the PAI event of the subscreen cannot bethe “main” screen, the PAI event of the subscreen cannot be
processed by the system.processed by the system.
• If the subscreen does not contain any PAI code, this “CALLIf the subscreen does not contain any PAI code, this “CALL
SUBSCREEN” statement isSUBSCREEN” statement is notnot needed in the PAI event of the “main”needed in the PAI event of the “main”
screen.screen.
• In both the PBO and PAI of the “main” screen, the “CALLIn both the PBO and PAI of the “main” screen, the “CALL
SUBSCREEN” statement cannot be used inside a “LOOP” or aSUBSCREEN” statement cannot be used inside a “LOOP” or a
“CHAIN”.“CHAIN”.
©India SAP CoE, Slide 102
Subscreen RestrictionsSubscreen Restrictions
• The following ABAP/4 statementsThe following ABAP/4 statements cannotcannot be used in a subscreen’s PBObe used in a subscreen’s PBO
or PAI modules (instead, they must be used in the “main” screen):or PAI modules (instead, they must be used in the “main” screen):
– SET PF-STATUSSET PF-STATUS
– SET TITLEBARSET TITLEBAR
– SET SCREENSET SCREEN
– LEAVE TO SCREENLEAVE TO SCREEN
– CALL SCREENCALL SCREEN
– Note: These ABAP/4 statements in a subscreen will pass a syntaxNote: These ABAP/4 statements in a subscreen will pass a syntax
check; however, they will result in runtime errors.check; however, they will result in runtime errors.
©India SAP CoE, Slide 103
Tab Strip ControlsTab Strip Controls
• Each tab page consists of a tab title and a page area.Each tab page consists of a tab title and a page area.
• If the area occupied by the tab strip control is too narrow to display all ofIf the area occupied by the tab strip control is too narrow to display all of
the tab titles, a scrollbar appears, allowing you to reach the titles that are notthe tab titles, a scrollbar appears, allowing you to reach the titles that are not
displayed.displayed.
• Tab strips allow users to access multiple sub screens on one normal screen.Tab strips allow users to access multiple sub screens on one normal screen.
• This allows for a more intuitive user interface by logically separating theThis allows for a more intuitive user interface by logically separating the
information presented to the user into different headings.information presented to the user into different headings.
• The user can sort through the information by clicking on a correspondingThe user can sort through the information by clicking on a corresponding
tabtab
A tab strip control is a screen objectA tab strip control is a screen object
consisting of two or more pages.consisting of two or more pages.
©India SAP CoE, Slide 104
Tab Strip Control componentsTab Strip Control components
TabTtitle Tab Page
Tab Title Row
Scrolling
©India SAP CoE, Slide 105
• Tab TitleTab Title – Title of the component to which user can– Title of the component to which user can
navigate. They are push buttons.navigate. They are push buttons.
• Tab title rowTab title row - All tab titles will appear in a row.- All tab titles will appear in a row.
• Tab PageTab Page - A tab page contains a collection of fields that logically- A tab page contains a collection of fields that logically
belong together. Tab pages are implemented using subscreens.belong together. Tab pages are implemented using subscreens.
• For designing and using tab strip controls, see TransactionFor designing and using tab strip controls, see Transaction BIBSBIBS ..
Tab Strip Control componentsTab Strip Control components
©India SAP CoE, Slide 106
Tab Strip ControlsTab Strip Controls
•Tab strip controls allow you to place a series of screens belonging to an
application on a single screen, and to navigate between them easily.
•From a technical point of view, a tab page is a sunscreen with a pushbutton
assigned to it, which is displayed as the tab title.
When you create a tab strip control, you
must: ……….
1. Define the tab area on a screen and the
tab titles.
2. Assign a subscreen area to each tab title.
3. Program the screen flow logic.
4. Program the ABAP processing logic.
©India SAP CoE, Slide 107
Assigning a Subscreen Area to a Tab Title
1. Paging in the SAPgui
PROCESS BEFORE OUTPUT.
...
CALL SUBSCREEN: area1 INCLUDING [prog1] dynp1,
area2 INCLUDING [prog2] dynp2,
area3 INCLUDING [prog3] dynp3,
...
PROCESS AFTER INPUT.
...
CALL SUBSCREEN: area1,
area2,
area3,
…
2. Paging on the application server
PROCESS BEFORE OUTPUT.
...
CALL SUBSCREEN area INCLUDING [prog] dynp.
...
PROCESS AFTER INPUT.
...
CALL SUBSCREEN area.
Tab Strip ControlsTab Strip Controls
©India SAP CoE, Slide 108
Handling in the ABAP Program
Create a control for each control in the declaration part of your
program using the following statement:
CONTROLS ctrl TYPE TABSTRIP.
PROCESS BEFORE OUTPUT.
...
Assign the function code of the corresponding tab title to the
component Activetab:
ctrl-Activetab = fcode.
PROCESS AFTER INPUT
…
Activetab contains the function code of the last active tab title on the
screen.
Tab Strip ControlsTab Strip Controls
©India SAP CoE, Slide 109
Programming the Flow Logic
The flow logic is restricted to that necessary to include the appropriate
subscreen screens in the right subscreen areas.
Local Scrolling at the Front-end
Include subscreen screens in all of your subscreen areas in the
tab strip control.
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN: <subscreen_area1> INCLUDING [<progname 1>] <subscreen_scrn 1>,
<subscreen_area2> INCLUDING [<progname 2>] <subscreen_scrn 2>,
<subscreen_area3> INCLUDING [<progname 3>] <subscreen_scrn 3>,
PROCESS AFTER INPUT
CALL SUBSCREEN: <subscreen_area1>,
<subscreen_area2>,
<subscreen_area3>,
Tab Strip ControlsTab Strip Controls
©India SAP CoE, Slide 110
Programming the Flow Logic
The flow logic is restricted to that necessary to include the appropriate
subscreen screens in the right subscreen areas.
Scrolling at the Application Server
Include one subscreen at a time in a single subscreen area.
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN < subscreen_area> INCLUDING [<progname>] <subscreen_scrn>.
PROCESS AFTER INPUT
CALL SUBSCREEN < subscreen_area>.
Tab Strip ControlsTab Strip Controls
©India SAP CoE, Slide 111
Step loopsStep loops
• Step loops are considerable less flexible than table controls.Step loops are considerable less flexible than table controls.
• Used to group screen elements together. A step loop is a repeated seriesUsed to group screen elements together. A step loop is a repeated series
of loop blocks. A loop block consists of one or more loop lines ofof loop blocks. A loop block consists of one or more loop lines of
graphical screen elements.graphical screen elements.
• Loop blocs can be defined as fixed or variable.Loop blocs can be defined as fixed or variable.
– In a fixed loop, the lower limit of the loop area always remains asIn a fixed loop, the lower limit of the loop area always remains as
originally defined.originally defined.
– For a variable loop, the number of repetitions is adjustedFor a variable loop, the number of repetitions is adjusted
dynamically in the screen program to suit the size of the currentdynamically in the screen program to suit the size of the current
window.window.
©India SAP CoE, Slide 112
Creating a Step loopCreating a Step loop
• Open a screen in the layout editor.Open a screen in the layout editor.
• In one or more lines, create the elements you want to repeat.In one or more lines, create the elements you want to repeat.
• Select all the elements on the desired line(s) as a group.Select all the elements on the desired line(s) as a group.
• Choose EditChoose Edit GroupingGrouping  Step loopStep loop Define.Define.
• Your element lines now make up a single step loop block. The blockYour element lines now make up a single step loop block. The block
includes the original elements with their attributes and a predefined numberincludes the original elements with their attributes and a predefined number
of repetition blocks.of repetition blocks.
• Each repetition contains a copy of the first block without attributes.Each repetition contains a copy of the first block without attributes.
• The repetition blocks are consecutively numbered, so that you can establishThe repetition blocks are consecutively numbered, so that you can establish
a reference to a particular line.a reference to a particular line.
©India SAP CoE, Slide 113
Step loopsStep loops
• To use a Step-Loop block in an online program, you must create one workTo use a Step-Loop block in an online program, you must create one work
area for the Step-Loop block. To hold all the lines of a Step-Loop block inarea for the Step-Loop block. To hold all the lines of a Step-Loop block in
the program’s memory area, use an internal table.the program’s memory area, use an internal table.
Ex:-TYPES: BEGIN OF TY_REC,Ex:-TYPES: BEGIN OF TY_REC,
MATNR TTPE MARA-MATNR,MATNR TTPE MARA-MATNR,
MATKL TYPE MARA-MATKL,MATKL TYPE MARA-MATKL,
END OF TY_REC.END OF TY_REC.
DATA: GT_MARA TYPE TABLE OF TY_REC WITHDATA: GT_MARA TYPE TABLE OF TY_REC WITH
HEADER LINE.HEADER LINE.
• For Step loop the flow logic statement loop must be coded in both PBO andFor Step loop the flow logic statement loop must be coded in both PBO and
PAI event. One form of the Flow Logic “LOOP” statement is;PAI event. One form of the Flow Logic “LOOP” statement is;
LOOP.LOOP.
. . . <flow logic statements> . . .. . . <flow logic statements> . . .
ENDLOOP.ENDLOOP.
©India SAP CoE, Slide 114
Main screen Flow logicMain screen Flow logic
Main screen flow logic for calling subscreen.Main screen flow logic for calling subscreen.
PROCESS BEFORE OUTPUT.PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.MODULE STATUS_0100.
call subscreen SUB1 including 'Z_MODULE_TRAINING' '0110'.call subscreen SUB1 including 'Z_MODULE_TRAINING' '0110'.
PROCESS AFTER INPUT.PROCESS AFTER INPUT.
call subscreen SUB1.call subscreen SUB1.
MODULE USER_COMMAND_0100.MODULE USER_COMMAND_0100.
©India SAP CoE, Slide 115
Additions with ABAP OOPSAdditions with ABAP OOPS
• Enjoy SAP controls (ALV Grid , ALV Tree, HTML controls etc) can beEnjoy SAP controls (ALV Grid , ALV Tree, HTML controls etc) can be
displayed in screen.displayed in screen.
• To place these grids we need to have screen element Custom ControlTo place these grids we need to have screen element Custom Control
placed on the screen.placed on the screen.
• Also we need to have ABAP OOPS knowledge. ( Refer package SLISAlso we need to have ABAP OOPS knowledge. ( Refer package SLIS
for examples)for examples)
©India SAP CoE, Slide 116
Process on HelpProcess on Help
• This event is a user programmed help.This event is a user programmed help.
• If the user presses the ‘F1’ key with the cursor is positioned in <screenIf the user presses the ‘F1’ key with the cursor is positioned in <screen
field>, the <supplemental documentation> will be displayed along withfield>, the <supplemental documentation> will be displayed along with
the data element’s short text and documentation.the data element’s short text and documentation.
• The only other Flow Logic statement that can be used in the POH eventThe only other Flow Logic statement that can be used in the POH event
is:is:
FIELD <screen field> MODULE <module>.FIELD <screen field> MODULE <module>.
©India SAP CoE, Slide 117
Process on ValueProcess on Value
• This event is a user-programmed help that occurs when the user pressesThis event is a user-programmed help that occurs when the user presses
F4 with the cursor positioned on a screen field.F4 with the cursor positioned on a screen field.
• The modules specified in the subsequent FIELD statement is calledThe modules specified in the subsequent FIELD statement is called
instead of the SAP help.instead of the SAP help.
• Syntax is:Syntax is:
FIELD <screen field> MODULE <module>.FIELD <screen field> MODULE <module>.
©India SAP CoE, Slide 118
Module pool programmingModule pool programming
1 PrepareMe
2 Syntax Description
3 Demonstration
4 Exercises
5 HelpMe
Introduction
©India SAP CoE, Slide 119
DemonstrationDemonstration
Please refer the attached document for demo example.Please refer the attached document for demo example.
Microsoft Word
Document
©India SAP CoE, Slide 120
Module pool programmingModule pool programming
1 Introduction
2 Syntax Description
3 Demonstration
4 Exercises
5 HelpMe
©India SAP CoE, Slide 121
ExercisesExercises
Please refer the attached documents for hands-on.Please refer the attached documents for hands-on.
• Exercise 1 – This covers input/output, radio button, table control, screenExercise 1 – This covers input/output, radio button, table control, screen
navigation, flow logic events, Menu painter.navigation, flow logic events, Menu painter.
• Exercise 2 – This covers tab strip, subscreen, table control, 4 flow logicExercise 2 – This covers tab strip, subscreen, table control, 4 flow logic
events, screen navigation, menu painter.events, screen navigation, menu painter.
Microsoft Word
Document
Microsoft Word
Document
©India SAP CoE, Slide 122
Module pool programmingModule pool programming
1 Introduction
2 Syntax Description
3 Demonstration
4 Exercises
5 HelpMe
©India SAP CoE, Slide 123
HelpMeHelpMe
• ReferRefer help.sap.comhelp.sap.com
• Refer Transaction codeRefer Transaction code ABAPDOCUABAPDOCU (check in drop down ABAP User(check in drop down ABAP User
Dialogs) for documentation and examplesDialogs) for documentation and examples
• For screen elements and controls (table control, tabstrip) referFor screen elements and controls (table control, tabstrip) refer
transactiontransaction BIBSBIBS..
• Refer package SLIS for examples of ALV grids, ALV Tree.Refer package SLIS for examples of ALV grids, ALV Tree.

More Related Content

What's hot

abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)Kranthi Kumar
 
Sap Abap Reports
Sap Abap ReportsSap Abap Reports
Sap Abap Reportsvbpc
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONKranthi Kumar
 
Abap function module help
Abap function module helpAbap function module help
Abap function module helpKranthi Kumar
 
Dialog Programming Overview
Dialog Programming OverviewDialog Programming Overview
Dialog Programming Overviewsapdocs. info
 
Call transaction method
Call transaction methodCall transaction method
Call transaction methodKranthi Kumar
 
Module-Pool-Tutorial.pdf
Module-Pool-Tutorial.pdfModule-Pool-Tutorial.pdf
Module-Pool-Tutorial.pdfSuman817957
 
ABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type GroupABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type Groupsapdocs. info
 
ABAP Open SQL & Internal Table
ABAP Open SQL & Internal TableABAP Open SQL & Internal Table
ABAP Open SQL & Internal Tablesapdocs. info
 
Smartforms interview questions with answers
Smartforms interview questions with answersSmartforms interview questions with answers
Smartforms interview questions with answersUttam Agrawal
 
Table maintenance generator and its modifications
Table maintenance generator and its modificationsTable maintenance generator and its modifications
Table maintenance generator and its modificationsscribid.download
 
ABAP Event-driven Programming &Selection Screen
ABAP Event-driven Programming &Selection ScreenABAP Event-driven Programming &Selection Screen
ABAP Event-driven Programming &Selection Screensapdocs. info
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniquesJugul Crasta
 
SAP ABAP - Needed Notes
SAP   ABAP - Needed NotesSAP   ABAP - Needed Notes
SAP ABAP - Needed NotesAkash Bhavsar
 

What's hot (20)

abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)
 
Sap Abap Reports
Sap Abap ReportsSap Abap Reports
Sap Abap Reports
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATION
 
Abap function module help
Abap function module helpAbap function module help
Abap function module help
 
Sap abap
Sap abapSap abap
Sap abap
 
Sap scripts
Sap scriptsSap scripts
Sap scripts
 
Dialog Programming Overview
Dialog Programming OverviewDialog Programming Overview
Dialog Programming Overview
 
Call transaction method
Call transaction methodCall transaction method
Call transaction method
 
Module-Pool-Tutorial.pdf
Module-Pool-Tutorial.pdfModule-Pool-Tutorial.pdf
Module-Pool-Tutorial.pdf
 
CDS Views.pptx
CDS Views.pptxCDS Views.pptx
CDS Views.pptx
 
ABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type GroupABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type Group
 
Reports
ReportsReports
Reports
 
ABAP Open SQL & Internal Table
ABAP Open SQL & Internal TableABAP Open SQL & Internal Table
ABAP Open SQL & Internal Table
 
Smartforms interview questions with answers
Smartforms interview questions with answersSmartforms interview questions with answers
Smartforms interview questions with answers
 
Table maintenance generator and its modifications
Table maintenance generator and its modificationsTable maintenance generator and its modifications
Table maintenance generator and its modifications
 
Sap Adobe Form
Sap Adobe FormSap Adobe Form
Sap Adobe Form
 
ABAP Event-driven Programming &Selection Screen
ABAP Event-driven Programming &Selection ScreenABAP Event-driven Programming &Selection Screen
ABAP Event-driven Programming &Selection Screen
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniques
 
SAP ABAP - Needed Notes
SAP   ABAP - Needed NotesSAP   ABAP - Needed Notes
SAP ABAP - Needed Notes
 
Alv theory
Alv theoryAlv theory
Alv theory
 

Viewers also liked

Creation of a web service in sap
Creation of a web service in sapCreation of a web service in sap
Creation of a web service in saprajdongre
 
SAP ABAP web services creation.
SAP ABAP web services creation. SAP ABAP web services creation.
SAP ABAP web services creation. Anjali Rao
 
Classical ABAP interactive report
Classical ABAP interactive reportClassical ABAP interactive report
Classical ABAP interactive reportRavi Kanudawala
 
Sap abap online training
Sap abap online trainingSap abap online training
Sap abap online trainingShalom Itschool
 
Sap hr abap_course_content
Sap hr abap_course_contentSap hr abap_course_content
Sap hr abap_course_contentsap Logic
 
Abap slide exceptionshandling
Abap slide exceptionshandlingAbap slide exceptionshandling
Abap slide exceptionshandlingMilind Patil
 
Abap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksAbap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksMilind Patil
 
Dr John Dee - Communications With Spirits - Free Ebook
Dr John Dee -  Communications With Spirits - Free EbookDr John Dee -  Communications With Spirits - Free Ebook
Dr John Dee - Communications With Spirits - Free EbookChuck Thompson
 
Dot Net 串接 SAP
Dot Net 串接 SAPDot Net 串接 SAP
Dot Net 串接 SAPLearningTech
 
Chapter 06 printing sap script forms
Chapter 06 printing sap script formsChapter 06 printing sap script forms
Chapter 06 printing sap script formsKranthi Kumar
 
Abap slides user defined data types and data
Abap slides user defined data types and dataAbap slides user defined data types and data
Abap slides user defined data types and dataMilind Patil
 

Viewers also liked (15)

Abap slides set1
Abap slides set1Abap slides set1
Abap slides set1
 
Creation of a web service in sap
Creation of a web service in sapCreation of a web service in sap
Creation of a web service in sap
 
SAP ABAP web services creation.
SAP ABAP web services creation. SAP ABAP web services creation.
SAP ABAP web services creation.
 
Badi document
Badi documentBadi document
Badi document
 
Classical ABAP interactive report
Classical ABAP interactive reportClassical ABAP interactive report
Classical ABAP interactive report
 
Sap abap online training
Sap abap online trainingSap abap online training
Sap abap online training
 
Project Report on SAP
Project Report on SAPProject Report on SAP
Project Report on SAP
 
Sap hr abap_course_content
Sap hr abap_course_contentSap hr abap_course_content
Sap hr abap_course_content
 
Abap slide exceptionshandling
Abap slide exceptionshandlingAbap slide exceptionshandling
Abap slide exceptionshandling
 
Abap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksAbap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checks
 
Dr John Dee - Communications With Spirits - Free Ebook
Dr John Dee -  Communications With Spirits - Free EbookDr John Dee -  Communications With Spirits - Free Ebook
Dr John Dee - Communications With Spirits - Free Ebook
 
Dot Net 串接 SAP
Dot Net 串接 SAPDot Net 串接 SAP
Dot Net 串接 SAP
 
022006 zaidi badi
022006   zaidi badi022006   zaidi badi
022006 zaidi badi
 
Chapter 06 printing sap script forms
Chapter 06 printing sap script formsChapter 06 printing sap script forms
Chapter 06 printing sap script forms
 
Abap slides user defined data types and data
Abap slides user defined data types and dataAbap slides user defined data types and data
Abap slides user defined data types and data
 

Similar to ABAP Module Pool Programming Guide

Mho Web Dynpro Abap
Mho Web Dynpro AbapMho Web Dynpro Abap
Mho Web Dynpro Abapthomas_jung
 
Abap fundamentals-training-course-document
Abap fundamentals-training-course-documentAbap fundamentals-training-course-document
Abap fundamentals-training-course-documentjohnbryan26
 
Sap Tips and Tricks Training for End user
Sap Tips and Tricks Training for End userSap Tips and Tricks Training for End user
Sap Tips and Tricks Training for End userArghadip Kar
 
BTP+Onboarding+Webinar+-+SAP+Build+Apps+January+2024.pdf
BTP+Onboarding+Webinar+-+SAP+Build+Apps+January+2024.pdfBTP+Onboarding+Webinar+-+SAP+Build+Apps+January+2024.pdf
BTP+Onboarding+Webinar+-+SAP+Build+Apps+January+2024.pdfsamimbangalore
 
SAP AC020 - Investment Management
SAP AC020 - Investment ManagementSAP AC020 - Investment Management
SAP AC020 - Investment ManagementVannak9
 
sap abap training in chennai
sap abap training in chennaisap abap training in chennai
sap abap training in chennaisanjai rsamy
 
Atos Ibm Sap Event 22 06 2012v2 Shekhar
Atos Ibm Sap Event 22 06 2012v2 ShekharAtos Ibm Sap Event 22 06 2012v2 Shekhar
Atos Ibm Sap Event 22 06 2012v2 ShekharShekhar Bhartiya
 
Let start with GUIXT
Let start with GUIXTLet start with GUIXT
Let start with GUIXTKang YAyan
 
Dynamic variant creation
Dynamic variant creationDynamic variant creation
Dynamic variant creationyoung moon woo
 
Web(abap introduction)
Web(abap introduction)Web(abap introduction)
Web(abap introduction)Kranthi Kumar
 
ASUG webcast - going mobile with Slipstream Engine March 2018
ASUG webcast - going mobile with Slipstream Engine March 2018ASUG webcast - going mobile with Slipstream Engine March 2018
ASUG webcast - going mobile with Slipstream Engine March 2018Peter Spielvogel
 
Abap sample code
Abap sample codeAbap sample code
Abap sample coderoymat2
 
Abap for functional consultants
Abap for functional consultantsAbap for functional consultants
Abap for functional consultantsMohammad Mousavi
 
Abap sample programs 24 slides
Abap sample programs 24 slidesAbap sample programs 24 slides
Abap sample programs 24 slidesRoy Mathew
 
dokumen.tips_sap-dialog-programming.pdf
dokumen.tips_sap-dialog-programming.pdfdokumen.tips_sap-dialog-programming.pdf
dokumen.tips_sap-dialog-programming.pdfssuser70d8791
 

Similar to ABAP Module Pool Programming Guide (20)

Abap for sd consultatnt
Abap for sd consultatntAbap for sd consultatnt
Abap for sd consultatnt
 
Mho Web Dynpro Abap
Mho Web Dynpro AbapMho Web Dynpro Abap
Mho Web Dynpro Abap
 
Abap fundamentals-training-course-document
Abap fundamentals-training-course-documentAbap fundamentals-training-course-document
Abap fundamentals-training-course-document
 
Sap Tips and Tricks Training for End user
Sap Tips and Tricks Training for End userSap Tips and Tricks Training for End user
Sap Tips and Tricks Training for End user
 
BTP+Onboarding+Webinar+-+SAP+Build+Apps+January+2024.pdf
BTP+Onboarding+Webinar+-+SAP+Build+Apps+January+2024.pdfBTP+Onboarding+Webinar+-+SAP+Build+Apps+January+2024.pdf
BTP+Onboarding+Webinar+-+SAP+Build+Apps+January+2024.pdf
 
SAP AC020 - Investment Management
SAP AC020 - Investment ManagementSAP AC020 - Investment Management
SAP AC020 - Investment Management
 
sap abap training in chennai
sap abap training in chennaisap abap training in chennai
sap abap training in chennai
 
Sap Fundamental
Sap FundamentalSap Fundamental
Sap Fundamental
 
Atos Ibm Sap Event 22 06 2012v2 Shekhar
Atos Ibm Sap Event 22 06 2012v2 ShekharAtos Ibm Sap Event 22 06 2012v2 Shekhar
Atos Ibm Sap Event 22 06 2012v2 Shekhar
 
Abap training material
Abap training material Abap training material
Abap training material
 
Let start with GUIXT
Let start with GUIXTLet start with GUIXT
Let start with GUIXT
 
Dynamic variant creation
Dynamic variant creationDynamic variant creation
Dynamic variant creation
 
Web(abap introduction)
Web(abap introduction)Web(abap introduction)
Web(abap introduction)
 
ASUG webcast - going mobile with Slipstream Engine March 2018
ASUG webcast - going mobile with Slipstream Engine March 2018ASUG webcast - going mobile with Slipstream Engine March 2018
ASUG webcast - going mobile with Slipstream Engine March 2018
 
Abap sample code
Abap sample codeAbap sample code
Abap sample code
 
Abap for functional consultants
Abap for functional consultantsAbap for functional consultants
Abap for functional consultants
 
Abap sample programs 24 slides
Abap sample programs 24 slidesAbap sample programs 24 slides
Abap sample programs 24 slides
 
Abap sample
Abap sampleAbap sample
Abap sample
 
Abap start
Abap startAbap start
Abap start
 
dokumen.tips_sap-dialog-programming.pdf
dokumen.tips_sap-dialog-programming.pdfdokumen.tips_sap-dialog-programming.pdf
dokumen.tips_sap-dialog-programming.pdf
 

Recently uploaded

Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleCeline George
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 

Recently uploaded (20)

Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 

ABAP Module Pool Programming Guide

  • 1. ©India SAP CoE, Slide 1 Topic: ABAP report – Module Pool Programming Created By: SAP Team Approved By: Sachin Dayma Date of Release: July, 2008 Version: 1.0
  • 2. ©India SAP CoE, Slide 2 Module pool programmingModule pool programming 1 Introduction 2 Syntax Description 3 Demonstration 4 Exercises 5 HelpMe
  • 3. ©India SAP CoE, Slide 3 Module Pool program. Module Pool Program (also called Online programs , dialog programs, or transactions) do not produces lists. These programs are a collection of screens, their Flow Logic, and the code within the main ABAP program. A dialog program offers: • A user-friendly user interface • Format and consistency checks for the data entered by the user • Easy correction of input errors • Access to data by storing it in the database.
  • 4. ©India SAP CoE, Slide 4 PurposePurpose For performing any kind of task in SAP R/3 system, a transaction is used.For performing any kind of task in SAP R/3 system, a transaction is used. SAP provides a standard set of transactions to manipulate data in theSAP provides a standard set of transactions to manipulate data in the system. But sometimes, the need to create a customer specific transactionsystem. But sometimes, the need to create a customer specific transaction arise due to following reasons :arise due to following reasons :  Standard SAP may not support that task.Standard SAP may not support that task.  A particular transaction needs to be customized to suit the customerA particular transaction needs to be customized to suit the customer requirements .requirements . A transaction (also called module pool programs, dialog programs) isA transaction (also called module pool programs, dialog programs) is defined as a collection of screens (the actual, physical image that the usersdefined as a collection of screens (the actual, physical image that the users sees), their Flow Logic (code behind the screens ), and the code within thesees), their Flow Logic (code behind the screens ), and the code within the main ABAP program.main ABAP program.
  • 5. ©India SAP CoE, Slide 5 Program Attributes Title Type “M” Application Online program name must begin with either a “Y” or “Z”. Go back to Repository Browser, not source code. “With TOP INCL.” should be checked. Creating an Online ProgramCreating an Online Program
  • 6. ©India SAP CoE, Slide 6 Module Pool Program ComponentsModule Pool Program Components Top Include PBO Modules PAI Modules ABAP Subroutines
  • 7. ©India SAP CoE, Slide 7 • An online program consists not only of the screens and their Flow Logic,An online program consists not only of the screens and their Flow Logic, but also ABAP program components: Global data, PBO modules, PAIbut also ABAP program components: Global data, PBO modules, PAI modules, and subroutines.modules, and subroutines. • Global data: It is declared in the Top Include program.Global data: It is declared in the Top Include program. • PBO and PAI modules: It contain the main processing logic of onlinePBO and PAI modules: It contain the main processing logic of online program and are “called” from within the Flow Logic of the screens.program and are “called” from within the Flow Logic of the screens. • The subroutines (if necessary) are in a separate include program.The subroutines (if necessary) are in a separate include program. Module Pool ProgramModule Pool Program
  • 8. ©India SAP CoE, Slide 8 Transaction Code Transaction Text F8 Program Name Initial Screen required required required Executing an Online ProgramExecuting an Online Program
  • 9. ©India SAP CoE, Slide 9 Module pool programmingModule pool programming 1 Introduction 2 Syntax description 3 Demonstration 4 Exercises 5 HelpMe
  • 10. ©India SAP CoE, Slide 10 Tools used:Tools used: When creating an module pool program, you will use many tools withinWhen creating an module pool program, you will use many tools within the ABAP Development Workbench: Screen Painter, ABAP Editor,the ABAP Development Workbench: Screen Painter, ABAP Editor, Menu Painter, ABAP Dictionary, and Repository Browser.Menu Painter, ABAP Dictionary, and Repository Browser. • ABAP Editor (SE38) – To maintain main ABAP program. Program contains data declarations and modules. Online Programming | 2.01 | August-2003Slide 2 IBM Global Services © Copyright IBM Corporation 2003 Developing Online Programs Repository Browser Screen Painter ABAP Editor ABAP Dictionary Menu Painter
  • 11. ©India SAP CoE, Slide 11 •Screen Painter(SE51)– used to maintain components of screen. •Menu Painter(SE41) – Used to design GUI. •Maintain Transaction(SE93) – To create transaction code for program. •Object Navigator (Repository Browser)(SE80) - You should always use the object navigator for online programs because you will be able to see the hierarchy. From this hierarchy list, you will be able to branch to the Screen Painter, ABAP Editor, Menu Painter, and ABAP Dictionary. •You should always use the Repository Browser to create online programs because the system will automatically maintain an online program’s sub- objects and you will be able to see the hierarchy list of these sub-objects. From this hierarchy list, you will be able to branch to the Screen Painter, ABAP Editor, Menu Painter, and ABAP Dictionary. Tools used:Tools used:
  • 12. ©India SAP CoE, Slide 12 Creating a ProgramCreating a Program • Create a program using transaction SE38. Program name as Z_MODULE_TRAINING. • Program type should be Module Pool. Save and activate the program. • Use object navigator(SE80) to further develop the object.
  • 13. ©India SAP CoE, Slide 13 Program StructureProgram Structure • Module pool program when viewed from SE80 transaction will haveModule pool program when viewed from SE80 transaction will have structure as below,structure as below,
  • 14. ©India SAP CoE, Slide 14 Assigning transaction codeAssigning transaction code • Dialog program is executed using transaction code. We can not executeDialog program is executed using transaction code. We can not execute this like normal report using execute or pressing F8 button.this like normal report using execute or pressing F8 button. • Transaction is created using SE93 transaction or from object browser byTransaction is created using SE93 transaction or from object browser by right clicking on transaction, click on create. Give name and descriptionright clicking on transaction, click on create. Give name and description and select the radio button Program and screen (dialog transaction)and select the radio button Program and screen (dialog transaction)
  • 15. ©India SAP CoE, Slide 15 Use of ScreenUse of Screen • Screen is a interface between user and SAP.Screen is a interface between user and SAP. • Using screen user can provide input to program and in turn program willUsing screen user can provide input to program and in turn program will display result on screen.display result on screen. • Screen is made up of screen elements such as text box, input/outputScreen is made up of screen elements such as text box, input/output field, check box, radio button etc.field, check box, radio button etc. • One of the strength is that screen elements are combined with theOne of the strength is that screen elements are combined with the ABAP dictionary to allow check the consistency of the data that userABAP dictionary to allow check the consistency of the data that user has entered.has entered.
  • 16. ©India SAP CoE, Slide 16 Screen PainterScreen Painter • To start the Screen Painter, choose the corresponding pushbutton on theTo start the Screen Painter, choose the corresponding pushbutton on the initial screen of the ABAP Workbench or enter Transaction SE51.initial screen of the ABAP Workbench or enter Transaction SE51. • Best practice is to go to transaction SE80, enter program name and youBest practice is to go to transaction SE80, enter program name and you can perform one of the below,can perform one of the below, 1. Create new screens.1. Create new screens. 2. Test an existing screen.2. Test an existing screen. 3. Create new components for an existing screen3. Create new components for an existing screen.. • Screen is always created for an existing program.Screen is always created for an existing program.
  • 17. ©India SAP CoE, Slide 17 Overview of Screen PainterOverview of Screen Painter Screen Painter Screen Attributes Screen Layout Field Attributes Flow Logic
  • 18. ©India SAP CoE, Slide 18 Developing ScreenDeveloping Screen • From Object navigator (SE80) we can create the screen as shown,From Object navigator (SE80) we can create the screen as shown, • Click on Screen, right click and select create option.Click on Screen, right click and select create option. • Now enter screen number.Now enter screen number.
  • 19. ©India SAP CoE, Slide 19 Developing ScreenDeveloping Screen Screen numbers can be up to 4 characters long, all of which must beScreen numbers can be up to 4 characters long, all of which must be digits.digits. The number 1000 is reserved for table screens and report selectionThe number 1000 is reserved for table screens and report selection screen.screen. Screen numbers from 9000 are reserved for customer-specific screens.Screen numbers from 9000 are reserved for customer-specific screens. The use of screen numbers is namespace-dependent.The use of screen numbers is namespace-dependent. For screens in programs in the SAP namespace, numbers less than 9000For screens in programs in the SAP namespace, numbers less than 9000 are reserved for SAP screens, numbers between 9000 and 9500 areare reserved for SAP screens, numbers between 9000 and 9500 are reserved for SAP partners, and numbers greater than 9500 are forreserved for SAP partners, and numbers greater than 9500 are for customers.customers.
  • 20. ©India SAP CoE, Slide 20 • For screens in programs in the Customize namespace, any four digitFor screens in programs in the Customize namespace, any four digit number can be used as screen number except 1000 as mentioned above.number can be used as screen number except 1000 as mentioned above. • Usual practice is to have screen numbers for customize module poolUsual practice is to have screen numbers for customize module pool program, starting with 100 then continue as 200, 300 etc.program, starting with 100 then continue as 200, 300 etc. • Enter screen number and click on create.Enter screen number and click on create. Developing ScreenDeveloping Screen
  • 21. ©India SAP CoE, Slide 21 Developing ScreenDeveloping Screen Enter description and save.Enter description and save. Check the screen and activate it.Check the screen and activate it.
  • 22. ©India SAP CoE, Slide 22 Screen AttributesScreen Attributes • Short descriptionShort description – Describes screen purpose– Describes screen purpose • Original languageOriginal language – Default logon language– Default logon language • PackagePackage – Identifies the package with which screen is saved– Identifies the package with which screen is saved • Last changed on/byLast changed on/by – Date & time screen is last changed– Date & time screen is last changed • Last generationLast generation – Date & time screen is last generated.– Date & time screen is last generated.
  • 23. ©India SAP CoE, Slide 23 Screen AttributesScreen Attributes Screen Type –Screen Type – • NormalNormal – Default setting– Default setting • SubscreenSubscreen – To indicate the screen as a subscreen– To indicate the screen as a subscreen • Modal dialog boxModal dialog box – used to display details in a dialog box. Used for data– used to display details in a dialog box. Used for data input, confirmation/error/help messages.input, confirmation/error/help messages. • Selection screenSelection screen – Identifies selection screen. The system sets this– Identifies selection screen. The system sets this attribute automatically.attribute automatically. SettingsSettings • Hold dataHold data –– On checking this, system can hold entries made on theOn checking this, system can hold entries made on the screen at runtime. System automatically displays this data if the user callsscreen at runtime. System automatically displays this data if the user calls the particular screen again.the particular screen again.
  • 24. ©India SAP CoE, Slide 24 Screen AttributesScreen Attributes SettingsSettings • Switch off runtime compressSwitch off runtime compress –– On setting this option, the screen is notOn setting this option, the screen is not compressed at runtime.compressed at runtime. • Template non executableTemplate non executable –– This attribute is primarily for internal use byThis attribute is primarily for internal use by SAP.SAP. • Hold scroll positionHold scroll position – On setting the attribute, the scroll position is– On setting the attribute, the scroll position is retained when the user returns to the screen after processing anotherretained when the user returns to the screen after processing another screen.screen. • Without application tool barWithout application tool bar –– To suppress the display of the applicationTo suppress the display of the application toolbar belonging to the current program status.toolbar belonging to the current program status. Other AttributesOther Attributes • Next ScreenNext Screen –– Next screen number to be displayed.Next screen number to be displayed.
  • 25. ©India SAP CoE, Slide 25 Screen AttributesScreen Attributes Other AttributesOther Attributes • Cursor positionCursor position –– Identifies the screen element that contains the cursor when aIdentifies the screen element that contains the cursor when a screen is first displayed. If you leave this field blank, the system uses the firstscreen is first displayed. If you leave this field blank, the system uses the first screen field that can accept input.screen field that can accept input. • Screen groupScreen group –– Specifies a four-character identifier of a group of associatedSpecifies a four-character identifier of a group of associated screens.screens. • Line/ColumnsLine/Columns –– OccupiedOccupied –– Specifies the size of the screen area currently occupied withSpecifies the size of the screen area currently occupied with screen elementsscreen elements MaintainedMaintained –– Size of the screen in rows/columns.Size of the screen in rows/columns. • Context menuContext menu – It will hold a routine name required to set up the context– It will hold a routine name required to set up the context menu in the program. This routine connects the screen (elements) from themenu in the program. This routine connects the screen (elements) from the Screen Painter to the context menu of the program.Screen Painter to the context menu of the program.
  • 26. ©India SAP CoE, Slide 26 Screen Layout ModeScreen Layout Mode The Screen Painter has a layout editor that you use to design your screenThe Screen Painter has a layout editor that you use to design your screen layout.layout. It works in two modes:It works in two modes: • Graphical modeGraphical mode –– Drag and drop interface is used, similar to a drawingDrag and drop interface is used, similar to a drawing tool.tool. • Alphanumeric modeAlphanumeric mode –– Keyboard and menus are used for designing.Keyboard and menus are used for designing. Both modes offer the same functions but use different interfaces. GraphicalBoth modes offer the same functions but use different interfaces. Graphical mode of screen designing is commonly used.mode of screen designing is commonly used.
  • 27. ©India SAP CoE, Slide 27 Screen DesigningScreen Designing • We have learnt about creating a screen.We have learnt about creating a screen. • To start screen design, click on layout button on screen.To start screen design, click on layout button on screen. • Graphical Screen painter will start loading.Graphical Screen painter will start loading.
  • 28. ©India SAP CoE, Slide 28 Components of Layout EditorComponents of Layout Editor • Element paletteElement palette – Used for creating screen elements. These can be drag– Used for creating screen elements. These can be drag & dropped on screen.& dropped on screen. • Work AreaWork Area –– Screen design is done in this area.Screen design is done in this area. • Element barElement bar – screen element attributes appear in this line. You can also– screen element attributes appear in this line. You can also change these attributes in the corresponding field.change these attributes in the corresponding field.
  • 29. ©India SAP CoE, Slide 29 Creating Radio Button Radio ButtonRadio Button •Click on the Radio Button Icon and Click on the Screen. •Create at least two Radio Buttons •Name the Radio Buttons and Activate it.
  • 30. ©India SAP CoE, Slide 30 Defining Radio Button GroupDefining Radio Button Group Assign Radio Buttons into one Group. Select the Radio Buttons and Follow the steps.
  • 31. ©India SAP CoE, Slide 31 • Click on the Check Box Icon and Click on the Screen. • Name the Check Box and Activate it. • Special input/output fields that the user can either select (value ‘X’) or deselect (value SPACE). Checkbox elements can be linked with function codes. Creating Check Box Check BoxCheck Box Name the Check box
  • 32. ©India SAP CoE, Slide 32 Screen ComponentsScreen Components • Screen element properties can be seen inScreen element properties can be seen in detail by double clicking on the element.detail by double clicking on the element. • Properties of an element can be set here,Properties of an element can be set here, such as variable length, F4 help,such as variable length, F4 help, input/output, mode of display etc.input/output, mode of display etc. • Best practice is to define screenBest practice is to define screen elements by adopting the correspondingelements by adopting the corresponding field from the ABAP Dictionary.field from the ABAP Dictionary. However, you can also use fieldHowever, you can also use field descriptions that you defined in yourdescriptions that you defined in your program. To do this you must generateprogram. To do this you must generate the program first.the program first.
  • 33. ©India SAP CoE, Slide 33 Screen ElementsScreen Elements Screen elements are,Screen elements are, • Text fieldText field • Input/Output fieldInput/Output field • Check boxCheck box • Radio buttonRadio button • Push buttonPush button • Tab stripTab strip • BoxBox • Sub screen areaSub screen area • Table controlTable control • Custom controlCustom control • Status IconStatus Icon Each element will have unique name.Each element will have unique name. Function code will be assigned for pushFunction code will be assigned for push buttons, tab titles in tab strip controls,buttons, tab titles in tab strip controls, Input/output fields with the "Dropdown box"Input/output fields with the "Dropdown box" attribute.attribute. Each element will have its position onEach element will have its position on screen, visible/definite length, mode ofscreen, visible/definite length, mode of display etc.display etc.
  • 34. ©India SAP CoE, Slide 34 Screen ElementsScreen Elements Push Button –Push Button – • Can be placed on screen by dragCan be placed on screen by drag & drop from Element palette.& drop from Element palette. • To set the properties, doubleTo set the properties, double click on it.click on it. • Each screen element shouldEach screen element should have unique name.have unique name. • In addition to that push buttonIn addition to that push button will have text and function codewill have text and function code assigned to it.assigned to it.
  • 35. ©India SAP CoE, Slide 35 Function Code for Push Buttons, check box, Radio Button Assign Parameter ID to Input / Output Field Dict. Tab is Selected Program Tab is Selected Tick If Input or Output Box Entries in (*********) Choose if want to Make the Field Mandatory Screen ElementsScreen Elements
  • 36. ©India SAP CoE, Slide 36 Screen ElementsScreen Elements Once screen is designed, it should be saved and checked for errors and activated.Once screen is designed, it should be saved and checked for errors and activated. Screen looks as below,Screen looks as below, Input Box
  • 37. ©India SAP CoE, Slide 37 Testing ScreenTesting Screen • Screen can tested by executing F8 or click on buttonScreen can tested by executing F8 or click on button
  • 38. ©India SAP CoE, Slide 38 Testing ScreenTesting Screen
  • 39. ©India SAP CoE, Slide 39 Flow LogicFlow Logic • Default flow logic for any screen is generated as shown below,Default flow logic for any screen is generated as shown below,
  • 40. ©India SAP CoE, Slide 40 Menu PainterMenu Painter • In all programs GUI consists of a menu bar, a standard toolbar, anIn all programs GUI consists of a menu bar, a standard toolbar, an application toolbar and title bar.application toolbar and title bar. • A program’s GUI is created inA program’s GUI is created in Menu PainterMenu Painter.. • To Create a Menu for a screen, in flow logic uncomment MODULETo Create a Menu for a screen, in flow logic uncomment MODULE STATUS_0400. in PBO eventSTATUS_0400. in PBO event PROCESS BEFORE OUTPUT.PROCESS BEFORE OUTPUT. MODULE STATUS_0400.MODULE STATUS_0400. PROCESS AFTER INPUT.PROCESS AFTER INPUT. * MODULE USER_COMMAND_0400.* MODULE USER_COMMAND_0400.
  • 41. ©India SAP CoE, Slide 41 Menu PainterMenu Painter • Now double click onNow double click on STATUS_0400. A pop up window will appear. ClickSTATUS_0400. A pop up window will appear. Click on Yes.on Yes. • Module will be created as below,Module will be created as below, *&---------------------------------------------------------------------**&---------------------------------------------------------------------* *& Module STATUS_0400 OUTPUT*& Module STATUS_0400 OUTPUT *&---------------------------------------------------------------------**&---------------------------------------------------------------------* module STATUS_0400 output.module STATUS_0400 output. * SET PF-STATUS 'xxxxxxxx'.* SET PF-STATUS 'xxxxxxxx'. * SET TITLEBAR 'xxx'.* SET TITLEBAR 'xxx'. • endmodule. " STATUS_0400 OUTPUTendmodule. " STATUS_0400 OUTPUT
  • 42. ©India SAP CoE, Slide 42 Menu PainterMenu Painter • Uncomment the lineUncomment the line SET PF-STATUS 'xxxxxxxx'. aSET PF-STATUS 'xxxxxxxx'. and replacend replace 'xxxxxxxx‘ with name ‘STATUS_400’.'xxxxxxxx‘ with name ‘STATUS_400’. • Click on STATUS_400. Click Yes on the pop-up.Click on STATUS_400. Click Yes on the pop-up.
  • 43. ©India SAP CoE, Slide 43 Menu PainterMenu Painter • Enter description and choose the status type as Normal screen which isEnter description and choose the status type as Normal screen which is default.default.
  • 44. ©India SAP CoE, Slide 44 Menu PainterMenu Painter • Click on to expand the menu bar, application toolbar and functionClick on to expand the menu bar, application toolbar and function keys.keys. • System and Help are default in menu barSystem and Help are default in menu bar
  • 45. ©India SAP CoE, Slide 45 Creating Menu barCreating Menu bar • To create a user defined menu enter the name of the menu and doubleTo create a user defined menu enter the name of the menu and double click on it. We can define options for the menu here as below,click on it. We can define options for the menu here as below,
  • 46. ©India SAP CoE, Slide 46 Creating Application Tool barCreating Application Tool bar • Application tool bar can also be created in same way as menu bar.Application tool bar can also be created in same way as menu bar.
  • 47. ©India SAP CoE, Slide 47 Assigning function keysAssigning function keys • We can assign code to existing function keys. Only keys for which codeWe can assign code to existing function keys. Only keys for which code is assigned will be active. We can see this when the menu painter isis assigned will be active. We can see this when the menu painter is executed.executed.
  • 48. ©India SAP CoE, Slide 48 ExecutionExecution • We can test the menu painter by clicking on F8 key or execute buttonWe can test the menu painter by clicking on F8 key or execute button • Enter a screen number and title if you want to simulate a whole screen.Enter a screen number and title if you want to simulate a whole screen. If you do not enter a screen number, the system simulates the statusIf you do not enter a screen number, the system simulates the status using an empty test screen.using an empty test screen.
  • 49. ©India SAP CoE, Slide 49 ExecutionExecution • Output as below, New Menu is added, Find Item in Application tool bar,Output as below, New Menu is added, Find Item in Application tool bar, Save, Back & Print button on standard tool bar enabled.Save, Back & Print button on standard tool bar enabled.
  • 50. ©India SAP CoE, Slide 50 More on Flow LogicMore on Flow Logic • Flow logic refers to code behind the screens. It is the code that processesFlow logic refers to code behind the screens. It is the code that processes a screen.a screen. • Flow Logic commands are different than ABAP commandsFlow Logic commands are different than ABAP commands (e.g., IF … ENDIF is not valid in Flow Logic).(e.g., IF … ENDIF is not valid in Flow Logic). • Dynamic Processor (DYNPRO) controls the flow logic and preparesDynamic Processor (DYNPRO) controls the flow logic and prepares data to be displayed on the screen.data to be displayed on the screen.
  • 51. ©India SAP CoE, Slide 51 More on Flow LogicMore on Flow Logic • Each screen has its own Flow Logic which is divided into four main events:Each screen has its own Flow Logic which is divided into four main events: • PROCESS BEFORE OUTPUT (PBO)PROCESS BEFORE OUTPUT (PBO) - event processed before the- event processed before the screen is displayed.screen is displayed. • PROCESS AFTER INPUT (PAI) -PROCESS AFTER INPUT (PAI) - event processed after the user hasevent processed after the user has invoked a function code (e.g., clicked on a pushbutton) or pressed theinvoked a function code (e.g., clicked on a pushbutton) or pressed the ‘Enter’ key.‘Enter’ key. • Process on Value Request (POV) -Process on Value Request (POV) - Triggered when the user requestsTriggered when the user requests Value help (F4)Value help (F4) • Process on Value Request (POH) -Process on Value Request (POH) - Triggered when the user requestsTriggered when the user requests field help (F1)field help (F1) • Each screen must be generated. If you make a change to any component of aEach screen must be generated. If you make a change to any component of a screen, the screen must be re-generated before execution.screen, the screen must be re-generated before execution.
  • 52. ©India SAP CoE, Slide 52 Keywords supportedKeywords supported • Keywords supported by flow logic events are as below,Keywords supported by flow logic events are as below, KeywordKeyword FunctionFunction MODULEMODULE Calls a dialog module in an ABAP programCalls a dialog module in an ABAP program FIELDFIELD Specifies the point at which the contents of a screenSpecifies the point at which the contents of a screen field should be transportedfield should be transported ONON Used in conjunction with FIELDUsed in conjunction with FIELD VALUESVALUES Used in conjunction with FIELDUsed in conjunction with FIELD CHAINCHAIN Starts a processing chainStarts a processing chain ENDCHAINENDCHAIN Ends a processing chainEnds a processing chain CALLCALL Calls a sub screenCalls a sub screen LOOPLOOP Starts processing a screen tableStarts processing a screen table ENDLOOPENDLOOP Stops processing a screen tableStops processing a screen table
  • 53. ©India SAP CoE, Slide 53 PBO EventPBO Event • By default the module created in PBO event will be likeBy default the module created in PBO event will be like MODULE STATUS_<screen number>MODULE STATUS_<screen number> Ex:-MODULE STATUS_0100.Ex:-MODULE STATUS_0100. • This module will be processed before the screen is displayed.This module will be processed before the screen is displayed. • By default this module will be commented. To use this uncomment andBy default this module will be commented. To use this uncomment and double click on it to get the module created.double click on it to get the module created. *&---------------------------------------------------------------------**&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT*& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------**&---------------------------------------------------------------------* module STATUS_0100 output.module STATUS_0100 output. * SET PF-STATUS ‘XXX'.* SET PF-STATUS ‘XXX'. * SET TITLEBAR 'xxx'.* SET TITLEBAR 'xxx'. endmodule. " STATUS_0100 OUTPUTendmodule. " STATUS_0100 OUTPUT
  • 54. ©India SAP CoE, Slide 54 PBO EventPBO Event • Menu bar and title bar can be set in this module.Menu bar and title bar can be set in this module. Menu Bar-Menu Bar- • To set menu bar uncomment the SET PF_STATUS and give a name toTo set menu bar uncomment the SET PF_STATUS and give a name to status as ,status as , SET PF-STATUS 'STATUS100'.SET PF-STATUS 'STATUS100'. • Double click on STATUS100 and click yes to create GUI status.Double click on STATUS100 and click yes to create GUI status.
  • 55. ©India SAP CoE, Slide 55 PBO EventPBO Event Title BarTitle Bar • To assign a title uncomment SET TITLEBAR and give a name as,To assign a title uncomment SET TITLEBAR and give a name as, SET TITLEBAR 'TITLE100'.SET TITLEBAR 'TITLE100'. • Double click on TITLE100 and click yes to create GUI title. Enter titleDouble click on TITLE100 and click yes to create GUI title. Enter title as below and click on , save and activate.as below and click on , save and activate. • Once all the modules in the PBO block are processed, the system copiesOnce all the modules in the PBO block are processed, the system copies the content of the fields in the ABAP work area to their correspondingthe content of the fields in the ABAP work area to their corresponding fields in the screen work area.fields in the screen work area.
  • 56. ©India SAP CoE, Slide 56 PAI EventPAI Event • Default module in PAI event will beDefault module in PAI event will be MODULE USER_COMMAND_<screen number>.MODULE USER_COMMAND_<screen number>. Ex:-Ex:- MODULE USER_COMMAND_0100.MODULE USER_COMMAND_0100. • This event is triggered once the user invokes function code or pressesThis event is triggered once the user invokes function code or presses Enter key on the screen.Enter key on the screen. • System variableSystem variable SY-UCOMMSY-UCOMM will hold the function code assigned towill hold the function code assigned to the screen elements (push button, radio button, check box etc).the screen elements (push button, radio button, check box etc). • Within the above module code has to written to branch to group of codeWithin the above module code has to written to branch to group of code based on the function code from SY-UCOMM.based on the function code from SY-UCOMM. • The system copies the contents of the fields in the screen work area toThe system copies the contents of the fields in the screen work area to their corresponding fields in the ABAP work area once user clicks Entertheir corresponding fields in the ABAP work area once user clicks Enter key on screen or any function code is invoked.key on screen or any function code is invoked.
  • 57. ©India SAP CoE, Slide 57 PAI Event- Sample CodePAI Event- Sample Code *&---------------------------------------------------------------------**&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT*& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------**&---------------------------------------------------------------------* MODULE user_command_0100 INPUT.MODULE user_command_0100 INPUT. CASE sy-ucomm.CASE sy-ucomm. WHEN 'ENT'.WHEN 'ENT'. SELECT ebeln ebelp bukrsSELECT ebeln ebelp bukrs INTO CORRESPONDING FIELDS OF TABLE it_poINTO CORRESPONDING FIELDS OF TABLE it_po FROM ekpoFROM ekpo WHERE ebeln = po_no.WHERE ebeln = po_no. WHEN 'BCK'.WHEN 'BCK'. LEAVE TO SCREEN 0.LEAVE TO SCREEN 0. ENDCASE.ENDCASE. ENDMODULE. " USER_COMMAND_0100 INPUTENDMODULE. " USER_COMMAND_0100 INPUT
  • 58. ©India SAP CoE, Slide 58 IncludesIncludes • To have structured way of code it is best practice to have includes.To have structured way of code it is best practice to have includes. • There should be a TOP include which will have the data declarations.There should be a TOP include which will have the data declarations. • Include for PBO modules, include for PAI modules.Include for PBO modules, include for PAI modules. • Include for POV and POH modules if any.Include for POV and POH modules if any.
  • 59. ©India SAP CoE, Slide 59 IncludesIncludes • To create include right click on object name, select Include from theTo create include right click on object name, select Include from the Create menu.Create menu.
  • 60. ©India SAP CoE, Slide 60 IncludesIncludes • We can gave the include names as Z<Program>_TOP,We can gave the include names as Z<Program>_TOP, Z<Program>_PBO, Z<Program>_PAI. This will help to understandZ<Program>_PBO, Z<Program>_PAI. This will help to understand which modules are covered in each include.which modules are covered in each include. • Each include program will insert a include statement in the mainEach include program will insert a include statement in the main program.program.
  • 61. ©India SAP CoE, Slide 61 Message StatementMessage Statement • The “MESSAGE” statement is used to issue user messages.The “MESSAGE” statement is used to issue user messages. • Syntax isSyntax is MESSAGE <tnnn> [WITH <var1> <var2> <var3> <var4>].MESSAGE <tnnn> [WITH <var1> <var2> <var3> <var4>]. t – Message typet – Message type nnn –Message Numbernnn –Message Number WITH – This is optional. It is needed if variables are used in a message.WITH – This is optional. It is needed if variables are used in a message. A message can contain up to four variables, indicated with anA message can contain up to four variables, indicated with an ampersand (&) in the message text.ampersand (&) in the message text. • We can code the Message statement in the PAI event.We can code the Message statement in the PAI event.
  • 62. ©India SAP CoE, Slide 62 Message TypesMessage Types • S: success • I: information • A: abend • X: exit • W: warning • E: error X The message type determines where the message is displayed and what action the user can or must take on the current screen. I
  • 63. ©India SAP CoE, Slide 63 MessagesMessages • SuccessSuccess message is displayed at the bottom of the screen.message is displayed at the bottom of the screen. • If you have next screen then the message will be displayed at the bottomIf you have next screen then the message will be displayed at the bottom of the next screen.of the next screen. • InformationInformation message is displayed in a dialog box in same screen.message is displayed in a dialog box in same screen. • After pressing Enter key on dialog box user will be taken to next screen.After pressing Enter key on dialog box user will be taken to next screen. The user is not restricted from going on to the next screen.The user is not restricted from going on to the next screen.
  • 64. ©India SAP CoE, Slide 64 MessagesMessages • AbendAbend message is displayed on the current screen in a dialog box.message is displayed on the current screen in a dialog box. • The user cannot make any changes to the values on the current screen.The user cannot make any changes to the values on the current screen. • After pressing the ‘Enter’ key on the dialog box, transaction will beAfter pressing the ‘Enter’ key on the dialog box, transaction will be terminated.terminated. • ExitExit message is identical to the ABEND message except that themessage is identical to the ABEND message except that the transaction is terminated with a short dump instead of the message in atransaction is terminated with a short dump instead of the message in a dialog box.dialog box. • WARNINGWARNING message is displayed at the bottom of the current screen.message is displayed at the bottom of the current screen. • On pressing the ‘Enter’ key on the current screen, the user will be taken toOn pressing the ‘Enter’ key on the current screen, the user will be taken to the next screen even if no changes were made on the current screen . Thusthe next screen even if no changes were made on the current screen . Thus user is not restricted from going on to the next screen.user is not restricted from going on to the next screen.
  • 65. ©India SAP CoE, Slide 65 MessagesMessages • ERRORERROR message is displayed at the bottom of the current screen.message is displayed at the bottom of the current screen. • The user must make changes to the values on the current screen.The user must make changes to the values on the current screen. • On pressing the ‘Enter’ key on the current screen, the user will be takenOn pressing the ‘Enter’ key on the current screen, the user will be taken to the next screen only if the appropriate corrections were made on theto the next screen only if the appropriate corrections were made on the current screen.current screen. • If no corrections were made, the error message would be redisplayed atIf no corrections were made, the error message would be redisplayed at the bottom of the current screen.the bottom of the current screen. • When a warning or error message is triggered the system will stop atWhen a warning or error message is triggered the system will stop at current screen, prompting the user to make corrections. However thecurrent screen, prompting the user to make corrections. However the input fields on the screen will be disabled for input.input fields on the screen will be disabled for input.
  • 66. ©India SAP CoE, Slide 66 Handling Error messagesHandling Error messages • There are 2 ways to issue error/warning messages.There are 2 ways to issue error/warning messages. – Issue an error or warning message with the Flow Logic SELECTIssue an error or warning message with the Flow Logic SELECT statement.statement. – Define valid values for a screen field with the Flow Logic VALUESDefine valid values for a screen field with the Flow Logic VALUES statement.statement. • FIELDFIELD statement is a Flow Logic command, not an ABAP command.statement is a Flow Logic command, not an ABAP command. • The purpose of the “FIELD” statement is to keep a single screen field openThe purpose of the “FIELD” statement is to keep a single screen field open for input after an error or warning message is issued.for input after an error or warning message is issued. • FIELD statement is used in PAI event.FIELD statement is used in PAI event. • Syntax is:Syntax is: FIELDFIELD <screen field><screen field> MODULEMODULE <module name>.<module name>.
  • 67. ©India SAP CoE, Slide 67 FIELD with select statementFIELD with select statement • Screen field can be validated against entry in database table.Screen field can be validated against entry in database table. • To validate Purchase order number in PAI module,To validate Purchase order number in PAI module, PROCESS AFTER INPUT.PROCESS AFTER INPUT. field PO_NO module PO_CHECK.field PO_NO module PO_CHECK. MODULE USER_COMMAND_0100.MODULE USER_COMMAND_0100. Module PO_CHECK is as below,Module PO_CHECK is as below, module paycheck input.module paycheck input. data: lv_ebeln type ekko-ebeln.data: lv_ebeln type ekko-ebeln. select single ebeln into lv_ebelnselect single ebeln into lv_ebeln from ekko where ebeln = PO_NO.from ekko where ebeln = PO_NO. if sy-subrc ne 0.if sy-subrc ne 0. message e003(Z6).message e003(Z6). endif.endif. endmodule. " po_check INPUTendmodule. " po_check INPUT
  • 68. ©India SAP CoE, Slide 68 Error for invalid inputError for invalid input • Error for Purchase order when invalid number is entered.Error for Purchase order when invalid number is entered.
  • 69. ©India SAP CoE, Slide 69 FIELD with Values CheckFIELD with Values Check • The Flow Logic VALUES statement defines a set of valid values for the screen field specified in the FIELD statement. • If the value entered in this field is not in the valid set, an error message will be issued by the system. PROCESS AFTER INPUT. field PO_NO values ('1', '100'). • This indicates PO_NO can take input as either 1 or 100. For any other value system will through error and the field will be open for input. • With VALUES parameter for field, we can get a list of possible values by clicking on the drop-down arrow of the screen fields or pressing the ‘F4’ key. It will list the values mentioned.
  • 70. ©India SAP CoE, Slide 70 Values optionValues option • PO_NO with values 1 and 100.PO_NO with values 1 and 100.
  • 71. ©India SAP CoE, Slide 71 CHAIN StatementCHAIN Statement • To keep multiple screen fields open for input after an error or warningTo keep multiple screen fields open for input after an error or warning message is displayed, you need to use the “CHAIN” and “ENDCHAIN”message is displayed, you need to use the “CHAIN” and “ENDCHAIN” Flow Logic commands.Flow Logic commands. • These statements group the “FIELD” statements and the “MODULE”These statements group the “FIELD” statements and the “MODULE” statements together.statements together. • The basic syntax of these statements is:The basic syntax of these statements is: CHAIN.CHAIN. FIELD: <f1>, <f 2>,...FIELD: <f1>, <f 2>,... MODULE <mod1>.MODULE <mod1>. FIELD: <g1>, <g 2>,...FIELD: <g1>, <g 2>,... MODULE <mod2>.MODULE <mod2>. ...... ENDCHAIN.ENDCHAIN. • If an error or warning message is issued in <module name>, all theIf an error or warning message is issued in <module name>, all the screen fields listed in the “FIELD” statements will be open for input.screen fields listed in the “FIELD” statements will be open for input.
  • 72. ©India SAP CoE, Slide 72 Cursor PositionCursor Position • By default, the cursor will be positioned in the first fieldBy default, the cursor will be positioned in the first field open for input on a screen.open for input on a screen. • Cursor position can be changed in two ways –Cursor position can be changed in two ways – 1. By setting the cursor position in PBO event-1. By setting the cursor position in PBO event- Syntax -Syntax - SET CURSOR FIELD <field name>SET CURSOR FIELD <field name> Cursor will be placed on the screen field mentioned.Cursor will be placed on the screen field mentioned. 2. Cursor position in screen attributes-2. Cursor position in screen attributes- Mention the field name where cursor to be placed onMention the field name where cursor to be placed on screenscreen in cursor position attribute .in cursor position attribute .
  • 73. ©India SAP CoE, Slide 73 Screen commandsScreen commands • TheThe LEAVE SCREENLEAVE SCREEN statement ends the current screen andstatement ends the current screen and calls the subsequent screen.calls the subsequent screen. • When the system encounters theWhen the system encounters the “SET SCREEN <screen“SET SCREEN <screen #>”#>” ABAP statement, itABAP statement, it temporarilytemporarily overrides the “Nextoverrides the “Next Screen” attribute with this <screen #> and the PAIScreen” attribute with this <screen #> and the PAI processing continues. After all PAI modules are executed,processing continues. After all PAI modules are executed, the system goes to the PBO event ofthe system goes to the PBO event of <screen #>.<screen #>.
  • 74. ©India SAP CoE, Slide 74 Screen commandsScreen commands • ““LEAVE TO SCREEN <screen #>”LEAVE TO SCREEN <screen #>” ABAP statement,ABAP statement, terminates the screen’s PAI event and immediately goes toterminates the screen’s PAI event and immediately goes to the PBO of <screen #>.the PBO of <screen #>. • The “LEAVE TO SCREEN <screen #> statement performsThe “LEAVE TO SCREEN <screen #> statement performs the functionality of two statements: “SET SCREEN <screenthe functionality of two statements: “SET SCREEN <screen #>“ and “LEAVE SCREEN”.#>“ and “LEAVE SCREEN”. • ““CALL SCREEN <screen #>”CALL SCREEN <screen #>” ABAP statement,ABAP statement, temporarily suspends the current screen’s PAI processingtemporarily suspends the current screen’s PAI processing and immediately goes to the PBO event of <screen #>.and immediately goes to the PBO event of <screen #>. When control returns back to the “calling” screen, its PAIWhen control returns back to the “calling” screen, its PAI processing will resume.processing will resume.
  • 75. ©India SAP CoE, Slide 75 More on PAI modulesMore on PAI modules All modules listed in the PAI event get executed from top toAll modules listed in the PAI event get executed from top to bottom.bottom. • We can control the execution of the modules using additionsWe can control the execution of the modules using additions to MODULE.to MODULE. • Additions are,Additions are,  ON INPUTON INPUT  ON REQUESTON REQUEST  AT EXIT-COMMANDAT EXIT-COMMAND  AT CURSOR-SELECTIONAT CURSOR-SELECTION
  • 76. ©India SAP CoE, Slide 76 ON INPUTON INPUT • With the “ON INPUT” addition to the “MODULE” statement, a module willWith the “ON INPUT” addition to the “MODULE” statement, a module will be executed only if the specified field’s value is not equal to the initial valuebe executed only if the specified field’s value is not equal to the initial value appropriate to its data typeappropriate to its data type • Ex- blanks for character fields and zeroes for numeric fields.Ex- blanks for character fields and zeroes for numeric fields. • The basic syntax for this conditional execution Flow Logic command is:The basic syntax for this conditional execution Flow Logic command is: – FIELD <screen field> MODULE <module> ON INPUT.FIELD <screen field> MODULE <module> ON INPUT. – The PAI <module> will be executed only if the value in <screen field> isThe PAI <module> will be executed only if the value in <screen field> is not equal to its initial value.not equal to its initial value. – The “ON INPUT” addition must be used with a “FIELD” statementThe “ON INPUT” addition must be used with a “FIELD” statement because this condition depends on the value of a particular field.because this condition depends on the value of a particular field.
  • 77. ©India SAP CoE, Slide 77 ON REQUESTON REQUEST • With the “ON REQUEST”, a module will be executed only if a value hasWith the “ON REQUEST”, a module will be executed only if a value has been entered in the specified field since the screen was displayed.been entered in the specified field since the screen was displayed. • The basic syntax for this conditional execution Flow Logic command is:The basic syntax for this conditional execution Flow Logic command is: FIELD <screen field> MODULE <module> ON REQUEST.FIELD <screen field> MODULE <module> ON REQUEST. – The PAI <module> will be executed only if a value was entered inThe PAI <module> will be executed only if a value was entered in <screen field> since the screen was displayed.<screen field> since the screen was displayed. – The “ON REQUEST” addition must be used with a “FIELD” statementThe “ON REQUEST” addition must be used with a “FIELD” statement because this condition depends on the value of a particular field.because this condition depends on the value of a particular field. • If you want to conditionally execute a module that is coded within aIf you want to conditionally execute a module that is coded within a “CHAIN … ENDCHAIN”, you must use ““CHAIN … ENDCHAIN”, you must use “ON CHAIN-REQUEST”.ON CHAIN-REQUEST”.
  • 78. ©India SAP CoE, Slide 78 AT EXIT-COMMANDAT EXIT-COMMAND • With the “AT EXIT-COMMAND” addition to theWith the “AT EXIT-COMMAND” addition to the “MODULE” statement, a module will be executed only if“MODULE” statement, a module will be executed only if the user invokes a function code with the ‘E’ function type.the user invokes a function code with the ‘E’ function type. • Function type assigning is explained in slide 73.Function type assigning is explained in slide 73. • The basic syntax for this conditional execution Flow LogicThe basic syntax for this conditional execution Flow Logic command is:command is: MODULE <module> AT EXIT-COMMAND.MODULE <module> AT EXIT-COMMAND.
  • 79. ©India SAP CoE, Slide 79 AT EXIT-COMMANDAT EXIT-COMMAND – The PAI <module> will be executed only if the user invokes aThe PAI <module> will be executed only if the user invokes a FUNCTION type ‘E’.FUNCTION type ‘E’. – The “AT EXIT-COMMAND” addition cannot be used with aThe “AT EXIT-COMMAND” addition cannot be used with a “FIELD” statement.“FIELD” statement. • If the user invokes a type ‘E’ function code, a module with the “ATIf the user invokes a type ‘E’ function code, a module with the “AT EXIT-COMMAND” addition will be executed immediately.EXIT-COMMAND” addition will be executed immediately. • It will be executed even before the automatic field checks.It will be executed even before the automatic field checks.
  • 80. ©India SAP CoE, Slide 80 Assigning Function typeAssigning Function type • Function type can beFunction type can be assigned for screenassigned for screen buttons and for menubuttons and for menu painter keys.painter keys. • In menu painter, clickIn menu painter, click on the required key.on the required key. In the pop-up windowIn the pop-up window select function type asselect function type as ‘E’ from drop down.‘E’ from drop down.
  • 81. ©India SAP CoE, Slide 81 AT CURSOR-SELECTIONAT CURSOR-SELECTION • You can specify that a module should only be called if the cursor isYou can specify that a module should only be called if the cursor is positioned on a particular screen element.positioned on a particular screen element. • Syntax -Syntax - MODULE <mod> AT CURSOR-SELECTIONMODULE <mod> AT CURSOR-SELECTION.. • The module <mod> is called whenever the function code of the userThe module <mod> is called whenever the function code of the user action is CS with function type S.action is CS with function type S. • The module is called in the sequence in which it occurs in the flow logic.The module is called in the sequence in which it occurs in the flow logic. • It does not bypass the automatic input checks.It does not bypass the automatic input checks.
  • 82. ©India SAP CoE, Slide 82 AT CURSOR-SELECTIONAT CURSOR-SELECTION • You can also combine this MODULE statement with the FIELDYou can also combine this MODULE statement with the FIELD statement:statement: FIELD <f> MODULE <mod> AT CURSOR-SELECTION.FIELD <f> MODULE <mod> AT CURSOR-SELECTION. • For more than one field:For more than one field: CHAIN.CHAIN. FIELD: <f1>, <f 2>,...FIELD: <f1>, <f 2>,... MODULE <mod> AT CURSOR-SELECTION.MODULE <mod> AT CURSOR-SELECTION. ENDCHAIN.ENDCHAIN.
  • 83. ©India SAP CoE, Slide 83 Modifying Screen FieldsModifying Screen Fields • All fields of the current screen are stored in the system tableAll fields of the current screen are stored in the system table SCREENSCREEN with their attributes.with their attributes. • TheThe LOOP AT SCREENLOOP AT SCREEN statement places this information in thestatement places this information in the header line of the system table.header line of the system table. • We can modify the attributes of the fields and update the screen tableWe can modify the attributes of the fields and update the screen table usingusing MODIFY SCREENMODIFY SCREEN.. • Sample code:Sample code: loop at screen.loop at screen. if screen-name = 'GV_MATNR'.if screen-name = 'GV_MATNR'. screen-input = 1.screen-input = 1. modify screen.modify screen. endif.endif. endloop.endloop.
  • 84. ©India SAP CoE, Slide 84 Modifying Screen FieldsModifying Screen Fields • You can dynamically modify the following attributes of a field:You can dynamically modify the following attributes of a field: – ACTIVEACTIVE – REQUIREDREQUIRED – INPUTINPUT – OUTPUTOUTPUT – INTENSIFIEDINTENSIFIED – INVISIBLEINVISIBLE – LENGTHLENGTH – DISPLAY 3DDISPLAY 3D – VALUE HELPVALUE HELP • A field attribute is turned “on” with a value of 1. It is turned “off” withA field attribute is turned “on” with a value of 1. It is turned “off” with a value of 0.a value of 0. • The statements LOOP AT SCREEN ... ENDLOOP define a loop aroundThe statements LOOP AT SCREEN ... ENDLOOP define a loop around a statement block.a statement block.
  • 85. ©India SAP CoE, Slide 85 Logical Unit of Work (LUW)Logical Unit of Work (LUW) • LUW refers to a collection of actions performed at the database level as aLUW refers to a collection of actions performed at the database level as a complete unit.complete unit. In this ex: LUW is selecting A and B from the database, updating A, andIn this ex: LUW is selecting A and B from the database, updating A, and deleting B.deleting B. This would be the desired LUW because we would want to rollback allThis would be the desired LUW because we would want to rollback all changes if any of these actions failed.changes if any of these actions failed. Screen 2 Screen 1 Screen 3 SELECT A SELECT B UPDATE A DELETE B Database Transaction Database Transaction Database Transaction
  • 86. ©India SAP CoE, Slide 86 LUWLUW • Changes will be saved (commit work) in database at the end of thirdChanges will be saved (commit work) in database at the end of third screen.screen. • An SAP LUW will end with either the COMMIT WORK orAn SAP LUW will end with either the COMMIT WORK or ROLLBACK WORK statement.ROLLBACK WORK statement. • A logical unit consisting of dialog steps, whose changes are written toA logical unit consisting of dialog steps, whose changes are written to the database in a single database LUW is called an SAP LUW.the database in a single database LUW is called an SAP LUW. • If an SAP LUW contains database changes, you should either write allIf an SAP LUW contains database changes, you should either write all of them or none at all to the database.of them or none at all to the database. • Include a database commit when the transaction has ended successfully,Include a database commit when the transaction has ended successfully, and a database rollback in case the program detects an error.and a database rollback in case the program detects an error.
  • 87. ©India SAP CoE, Slide 87 LUWLUW • Since database changes from a database LUW cannot be reversed in aSince database changes from a database LUW cannot be reversed in a subsequent database LUW, you must make all of the database changes forsubsequent database LUW, you must make all of the database changes for the SAP LUW in a single database LUW.the SAP LUW in a single database LUW. • In our example, we need to perform UPDATE A and DELETE B at theIn our example, we need to perform UPDATE A and DELETE B at the end of third screen.end of third screen.
  • 88. ©India SAP CoE, Slide 88 SAP LocksSAP Locks • R/3 system contain lock mechanism for SAP LUWs called SAP Locks.R/3 system contain lock mechanism for SAP LUWs called SAP Locks. • Lock object is created in ABAP Dictionary.Lock object is created in ABAP Dictionary. • A lock object definition contains the database tables and their key fieldsA lock object definition contains the database tables and their key fields on the basis of which you want to set a lock.on the basis of which you want to set a lock. • System automatically generates two function modules with the namesSystem automatically generates two function modules with the names ENQUEUE_<lock object name> and DEQUEUE_<lock object name>ENQUEUE_<lock object name> and DEQUEUE_<lock object name> when a lock is generated.when a lock is generated. • Locks can be set and released on corresponding database table by callingLocks can be set and released on corresponding database table by calling these function modules in program.these function modules in program.
  • 89. ©India SAP CoE, Slide 89 SAP LocksSAP Locks • Consider below example,Consider below example, • When user clicks on change, the program locks the relevant databaseWhen user clicks on change, the program locks the relevant database object by calling the corresponding ENQUEUE function.object by calling the corresponding ENQUEUE function. • You can release the lock by calling DEQUEUE function when user clicksYou can release the lock by calling DEQUEUE function when user clicks on SAVE or when user clicks on BACK button.on SAVE or when user clicks on BACK button.
  • 90. ©India SAP CoE, Slide 90 Table ControlTable Control • A table control is an area on the screen where the system displays data in aA table control is an area on the screen where the system displays data in a tabular form. It is processed using a loop.tabular form. It is processed using a loop. • To create a table control, drag & drop table control from screen elementsTo create a table control, drag & drop table control from screen elements on screen painter. Give a name to table control.on screen painter. Give a name to table control. • Select the table definition and fields clicking on Dictionary/ProgramSelect the table definition and fields clicking on Dictionary/Program fields object button.fields object button. • Each table control need to be declared in declaration part of the programEach table control need to be declared in declaration part of the program as,as, CONTROLS <ctrl> TYPE TABLEVIEW USING SCREEN <scr>.CONTROLS <ctrl> TYPE TABLEVIEW USING SCREEN <scr>. where <ctrl> is the name of the table control on a screen.where <ctrl> is the name of the table control on a screen.
  • 91. ©India SAP CoE, Slide 91 Table ControlTable Control • YouYou mustmust code a LOOP statement in both the PBO and PAI events for eachcode a LOOP statement in both the PBO and PAI events for each table in your screen.table in your screen. • This is because the LOOP statement causes the screen fields to be copiedThis is because the LOOP statement causes the screen fields to be copied back and forth between the ABAP program and the screen field.back and forth between the ABAP program and the screen field. • For this reason, at least an empty LOOP...ENDLOOP must be there.For this reason, at least an empty LOOP...ENDLOOP must be there.
  • 92. ©India SAP CoE, Slide 92 Processing Table ControlProcessing Table Control Database Internal Table with header Internal Table with header Screen
  • 93. ©India SAP CoE, Slide 93 Table ControlTable Control Sample code -Sample code - PROCESS BEFORE OUTPUT.PROCESS BEFORE OUTPUT. MODULE STATUS_0100.MODULE STATUS_0100. LOOP AT it_po INTO wa_ekpo WITH CONTROL tab2 CURSORLOOP AT it_po INTO wa_ekpo WITH CONTROL tab2 CURSOR tab2-current_line.tab2-current_line. ENDLOOP.ENDLOOP. PROCESS AFTER INPUT.PROCESS AFTER INPUT. field po_no module po_check.field po_no module po_check. module exit_mod at exit-command.module exit_mod at exit-command. MODULE USER_COMMAND_0100.MODULE USER_COMMAND_0100. loop at it_po.loop at it_po. endloop.endloop.
  • 94. ©India SAP CoE, Slide 94 SubscreenSubscreen • A subscreen is a screen that is displayed in a specified area of the mainA subscreen is a screen that is displayed in a specified area of the main screen.screen. • A subscreen cannot be displayed by itself.A subscreen cannot be displayed by itself. • The subscreen displayed in the predefined area will depend on the user’sThe subscreen displayed in the predefined area will depend on the user’s request on the main screen.request on the main screen. • Subscreen is used to vary the fields displayed on a screen. As anSubscreen is used to vary the fields displayed on a screen. As an example:example: – The “main” screen contains the customer number, name, and aThe “main” screen contains the customer number, name, and a predefined area for a subscreen.predefined area for a subscreen. – One subscreen contains customer address information.One subscreen contains customer address information. – Another subscreen contains customer bank information.Another subscreen contains customer bank information.
  • 95. ©India SAP CoE, Slide 95 Creating SubscreenCreating Subscreen • In main screen,In main screen, – In the screen layout, place the screen element ‘subscreen’ on layout.In the screen layout, place the screen element ‘subscreen’ on layout. – You can set the length and width of the subscreen by double clickingYou can set the length and width of the subscreen by double clicking on subscreen.on subscreen. – Provide unique name to subscreen, save and activate it.Provide unique name to subscreen, save and activate it. Subscreen
  • 96. ©India SAP CoE, Slide 96 Creating SubscreenCreating Subscreen • Create a subscreenCreate a subscreen – Create a screen as given in earlier slides.Create a screen as given in earlier slides. – Screen type should be subscreen.Screen type should be subscreen. – Specify the screen length and height as in main screen.Specify the screen length and height as in main screen. – Save the subscreen and go to screen layout. Here subscreen are willSave the subscreen and go to screen layout. Here subscreen are will be displayed.be displayed.
  • 97. ©India SAP CoE, Slide 97 Creating SubscreenCreating Subscreen • User can design in the subscreen area as below,User can design in the subscreen area as below,
  • 98. ©India SAP CoE, Slide 98 Call subscreen in PBOCall subscreen in PBO • To include a subscreen in a predefined area on the “main” screen, use theTo include a subscreen in a predefined area on the “main” screen, use the “CALL SUBSCREEN” statement in the “main” screen’s PBO event.“CALL SUBSCREEN” statement in the “main” screen’s PBO event. • syntax :syntax :CALL SUBSCREEN <area> INCLUDING <program> <subscreenCALL SUBSCREEN <area> INCLUDING <program> <subscreen #>.#>. – <area> : name of the subscreen area defined on the “main” screen. This<area> : name of the subscreen area defined on the “main” screen. This subscreen area will be the location of the subscreen. This <area>subscreen area will be the location of the subscreen. This <area> cannotcannot be enclosed in single quotes.be enclosed in single quotes. – <program> : name of the program where the subscreen exists<program> : name of the program where the subscreen exists..
  • 99. ©India SAP CoE, Slide 99 Call subscreen in PBOCall subscreen in PBO – <subscreen #> : number of the subscreen to display in the subscreen<subscreen #> : number of the subscreen to display in the subscreen area.area. – The <program> and <subscreen #> can be literals (i.e. enclosed inThe <program> and <subscreen #> can be literals (i.e. enclosed in single quotes) or variables.single quotes) or variables. • When the “CALL SUBSCREEN” statement is encountered in theWhen the “CALL SUBSCREEN” statement is encountered in the “main” screen’s PBO event, the system executes the PBO event of the“main” screen’s PBO event, the system executes the PBO event of the subscreen. Then, the system returns to finish the PBO event of thesubscreen. Then, the system returns to finish the PBO event of the “main” screen“main” screen..
  • 100. ©India SAP CoE, Slide 100 Call subscreen in PAICall subscreen in PAI • If the subscreen contains any PAI code, use the “CALL SUBSCREEN”If the subscreen contains any PAI code, use the “CALL SUBSCREEN” statement in the PAI event of the “main” screen.statement in the PAI event of the “main” screen. • Syntax :Syntax : CALL SUBSCREEN <area>.CALL SUBSCREEN <area>. – The <area> is the name of the subscreen area defined on the “main”The <area> is the name of the subscreen area defined on the “main” screen. This <area>screen. This <area> cannotcannot be enclosed in single quotes.be enclosed in single quotes. • The “CALL SUBSCREEN” statement must be used to invoke the PAIThe “CALL SUBSCREEN” statement must be used to invoke the PAI event of the subscreen.event of the subscreen. - When the “CALL SUBSCREEN” statement is- When the “CALL SUBSCREEN” statement is encountered in the “main” screen’s PAI event, theencountered in the “main” screen’s PAI event, the systemsystem executes the PAI event of the subscreen.executes the PAI event of the subscreen.
  • 101. ©India SAP CoE, Slide 101 Call subscreen in PAICall subscreen in PAI – Then, the system returns to finish the PAI event of the “main”Then, the system returns to finish the PAI event of the “main” screen.screen. – Without this “CALL SUBSCREEN” statement in the PAI event ofWithout this “CALL SUBSCREEN” statement in the PAI event of the “main” screen, the PAI event of the subscreen cannot bethe “main” screen, the PAI event of the subscreen cannot be processed by the system.processed by the system. • If the subscreen does not contain any PAI code, this “CALLIf the subscreen does not contain any PAI code, this “CALL SUBSCREEN” statement isSUBSCREEN” statement is notnot needed in the PAI event of the “main”needed in the PAI event of the “main” screen.screen. • In both the PBO and PAI of the “main” screen, the “CALLIn both the PBO and PAI of the “main” screen, the “CALL SUBSCREEN” statement cannot be used inside a “LOOP” or aSUBSCREEN” statement cannot be used inside a “LOOP” or a “CHAIN”.“CHAIN”.
  • 102. ©India SAP CoE, Slide 102 Subscreen RestrictionsSubscreen Restrictions • The following ABAP/4 statementsThe following ABAP/4 statements cannotcannot be used in a subscreen’s PBObe used in a subscreen’s PBO or PAI modules (instead, they must be used in the “main” screen):or PAI modules (instead, they must be used in the “main” screen): – SET PF-STATUSSET PF-STATUS – SET TITLEBARSET TITLEBAR – SET SCREENSET SCREEN – LEAVE TO SCREENLEAVE TO SCREEN – CALL SCREENCALL SCREEN – Note: These ABAP/4 statements in a subscreen will pass a syntaxNote: These ABAP/4 statements in a subscreen will pass a syntax check; however, they will result in runtime errors.check; however, they will result in runtime errors.
  • 103. ©India SAP CoE, Slide 103 Tab Strip ControlsTab Strip Controls • Each tab page consists of a tab title and a page area.Each tab page consists of a tab title and a page area. • If the area occupied by the tab strip control is too narrow to display all ofIf the area occupied by the tab strip control is too narrow to display all of the tab titles, a scrollbar appears, allowing you to reach the titles that are notthe tab titles, a scrollbar appears, allowing you to reach the titles that are not displayed.displayed. • Tab strips allow users to access multiple sub screens on one normal screen.Tab strips allow users to access multiple sub screens on one normal screen. • This allows for a more intuitive user interface by logically separating theThis allows for a more intuitive user interface by logically separating the information presented to the user into different headings.information presented to the user into different headings. • The user can sort through the information by clicking on a correspondingThe user can sort through the information by clicking on a corresponding tabtab A tab strip control is a screen objectA tab strip control is a screen object consisting of two or more pages.consisting of two or more pages.
  • 104. ©India SAP CoE, Slide 104 Tab Strip Control componentsTab Strip Control components TabTtitle Tab Page Tab Title Row Scrolling
  • 105. ©India SAP CoE, Slide 105 • Tab TitleTab Title – Title of the component to which user can– Title of the component to which user can navigate. They are push buttons.navigate. They are push buttons. • Tab title rowTab title row - All tab titles will appear in a row.- All tab titles will appear in a row. • Tab PageTab Page - A tab page contains a collection of fields that logically- A tab page contains a collection of fields that logically belong together. Tab pages are implemented using subscreens.belong together. Tab pages are implemented using subscreens. • For designing and using tab strip controls, see TransactionFor designing and using tab strip controls, see Transaction BIBSBIBS .. Tab Strip Control componentsTab Strip Control components
  • 106. ©India SAP CoE, Slide 106 Tab Strip ControlsTab Strip Controls •Tab strip controls allow you to place a series of screens belonging to an application on a single screen, and to navigate between them easily. •From a technical point of view, a tab page is a sunscreen with a pushbutton assigned to it, which is displayed as the tab title. When you create a tab strip control, you must: ………. 1. Define the tab area on a screen and the tab titles. 2. Assign a subscreen area to each tab title. 3. Program the screen flow logic. 4. Program the ABAP processing logic.
  • 107. ©India SAP CoE, Slide 107 Assigning a Subscreen Area to a Tab Title 1. Paging in the SAPgui PROCESS BEFORE OUTPUT. ... CALL SUBSCREEN: area1 INCLUDING [prog1] dynp1, area2 INCLUDING [prog2] dynp2, area3 INCLUDING [prog3] dynp3, ... PROCESS AFTER INPUT. ... CALL SUBSCREEN: area1, area2, area3, … 2. Paging on the application server PROCESS BEFORE OUTPUT. ... CALL SUBSCREEN area INCLUDING [prog] dynp. ... PROCESS AFTER INPUT. ... CALL SUBSCREEN area. Tab Strip ControlsTab Strip Controls
  • 108. ©India SAP CoE, Slide 108 Handling in the ABAP Program Create a control for each control in the declaration part of your program using the following statement: CONTROLS ctrl TYPE TABSTRIP. PROCESS BEFORE OUTPUT. ... Assign the function code of the corresponding tab title to the component Activetab: ctrl-Activetab = fcode. PROCESS AFTER INPUT … Activetab contains the function code of the last active tab title on the screen. Tab Strip ControlsTab Strip Controls
  • 109. ©India SAP CoE, Slide 109 Programming the Flow Logic The flow logic is restricted to that necessary to include the appropriate subscreen screens in the right subscreen areas. Local Scrolling at the Front-end Include subscreen screens in all of your subscreen areas in the tab strip control. PROCESS BEFORE OUTPUT. CALL SUBSCREEN: <subscreen_area1> INCLUDING [<progname 1>] <subscreen_scrn 1>, <subscreen_area2> INCLUDING [<progname 2>] <subscreen_scrn 2>, <subscreen_area3> INCLUDING [<progname 3>] <subscreen_scrn 3>, PROCESS AFTER INPUT CALL SUBSCREEN: <subscreen_area1>, <subscreen_area2>, <subscreen_area3>, Tab Strip ControlsTab Strip Controls
  • 110. ©India SAP CoE, Slide 110 Programming the Flow Logic The flow logic is restricted to that necessary to include the appropriate subscreen screens in the right subscreen areas. Scrolling at the Application Server Include one subscreen at a time in a single subscreen area. PROCESS BEFORE OUTPUT. CALL SUBSCREEN < subscreen_area> INCLUDING [<progname>] <subscreen_scrn>. PROCESS AFTER INPUT CALL SUBSCREEN < subscreen_area>. Tab Strip ControlsTab Strip Controls
  • 111. ©India SAP CoE, Slide 111 Step loopsStep loops • Step loops are considerable less flexible than table controls.Step loops are considerable less flexible than table controls. • Used to group screen elements together. A step loop is a repeated seriesUsed to group screen elements together. A step loop is a repeated series of loop blocks. A loop block consists of one or more loop lines ofof loop blocks. A loop block consists of one or more loop lines of graphical screen elements.graphical screen elements. • Loop blocs can be defined as fixed or variable.Loop blocs can be defined as fixed or variable. – In a fixed loop, the lower limit of the loop area always remains asIn a fixed loop, the lower limit of the loop area always remains as originally defined.originally defined. – For a variable loop, the number of repetitions is adjustedFor a variable loop, the number of repetitions is adjusted dynamically in the screen program to suit the size of the currentdynamically in the screen program to suit the size of the current window.window.
  • 112. ©India SAP CoE, Slide 112 Creating a Step loopCreating a Step loop • Open a screen in the layout editor.Open a screen in the layout editor. • In one or more lines, create the elements you want to repeat.In one or more lines, create the elements you want to repeat. • Select all the elements on the desired line(s) as a group.Select all the elements on the desired line(s) as a group. • Choose EditChoose Edit GroupingGrouping  Step loopStep loop Define.Define. • Your element lines now make up a single step loop block. The blockYour element lines now make up a single step loop block. The block includes the original elements with their attributes and a predefined numberincludes the original elements with their attributes and a predefined number of repetition blocks.of repetition blocks. • Each repetition contains a copy of the first block without attributes.Each repetition contains a copy of the first block without attributes. • The repetition blocks are consecutively numbered, so that you can establishThe repetition blocks are consecutively numbered, so that you can establish a reference to a particular line.a reference to a particular line.
  • 113. ©India SAP CoE, Slide 113 Step loopsStep loops • To use a Step-Loop block in an online program, you must create one workTo use a Step-Loop block in an online program, you must create one work area for the Step-Loop block. To hold all the lines of a Step-Loop block inarea for the Step-Loop block. To hold all the lines of a Step-Loop block in the program’s memory area, use an internal table.the program’s memory area, use an internal table. Ex:-TYPES: BEGIN OF TY_REC,Ex:-TYPES: BEGIN OF TY_REC, MATNR TTPE MARA-MATNR,MATNR TTPE MARA-MATNR, MATKL TYPE MARA-MATKL,MATKL TYPE MARA-MATKL, END OF TY_REC.END OF TY_REC. DATA: GT_MARA TYPE TABLE OF TY_REC WITHDATA: GT_MARA TYPE TABLE OF TY_REC WITH HEADER LINE.HEADER LINE. • For Step loop the flow logic statement loop must be coded in both PBO andFor Step loop the flow logic statement loop must be coded in both PBO and PAI event. One form of the Flow Logic “LOOP” statement is;PAI event. One form of the Flow Logic “LOOP” statement is; LOOP.LOOP. . . . <flow logic statements> . . .. . . <flow logic statements> . . . ENDLOOP.ENDLOOP.
  • 114. ©India SAP CoE, Slide 114 Main screen Flow logicMain screen Flow logic Main screen flow logic for calling subscreen.Main screen flow logic for calling subscreen. PROCESS BEFORE OUTPUT.PROCESS BEFORE OUTPUT. MODULE STATUS_0100.MODULE STATUS_0100. call subscreen SUB1 including 'Z_MODULE_TRAINING' '0110'.call subscreen SUB1 including 'Z_MODULE_TRAINING' '0110'. PROCESS AFTER INPUT.PROCESS AFTER INPUT. call subscreen SUB1.call subscreen SUB1. MODULE USER_COMMAND_0100.MODULE USER_COMMAND_0100.
  • 115. ©India SAP CoE, Slide 115 Additions with ABAP OOPSAdditions with ABAP OOPS • Enjoy SAP controls (ALV Grid , ALV Tree, HTML controls etc) can beEnjoy SAP controls (ALV Grid , ALV Tree, HTML controls etc) can be displayed in screen.displayed in screen. • To place these grids we need to have screen element Custom ControlTo place these grids we need to have screen element Custom Control placed on the screen.placed on the screen. • Also we need to have ABAP OOPS knowledge. ( Refer package SLISAlso we need to have ABAP OOPS knowledge. ( Refer package SLIS for examples)for examples)
  • 116. ©India SAP CoE, Slide 116 Process on HelpProcess on Help • This event is a user programmed help.This event is a user programmed help. • If the user presses the ‘F1’ key with the cursor is positioned in <screenIf the user presses the ‘F1’ key with the cursor is positioned in <screen field>, the <supplemental documentation> will be displayed along withfield>, the <supplemental documentation> will be displayed along with the data element’s short text and documentation.the data element’s short text and documentation. • The only other Flow Logic statement that can be used in the POH eventThe only other Flow Logic statement that can be used in the POH event is:is: FIELD <screen field> MODULE <module>.FIELD <screen field> MODULE <module>.
  • 117. ©India SAP CoE, Slide 117 Process on ValueProcess on Value • This event is a user-programmed help that occurs when the user pressesThis event is a user-programmed help that occurs when the user presses F4 with the cursor positioned on a screen field.F4 with the cursor positioned on a screen field. • The modules specified in the subsequent FIELD statement is calledThe modules specified in the subsequent FIELD statement is called instead of the SAP help.instead of the SAP help. • Syntax is:Syntax is: FIELD <screen field> MODULE <module>.FIELD <screen field> MODULE <module>.
  • 118. ©India SAP CoE, Slide 118 Module pool programmingModule pool programming 1 PrepareMe 2 Syntax Description 3 Demonstration 4 Exercises 5 HelpMe Introduction
  • 119. ©India SAP CoE, Slide 119 DemonstrationDemonstration Please refer the attached document for demo example.Please refer the attached document for demo example. Microsoft Word Document
  • 120. ©India SAP CoE, Slide 120 Module pool programmingModule pool programming 1 Introduction 2 Syntax Description 3 Demonstration 4 Exercises 5 HelpMe
  • 121. ©India SAP CoE, Slide 121 ExercisesExercises Please refer the attached documents for hands-on.Please refer the attached documents for hands-on. • Exercise 1 – This covers input/output, radio button, table control, screenExercise 1 – This covers input/output, radio button, table control, screen navigation, flow logic events, Menu painter.navigation, flow logic events, Menu painter. • Exercise 2 – This covers tab strip, subscreen, table control, 4 flow logicExercise 2 – This covers tab strip, subscreen, table control, 4 flow logic events, screen navigation, menu painter.events, screen navigation, menu painter. Microsoft Word Document Microsoft Word Document
  • 122. ©India SAP CoE, Slide 122 Module pool programmingModule pool programming 1 Introduction 2 Syntax Description 3 Demonstration 4 Exercises 5 HelpMe
  • 123. ©India SAP CoE, Slide 123 HelpMeHelpMe • ReferRefer help.sap.comhelp.sap.com • Refer Transaction codeRefer Transaction code ABAPDOCUABAPDOCU (check in drop down ABAP User(check in drop down ABAP User Dialogs) for documentation and examplesDialogs) for documentation and examples • For screen elements and controls (table control, tabstrip) referFor screen elements and controls (table control, tabstrip) refer transactiontransaction BIBSBIBS.. • Refer package SLIS for examples of ALV grids, ALV Tree.Refer package SLIS for examples of ALV grids, ALV Tree.

Editor's Notes

  1. Module pool programs are also called as dialog programs, Online programs or transactions These programs are a collection of screens, their Flow Logic, and the code within the main ABAP program. The term “screen” refers to the actual, physical image that the users sees. The term “flow logic” refers to the code behind the screens (i.e., the logic that initializes screens and responds to a user’s requests on the screens). Each screen has its own Flow Logic. The term “dynpro” (dynamic program) refers to the combination of the screen and its Flow Logic. Menu will also have user interface for ABAP programs.
  2. Sample code: loop at screen. if screen-name = &apos;GV_OBJ_ID&apos;. screen-input = 1. modify screen. endif. endloop. This will enable the screen field GV_OBJ_ID for input. SCREEN is an internal table provided by SAP.