0% found this document useful (0 votes)
64 views20 pages

Sap Abap On Hana - Module Pool-1

Uploaded by

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

Sap Abap On Hana - Module Pool-1

Uploaded by

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

SAP ABAP Module Pool

Dialog program is also used when we need to navigate back and forth
between screens

Dialog programs are created with type as ‘M’ – Module Pool. They cannot be
executed independently and must be attached to at least one transaction code in
which you specify an initial screen.

Report Program:

A report is a program that typically reads and analyzes data in database tables
without changing the database.

Dialog Program:

A dialog program allows you to work interactively with the system and to
change the contents of the database tables. Each dialog program has a certain
sequence of screens that are processed by the system one after the other.

A Sample transaction processing in Dialog Programming

Components of Dialog Program


Unlike report which generally entails the creation of one autonomous program
which can be executed independently of other objects, dialog program
development entails development of multiple objects none of which can be
executed on it’s own. Instead all objects are linked hierarchically to the

6360959192 www.tagskills.com [email protected]


main program and and are executed in a sequence dictated by the
Dialog Main Program.

The components of a dialog program are:

Transaction code

• The transaction code starts a screen sequence.


• You create transaction codes in the Repository Browser in the ABAP
Workbench or using Transaction SE93.
• A transaction code is linked to an ABAP program and an initial screen.
• You can start a screen sequence from any ABAP program using the
CALL SCREEN statement.

Screens

• Each dialog in an SAP system is controlled by one or more screens.


• You create screens using the Screen Painter in the ABAP Workbench
through transaction SE51
• Each screen belongs to an ABAP program.
• These screens consist of a “screen mask” or “layout” and its flow logic.
The screen has a layout that determines the positions of input/output
fields and other graphical elements such as checkboxes and radio buttons.
A flow logic determines the logical processing within screen.

GUI status

• Each screen has a GUI status(es) which are independent components of a


program.
• This controls the menu bars, standard toolbar, application toolbar , with
which the user can choose functions in the application.
• You create them in the ABAP Workbench using the Menu Painter.

ABAP Program

• Each screen and GUI status in the R/3 System belongs to one ABAP
program.
• The ABAP program contains the dialog modules that are called by the
screen flow logic, and also process the user input from the GUI status.
• ABAP programs that use screens are also known as dialog programs.
• In a module pool (type M program); the first processing block to be
called is always a dialog module. However, you can also use screens in
other ABAP programs, such as executable programs or function modules.
The first processing block is then called differently; for example, by the

6360959192 www.tagskills.com [email protected]


runtime environment or a procedure call. The screen sequence is then
started using the CALL SCREEN statement.

Screen Flow Logic

Screen Flow logic is primarily divided into four components.

• Process Before Output (PBO) event: which is processed before the screen
is displayed
• Process After Input (PAI) event: which is processed after a user action on
the screen
• Process on help request (POH): which is processed when F1 is pressed
• Process on value request (POV):which is processed when F4 is pressed

Dynpro

• A screen together with its Flow logic is called a Dynpro (“Dynamic


Program” since the screen flow logic influences the program flow)
• Each dynpro controls exactly one step of your Dialog Program.
• The screens belonging to a program are numbered. The screen flow
sequence can be either linear or cyclic. From within a screen chain, you
can even call another screen chain and, after processing it, return to the
original chain. You can also override the statically-defined next screen
from within the dialog modules of the ABAP program.

ABAP Module Pool

• On a PBO or PAI event a Dynpro calls an ABAP dialog program.


Collection of such programs is called the ABAP module pool.
• For example modules called at the PAI event are used to check the user
input and to trigger appropriate dialog steps, such as the update task.
• All dynpros to be called from within one transaction refer to a common
module pool.

6360959192 www.tagskills.com [email protected]


Structure of a Dialog Program

Process Flow for a Dialog Program

6360959192 www.tagskills.com [email protected]


Project Aim: To Add Data in Database table using Module Pool:

Step 1: Creating a database table ‘ZREGIS_SS’ in SE11.

Step 2: Add required fields in it and Activate it.

6360959192 www.tagskills.com [email protected]


Step 3: Go to SE80, select “Program” from the dropdown list and enter the
name of the Module Pool Programming. A pop-up will rise and ask you to
create it. Click on Yes.
Another Pop will come out to ask you to enter the name of the module pool
program. Click on the “Create with TOP Include” checkbox and click on the
tick button. Now enter the name of the TOP Include and continue saving it as a
module pool program.Provide Package name or TR details. Or Save it in a
Local Package.Now double click on “Include ********_TOP “ on the screen
for the Types & Data declaration. Now activate it.

Step 4: Now right-click on the Program name and create a screen. Give Screen
Number “0001” and click on Tick. Give a short description and click on Layout.
Now Screen Painter will open. Click on “Dictionary/Program Fields Window”.
Enter the name of the Work Area you created in TOP Include and click on “Get
from Program” and select the fields you want to display. Now drag and drop it
on the screen painter. Now select “Text tool” from the side panel and drop it
next to the input tab and write the text which you want to display for the input
field. Do the same for all the input fields as shown below. Now double click on
the Input field and write the name for the input field as shown below. Now
select the Text tool to add some text on the screen, such as headings. Now

6360959192 www.tagskills.com [email protected]


create a button by clicking on the “Push Button” on the left toolbox and
placing it on the screen wherever you want. Now double click on the button,
and a pop-up will come out, enter the name of the button there and mention the
function code “Fct Code” in that as shown below. Now save and activate the
screen.

6360959192 www.tagskills.com [email protected]


Step 5: Now go to the “GUI Status” tab to create ‘BACK BUTTON’.
Provide the PF-STATUS as “ZBUTTON”, double click on Function keys
Expand the Function keys and provide the “back” THEN save, check and
activate .

6360959192 www.tagskills.com [email protected]


Step 6: go to the tab “Flow Logic”. Uncomment every module under PBO
and PAI sections. Double click on MODULE user_command_0001 INPUT and
save it in the main program as shown previously with “screen100”.Now write
this code inside the MODULE user_command_0001 INPUT.
CREATE Operation
On the SUBMIT button we have to do the Insert Code that can insert data into
database table “ZREGIS_SS” . If it is successfully inserted we will get the
message as “SUCCESSFULL” and it will be visible in the database table. Click on
“BACK” button, it will go to screen 0

6360959192 www.tagskills.com [email protected]


Step 7: Now right-click on the program name and create-> Transaction.
Enter the name of the Transaction code and a short description. Select the radio
button “Program and screen (dialogue transaction)”.Now enter the screen
number of that screen which you want to see first when you run your transaction
code, here in our case we are adding screen number 1. Now save and activate
the whole program by right-clicking on the main program name and clicking on
the “Activate button”. Now run the Transaction code in the Transaction Box.

6360959192 www.tagskills.com [email protected]


OUTPUT:

UPDATED IN DATABASE TABLE ‘ZREGIS_SS’:

6360959192 www.tagskills.com [email protected]


SAP ABAP Table Control with Examples

Table controls and step loops are objects for screen table display that you add to
a screen in the Screen Painter.

From a programming standpoint, table controls and step loops are almost
exactly the same. Table controls are simply improved step loops that display
data with the look and feel associated with tables in desktop applications.

Features of ABAP Table Control


With table controls, the user can:

• Scroll through the table vertically and horizontally


• Re-size the width of a column
• Scroll within a field (when field contents are wider than the field)
• Select table rows or columns
• Re-order the sequence of columns
• Save the current display settings for future use

Table controls also offer special formatting features (some automatic, some
optional) that make tables easier to look at and use. Table Control provides –

• automatic table resizing (vertical and horizontal) when the user resizes
the window
• separator lines between rows and between columns (vertical and
horizontal)
• column header fields for all columns

One feature of step loops is that their table rows can span more than one line on
the screen. A row of a table control, on the other hand, must always be
contained in a single line (although scrolling is possible).

To create a table control

1.Add a table control element to your screen

2.Give a name to the table control. In the ABAP program declare a structure
with the same ( CONTROLS <tcl> type TABLEVIEW USING SCREEN <scrn
>)

3.To create fields go to the Dict./Program fields function.

6360959192 www.tagskills.com [email protected]


• Enter the name of the structure whose fields you want. (If you want it
to pick it from the dictionary of your program click the relevant push
button).
• In the field list choose the fields you want and choose ok.
• Click in the table control area

If you want a selection column, check the appropriate check box in the
attributes and give it a name. Create the field in the ABAP program.

In the PBO you should have the statement

LOOP at <itab> USING CONTROL <cntrl_name>.

ENDLOOP.
In the PAI you should have.

LOOP at <itab>.

ENDLOOP.
It is within the loops that data transfer happens between the screen and the
internal table.When you populate the internal table use DESCRIBE TABLE
<itab> LINES <cntrl_name>-lines, to store the total number of lines in the
control.The FIELD statement can be used to control when the data transfer
happens

To change the attributes of individual cells temporarily change the SCREEN


table in the PBO. You can change the attributes of the structure created by the
CONTROLS statement

Project Aim: Based on Sales Document number of VBAK TABLE, fetching


data from Item Table VBAP using Table Control.

Fetching Columns:
1. Sales Document Number(VBELN)
2. Item Number (POSNR)
3. Material Number(MATNR)
4. Batch(CHARG)
5. Net value(NETWR)

6360959192 www.tagskills.com [email protected]


Step 1: Go to SE80, select “Program” from the dropdown list and enter the
name of the Module Pool Programming. A pop-up will rise and ask you to
create it. Click on Yes.
Another Pop will come out to ask you to enter the name of the module pool
program. Click on the “Create with TOP Include” checkbox and click on the
tick button. Now enter the name of the TOP Include and continue saving it as a
module pool program. Provide Package name or TR details. Or Save it in a
Local Package. Now double click on “Include ********_TOP “ on the screen
for the Types & Data declaration. Now activate it.

Step 2 : Declare Structure ‘TY_V’ which contains required fields of VBAP.

i.e VBELN , POSNR, MATNR, CHARG , NETWR . Declare Internal table


IT_VBAP and work area WA_VBAP . Also create parameter for Sales number
whose input you have to take. Even Declare TABLE CONTROL ‘TB’ for
Screen ‘0101’. We need 2 screens.

Screen ‘0100’ – for taking input sales number.

Screen ‘0101’- for Displaying Data of VBAK Table.

Step 3: Double click on screen “100”, the below screen will be displayed there
we need to click on yes button. Enter the short description and click
on “Layout” button. Design the screen like as below. Save, check and activate.
Now for Screen 0101 , we have to create Table Control. Also create a Push

6360959192 www.tagskills.com [email protected]


button ‘BACK. Select the “push-button” , and adjust the buttons as needed.
Provide the Name, text and Fctcode

Step 4: Writing the code for fetching the data from VBAP table using
SELECT query on ‘DISPLAY’ button.

6360959192 www.tagskills.com [email protected]


Step 5:

In PBO perform Loop at Internal Table IT_VBAP with table controls. And in
the PAI we should have empty loop.

Step 6:

Transaction Creation

Go to SE93 transaction code. Or you can create from se80 workbench also.
Provide Transaction code and click on create button. The below screen will be
displayed, Provide the required fields. Click on save button

6360959192 www.tagskills.com [email protected]


OUTPUT:

6360959192 www.tagskills.com [email protected]


WHEN YOU CLICK ‘DISPLAY’ BUTTON , IT NAVIGATES YOU TO
NEXT SCREEN.

6360959192 www.tagskills.com [email protected]


TagSkills:
Disclaimer – © Copyright TagSkills. ASSOCIATED www.tagskills.com ©
Copyright TagSkills. The copyright in this work is vested in TagSkills. Please
note and abide by copyright laws. This presentation is for educational purposes
only, all logos, photos, and information, etc used in this Presentation is the
property of TagSkills. SAP is a registered trademark of SAP AG in Germany
and many other countries. We are NOT ASSOCIATED with SAP.
©www.tagskills.com © Copyright TagSkills. many other countries. We are
NOT ASSOCIATED www.tagskills.com © Copyright TagSkills. The copyright
in this work is vested in TagSkills. Please note and abide by copyright laws.
This presentation is for s only, all logos, photos, and information, etc used in
this Presentation is the property of TagSkills. SAP is a registered trademark of
SAP AG in Germany and many other countries. We are NOT ASSOCIATED
with SAP. ©many other countries. We are NOT ASSOCIATED with SAP. ©

6360959192 www.tagskills.com [email protected]

You might also like