2008 Mar 12 4:20 PM
Can anybody Provide me good step by step procedure for module pool and smart for programming with screenshot.
my email Id is bedayan@yahoo.com
2008 Mar 13 10:09 AM
Hi,
A module pool is a collection of screens, flow logic, menu bars and ABAP code that you use to build an application. Typically the transaction code that calls the application will refer to the module pool and the initial screen number.
-->What are the requirements a dialog program must fulfill ?
A dialog program must fulfill the following requirements
. 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.
What are the basic components of dialog program ?
Screens (Dynpros)
Each dialog in an SAP system is controlled by dynpros. A Dynpro consists of a screen and its flow logic and controls exactly one dialog step.
ABAP/4 module pool
Each dynpro refers to exactly one ABAP/4 dialog program. Such a dialog program is also called a module pool, since it consists of interactive modules.
What is a dynpro ? What are its components ?
A dynpro (DYnamic PROgram) consists of a screen and its flow logic and controls exactly
one dialog step.
- The different components of the dynpro are:
Flow logic: Calls of the ABAP/4 modules for a screen
Screen layout: Positions of the texts, fields, pushbuttons, and so on for a screen
Screen attributes: Number of the screen, number of the subsequent screen, and others
Field attributes: Definition of the attributes of the individual fields on a screen
What is screen flow logic? What are the selections in it? Explain PAI and PBO?
Ans - Screen flow logic contains the procedural part of a screen. The screen flow logic is like an ABAP program in that it serves as a container for processing blocks. There are four event blocks, each of which is introduced with the screen keyword PROCESS:
PROCESS BEFORE OUTPUT.
...
PROCESS AFTER INPUT.
...
PROCESS ON HELP-REQUEST.
...
PROCESS ON VALUE-REQUEST.
Selections are performed in PAI.
PROCESS BEFORE OUTPUT (PBO) is automatically triggered after the PAI processing of the previous screen and before the current screen is displayed. You can program the PBO processing of the screen in this block. At the end of the PBO processing, the screen is displayed.
PROCESS AFTER INPUT (PAI) is triggered when the user chooses a function on the screen. You can program the PAI processing of the screen in this block. At the end of the PAI.
processing, the system either calls the next screen or carries on processing at the point from which the screen was called.
PROCESS ON HELP-REQUEST (POH) and PROCESS ON VALUE-REQUEST (POV) are triggered when the user requests field help (F1) or possible values help (F4) respectively. You can program the appropriate coding in the corresponding event blocks. At the end of processing, the system carries on processing the current screen.
step by step process of dialog programing:
Firstly, you can go to Tcode SE80 and here create a package.
On that package name right click and select program.
Then choose program type modulepool program.
Similarly, you can create screen and then select layout and drag and drop labels and pushbuttons as per your requirements.. Then double click on th push buttons.You will see property window and there we will find FCTCODE and there type the names e.g suppose you want to
display then typy on the fctcode Display or any name as you wish.
After that save and activate it. and then close the window.
And then go back to the intial screen .
And then click Flow logic button and then uncomment the statement
module status_1000 PBO block and then doible click on status_1000
save and activate and then go back and then PAI block uncomment the statement module status_1000 and the dobule click on status_1000.
step by step process of creating smartforms:
1. What is Smartforms?
Smartforms is a tool to create and maintain forms for mass printing in SAP Systems. Just like sapscripts, for Smart
forms print program is used to create the output internal table which in turn is thrown to the smart form where the
field values are displayed. The output medium for Smartforms support printer, fax, e-mail, or the Internet.
Transaction Code: SMARTFORMS
To print a form the program for the data retrieval and a Smartform that contains the entire form logic is required. As
these two are separate one should adapt the Smartform if changes to the form logic are necessary. The application
program passes the data via a function module interface to the Smartform. When activating the Smartform the system
automatically generates the function module.
The architecture of the smart form is given below:
Creating Forms Using SAP Smart Forms
When creating a form one must:
1. Retrieve the application data
2. Describe the form
3. Pass the application data to the form
Example: Create Smartform for printing Purchase order.
Retrieving the application data (Purchase Order information):
Write an ABAP program (Print Program) to retrieve data or include a retrieval routine into the application. This
code consists of statements that select data from databases according to certain selection criteria. Store the
retrieved data in internal tables, structures or variables and transfer it to the form in one step.
SAP has already provided with the Print Program (/SMB40/FM06P) for Purchase Order. Based on the business
requirement, this Print Program can be copied and modified to get the required data and transfer to Smartform.
Describing the Form:
The user defines the form using a Smartform. Use the tools of the form builder as listed below:
1. Use the form painter to position the windows, graphics and addresses on a page.
2. Use the PC editor to write the texts.
3. Use the table painter to format the tables.
The flow control is used to print the pages and elements.
Form Logic (Introduction)
In the form builder one can describe a Smartform by a set of nodes. To do this, one can build up a tree structure on
the left side of the user interface.
The node global settings and its three successors form attributes, form interface and global definitions always exists
for any newly created forms.
To describe the form logic, create the hierarchy under the node pages and windows.
The following rules apply to control the flow of the form output.
1. The nodes in the tree structure are processed from top to bottom.
2. For each node there is a tab, this can be used to link the node to a condition. If the condition is true, the
system processes the node. If not, it skips the node and all its successors.
3. One should define a next page for each page.
The SAP form builder of the smart form consists of:
1. Form painter for creating the layout of the form
2. PC Editor for entering texts and fields into output areas
3. Navigation tree for maintaining the form logic
4. Table painter for creating templates and tables
To define the text formats, one can use the Smart Styles.
Style builder:
On the left of the style builder screen consists of the predetermined nodes (header data, folder for paragraph
formats, and folder for character formats).
On the right one can see the maintenance screen with its tab pages. At the bottom the preview of the selected font
can be viewed.
Create Purchase Order Smartform
Create a Smartform, copy the existing SAP provided purchase order Smartform to ZSFM_PURCHASEORDER for
customizing as per business requirement.
1. Form Settings under Global Settings node, set the parameters in Output Option:
Page Format: Letter
Character per Inch: 20
Line per Inch: 6
Style: ZSTM_SMB40_SF
Output Format: Standard Output
2. Form Interface
We can add parameters in the Import Parameters and tables in Tables tab of the form interface for the application
data to be available for the Smartform to print.
3. In Global definition we can define the all the global variables which can be used in Smartforms. Initialization
can be used for initializing the variables and even for retrieving the data.
Creating pages:
Each form consists of one or more pages. The first page in the tree structure is the start page and the
processing of the form starts with this page itself.
1. Open the context menu for existing page node and choose create®page
2. Enter a unique name (FIRST) for the node and a description (Page)
3. Determine the format (1, 2, 3...)and the mode of the page counter (Increase counter) on the general
attributes tab
4. Determine the print attributes (Portrait Format) of the page on the output options
5. Determine a background graphic for the entire page on the background tab (Not used in PO).
Creating windows:
The size and position of the window can be graphically set in the form painter. There are main windows and
secondary windows. The difference between these two is that the output in a main window can cover several
pages.
1. Open the context menu for an existing page node and choose®window
2. Enter a name for the node (NAMEFORM) and a description (Title Window).
3. On the general attributes indicate type of window. NAMEFORM is secondary window.
In similar fashion all the other windows are created and positioned as per the form design. Only one MAIN
window is created, it is used for line items which can cover several pages.
Positioning texts on the form
The texts are displayed in the form using text nodes. The only exceptions are addresses.
The predecessor node of the text node determines its use:
Predecessor node Used to
Secondary window Position text on one or more pages
Main window Display text in relation to other nodes in the main window, it may cover several pages
Template Displays texts for table cells of a static table
Table Display table contents
There are three text types:
1. Text element : to enter new text in the PC editor
2. Text module : to include a text module
3. Include text : to include an existing SAPscript text
Entering texts in PC editor: (TITLE)
· To create a text node call the context menu for that node in the tree structure that should receive the
text, then choose->text
· Enter a unique name (TITLE) for the node and the node description (TITLE)
· On the general attributes tab choose text element as text type
· In the text node box choose whether the text should be started with a new paragraph or only in a new
line
· Enter the text in the PC editor. Text could be a program element like &Title& or Purchase Order. &Title&
is a variable for which the value is assigned in Program line before the text.
Including text modules: (TERMSCONDITION)
Text module of the text node is used to refer to an existing text module in the system. The text modules can be
used in two ways:
· To create a text node, call the context menu for that node in the tree structure that shall contain the text
and choose create->text under the window TERMSCONDITION.
· Enter a unique name for the node (TERMSCONDITION) and a description (Terms and Condition)
· On the general attributes tab select the text type text module
· Enter the name of the text module in the text name field (&G_TERMS_TEXT&). &G_TERMS_TEXT& is
used to determine the Text name dynamically in the program lines preceding the text module node.
· Program Lines: GETTERMSCONDITION
Concatenate 'ZTMM_PO_TERMS_' ZXEKKO-BUKRS
INTO G_TERMS_TEXT.
Including SAPscript texts: (HD_TXT_F01 Order Header Text)
The text type include text node to refer to a SAPscript text, which already exists in the system. To identify the
text the text name, object, id and the language is needed.
· To create the text node, call the context menu for that node in the tree structure that shall receive the
text and choose create -> text under the main window.
· Enter a unique name (HD_TXT_F01) for the node and the node description (Order Header Text).
· On the general attributes tab choose include text as text type
· Text Name - &ZEKKO-EBELN&, Text Object EKKO, Text ID F01, Language - &SY-LANGU&. Also check
mark No error if no text exists.
Tip: Since the size of text is not known, its better to have the text in MAIN window, so that it can run to more
than one page if required.
Inserting addresses: (SENDER):
Address node is used to insert an address into the form. This guarantees that the address is formatted
according to the postal rules of the sender country.
· To create an address node , call the context menu for that node in the tree structure that one wants to
contain the text and choose create->Address
· Enter a name for the node (COMPANY_CODE_ADDRESS) and a description (Company Code Address)
· Determine the address type (Organization Address) on the general attributes tab
· For organizational addresses - specify the address number, for any other - specify the person number
and the address number. In this case we get the company code address into variable &ADDNR&, so we need
program lines (SENDER) preceding the address text.
· In the box additional addresses, attributes to specify how to display the address are maintained.
Printing graphics: (LOGO):
Tcode SE78 is used to import graphics into the SAP system. The transaction imports the graphics and stores it
in the BDS (business transaction server) and then it can be displayed in the form.
· To create the graphic node , call the context menu for that node in the tree structure and choose create-
>graphic
· Enter a name (LOGO) for the node and the description (Logo Graphic)
· On the general attributes determine whether a colored or a black and white
· On General Attributes use the fields object - GRPAHIC, id BMAP and name - &G_LOGO& to identify the
graphic. &G_LOGO& is variable and therefore we can print company code specific logo. Program line preceding
the graphic is required.
· Program line COMP_LOGO is used to assign the value to G_LOGO. Concatenate 'ZCOMPANY_LOGO_'
ZXEKKO-BUKRS INTO G_LOGO. So, the name of graphic for example will be ZCOMPANY_LOGO_0202 for
company code 0202.
Displaying a static table (Window INFO, Template - TEM_INFO)
Use node type template to display a table whose layout and size is determined before the runtime of the print
program.
To create a template, define a table layout to determine the cell structure for each line. The cells are used to
display the cell structure for each line. The cells are used to display the contents of the successor nodes of the
template node.
· Create Template under the INFO window node. Create > Template.
The template layout is used to determine the following,
1. The number of lines and cells
2. The height of each cell
3. The width of each cell
4. The alignment of the table in the window
5. Whether and where to display separator lines or frames
Use the table control on the template tab to define the layout of the lines. Each line of the template must have
a definition.
Use the pattern box to select the desired table pattern.
·
Displaying contents in cells: (TLE_CONTACT)
The template node defines the table layout. The successor nodes of the template determine the data to be
displayed in the table cells.
In General Attributes choose Text type Text Element. In editor, type DTE Contact.
In Output Options, define the output structure LINE 5 and Column 1.
Similarly all other information for each cell can be filed using the text module and address module.
Displaying Dynamic Table (ITEM_TABLE)
· Create TABLE under the MAIN window node. In DATA Tab, loop through the data internal table.
L_XEKPO is the item table which has all the line item details.
Define the line types based on the positioning of the text in main window. For example: TABLE_HEADER1
is used for positioning Header texts in the table.
· Table is divided into three parts: Header, Main Area and Footer.
· Header is used for printing the Header Title of the table and it at the start of the table on every page.
· Main Area is used to print the line item details of the PO. Create a line (ITEM_DETAIL) of the line type
TABLE_HEADER1. It will dynamically generate number cells based on the line type defined in the table layout.
Name all the cells as per the usage. For each cell create the text node to display the information. For example:
Cell VAL_MATERIAL, Text node MATNR is created which has text element - -matnr.
· Footer is used for printing the information after Main Area data is printed. This can be used for Total
printing or any other information which needs to be printed after all line items are printed. Create line
TLE_CONTR_STP for Contractual Stipulation of the line type LINE which has only one column. Create the
text element to print the information.
Special Requirement: Printing the Acknowledgement text if the order value is greater then USD 50,000.00 on
the second copy only.
· This requirement needs the modification in the print program and the Smartform.
· Modification in Print Program to trigger the second copy if the order value is greater then 50K. Its
advisable to copy the standard print program to custom Z program (Z_SMB40_FM06P), and changes should
be made to Z program. Number of copies is passed from NAST to ls_composer_param-tdcopies in Smartforms.
The value ls_composer_param-tdcopies is modified in the print program to 2 if the order value is greater then
50K.
· The printing of Acknowledgement Text only on second copy is achieved using the COPIES WINDOW in
Smartforms. Define Window ACKN_COPY of the type COPIES WINDOW and Output to Only Copies Copies
Differ. Also set the condition in the Condition Tab of the window SFSY-JOBPAGES = 1, so that it only print
on the first page of the copy.
· If user selects to print 2 copies and the order value is more then 50k, program needs to print 2 sets
meaning 4 copies. So number of copies is taken care of in Print program but again the printing of
Acknowledgement Text should be only the Even number copy meaning Copy# 2 and 4. This achieved by using
the program lines to determine the even copy. SFSY-COPYCOUNT will tell us the current copy number being
printed.
regards,
vineela.
Edited by: Radha Vineela Aepuru on Mar 13, 2008 11:12 AM