sap-smartforms-training-material

47
AB1009 – Smartforms - v1.0 AB1009 – Smartforms - v1.0

Upload: adarssh-jain

Post on 14-Dec-2014

112 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SAP-SmartForms-Training-Material

AB1009 – Smartforms - v1.0AB1009 – Smartforms - v1.0

Page 2: SAP-SmartForms-Training-Material

SmartformsSmartforms1 Introduction

2 Syntax Description

3 Demonstration

4 Exercises

5 HelpMe

Page 3: SAP-SmartForms-Training-Material

SmartformsSmartforms1 Introduction

2 Syntax Description

3 Demonstration

4 Exercises

5 HelpMe

Page 4: SAP-SmartForms-Training-Material

IntroductionIntroduction

• PurposePurpose

• UseUse

Page 5: SAP-SmartForms-Training-Material

PurposePurpose

Smartform is a template that simplifies the process Smartform is a template that simplifies the process of designing business forms. You need smartform to of designing business forms. You need smartform to print, distribute or display business forms. print, distribute or display business forms. Smartform tool includes utilities for designing forms Smartform tool includes utilities for designing forms and for defining the interface to the application and for defining the interface to the application programs that use forms for data output. The output programs that use forms for data output. The output of application data is placed into a dynamically of application data is placed into a dynamically expandable table where the size and layout of the expandable table where the size and layout of the outputoutput table is determined by the number of records table is determined by the number of records being retrieved.being retrieved.

Page 6: SAP-SmartForms-Training-Material

Use of SmartformUse of Smartform

• Smartforms are used for designing and printing various types of application documents across the various SAP modules like SD, FI, PU, IM, WM etc. Smartforms are used for mass printing like monthly invoices sent by telecom companies or salary statements.

Page 7: SAP-SmartForms-Training-Material

SmartformsSmartforms1 Introduction

2 Syntax description

3 Demonstration

4 Exercises

5 HelpMe

Page 8: SAP-SmartForms-Training-Material

Syntax DescriptionSyntax DescriptionSmartform has 3 driving components : Print Program, Layout Set and Function module.

1. Application Data is fetched by the Print Program from the database depending upon the selection screen parameter.

2. Function module of a Layout Set is generated when the smartform is activated.

3. The output of application document is sent to printer or mail or fax.

Page 9: SAP-SmartForms-Training-Material

Smartform DevelopmentSmartform Development To develop a smartform object one needs to develop following

objects :

1. Smartform Layout :

Can be developed in the Form Painter

Decides the data format

Transactions to use : Smartforms

Smartstyles - To design our own style.

2. Print Program :

Performs data selection based on selection criteria

Passes data to the smartform function module

Transaction to use : SE38 to develop a print program.

Page 10: SAP-SmartForms-Training-Material

Smartform Initial ScreenSmartform Initial Screen

Page 11: SAP-SmartForms-Training-Material

Smartform Builder ComponentsSmartform Builder ComponentsSmartform screen is divided in following 3 components.

Navigation Menu Maintenance Frame Form Painter

Page 12: SAP-SmartForms-Training-Material

Smartform screen componentsSmartform screen components• Navigation Menu – This screen appears on the left of the screen.

• Maintenance frame – This frame appears in the middle of the screen.

• Form painter frame – This frame appears on the right of the screen. If form painter is not visible on the screen , then choose option Form Painter.

•You can control whether form painter is hidden or visible.

A form consists of following components :

-Pages -Table

-Windows -Template

-Graphics -Flow Logic

- Data or text contents -Folder

- Address

Page 13: SAP-SmartForms-Training-Material

Node Types OverviewNode Types Overview

Root Nodes Global Settings Pages and Windows.

Attributes General Attributes Output Options Conditions

Page 14: SAP-SmartForms-Training-Material

Successors of Node Pages and WindowsSuccessors of Node Pages and Windows

As direct successors to root node Pages and windows you can create only page nodes. The tables below describe these page nodes and the other successors:

Successors of Node Pages and WindowsSuccessors of Node Pages and Windows

Page 15: SAP-SmartForms-Training-Material
Page 16: SAP-SmartForms-Training-Material

• On the pages of a form you determine the page layout and the sequence of pages with different structures.The page layout includes the page format (for example, DIN A4, Letter, DIN A5 landscape) and the position of the windows on a page.

• The individual pages of a form may differ in their structure. For each page, you must specify a next page to make the page sequence clear.

• Many forms contain only two pages of different structure: the first page, which calls the next page, and the next page, which calls itself. If the text does not entirely fit onto the second page, another document page is automatically displayed.

PagesPages

Page 17: SAP-SmartForms-Training-Material

Main window and subwindowsMain window and subwindows

• You can position windows anywhere on a page, even overlapping. You can position the same window (determined by the technical name) on several pages of a form, so that the same contents are displayed on all these pages. You can On a page, there are two different types of output areas for texts and data: the main window and the subwindow.

• choose a different size for the window on each page, except for the main window.

• Main Window : In a main window you display text and data, which can cover several pages (flow text). As soon as a main window is completely filled with text and data, the system continues displaying the text in the main window of the next page. It automatically triggers the page break.

Page 18: SAP-SmartForms-Training-Material

SubwindowsSubwindows

• In a subwindow you display text and data in a predetermined output area. There is no flow text display with page break. If you position a subwindow with the same name on several pages, the system displays the contents of this subwindow on each page.

• Text and data that do not fit into the subwindow are truncated and not displayed.

Page 19: SAP-SmartForms-Training-Material

Tables and TemplatesTables and Templates• Table size is decided at runtime depending upon the type and

number of records.• Line Types : Table width is determined from line types. Line type

specifies how many lines a table line should hold and what width these cells should have.

Page 20: SAP-SmartForms-Training-Material

Table and Templates - Contd.Table and Templates - Contd.Template size is determined at design time in the Form Painter.

Page 21: SAP-SmartForms-Training-Material

Text Type Text Type

Form Text types

Text elementsText modulesInclude textsDynamic texts

Page 22: SAP-SmartForms-Training-Material

Parameterized TextParameterized Text In order to avoid hardcoding we can use the concept of

parameterized text. Here you can assign a text or value to a variable or pass in a ztable and then use this variable (or table field) directly instead of hardcoding the text or value.

e.g.

In the above example we can also pass &nast-spras& or &sy-langu& instead of hardcoding the language as ‘EN’

Page 23: SAP-SmartForms-Training-Material

Event and ConditionsEvent and Conditions

Conditions: You can define

conditions for individual nodes, or for whole sub hierarchies of the context.

Events: With this option you can decide where you want to

display the text or data of that particular node.

Page 24: SAP-SmartForms-Training-Material

Global Settings – Integration with Global Settings – Integration with application programapplication program

Form attributes – Contains administrative info of the form.1)General attributes like created by, creation date, creation time.2)Output options a) Style b)Page format c)Output formats(Standard/XSF/XSF+HTML).

Form interface – Through Form Interface application (print) program can interact with smartform and vice a versa. It has four tabs

Import Export Tables Exceptions

Page 25: SAP-SmartForms-Training-Material

Global Definitions – All the variables that are global across the

smartform are declared here. Here we have five tabs Global Data Types Initialization Field Symbols Form Routines.

Page 26: SAP-SmartForms-Training-Material

Integrating the Smart Form with the Integrating the Smart Form with the application program.application program.

Application program consists of 3 parts :

a. Data selection from the database.

b. Determining the name of generated function module using ‘SSF_FUNCTION_MODULE_NAME’.

c. Actual form processing: The generated function module is called for each document to be created.

The form is triggered by calling two function modules. The first module uses the name of the form to determine the name of the generated function module. Then you call this module.

Page 27: SAP-SmartForms-Training-Material

The name of the generated function module is unique only within one system. Therefore, always call the function module first that uses the form name to determine the current name of the generated function module.

Procedure to carry out in Print Program: • First define the form interface in your form and activate the form.• In the form builder call the function Environment Function Module Name and copy its name.• In the application program define a variable of type RS38L_FNAM for the

name of the generated function module: data fm_name type RS38L_FNAM • Call function module SSF_FUNCTION_MODULE_NAME . It returns the

name of the generated function module: CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING FORMNAME = '<form name>' IMPORTING FM_NAME = fm_name EXCEPTIONS NO_FORM = 1 NO_FUNCTION_MODULE = 2 OTHERS = 3.IF SY-SUBRC <> 0. <error handling>ENDIF.

Page 28: SAP-SmartForms-Training-Material

• Call the generated function module .

CALL FUNCTION fm_name EXPORTING* ARCHIVE_INDEX =* ARCHIVE_PARAMETERS =* CONTROL_PARAMETERS =* OUTPUT_OPTIONS =* USER_SETTINGS = 'X' G_CARRID = <variable> G_CONNID = <variable>* IMPORTING* JOB_OUTPUT_INFO =* JOB_OUTPUT_OPTIONS = TABLES GT_SBOOK = <internal table>EXCEPTIONS FORMATTING_ERROR = 1 INTERNAL_ERROR = 2 SEND_ERROR = 3 OTHERS = 5.

IF SY-SUBRC <> 0. <error handling>ENDIF.

Page 29: SAP-SmartForms-Training-Material

SmartformsSmartforms1 Introduction

2 Syntax description

Demonstration

4 Exercises

5 HelpMe

3

2 Syntax Description

Page 30: SAP-SmartForms-Training-Material

ConfigurationConfiguration - The basic configuration required to do for smartform is creating

output type and attaching the smartform to the output type. - NACE is the transaction to set the output type. - In this transaction first the application is selected ( e.g.V1 Sales, V2

Shipping etc) - Then output type is selected. Sometimes output type is created

newly if driver program and smartform are custom program and not SAP standard ones.

- Whenever new output type is created , 3 parameters are required. They are :

- Smartform Name - Driver Program Name - ENTRY routine name.- Incase of FI forms, configuration is done using BTEs (Business

Transaction Events) since NACE cannot be used to configure FI forms.

Page 31: SAP-SmartForms-Training-Material

SmartformsSmartforms1 Introduction

2 Syntax description

Demonstration

4 Exercises

5 HelpMe

3

2 Syntax Description

Page 32: SAP-SmartForms-Training-Material

Quick Overview of Node Usage

before starting with exercise

Page 33: SAP-SmartForms-Training-Material

ExercisesExercisesLet us design one smartform for Billing Document. The layout specifications and data retrieval logic has been explained in these word documents.

Layout Specification :

Data Retrieval Logic

Layout Specification

Data retrieval for billing document

Page 34: SAP-SmartForms-Training-Material

TransactionsTransactions

SMARTFORMSSMARTFORMS Create SmartformCreate Smartform

SMARTSTYLESSMARTSTYLES Create styleCreate style

SO10SO10 Create standard TextCreate standard Text

SE38SE38 Create print programCreate print program

SE78SE78 Upload LogoUpload Logo

Page 35: SAP-SmartForms-Training-Material

SmartformsSmartforms1 Introduction

2 Syntax description

Demonstration

4 Exercises

5 HelpMe

3

2 Syntax Description

Page 36: SAP-SmartForms-Training-Material

Tips and Tricks in smartformTips and Tricks in smartform

1. Debugging smartform

2. Adding variables in text node

Field List

Field List on / off

Page 37: SAP-SmartForms-Training-Material

Additional – Interface parameters in detailAdditional – Interface parameters in detail

Page 38: SAP-SmartForms-Training-Material

• Required parametersRequired parameters

• Optional parametersOptional parameterscontrol_parameterscontrol_parametersoutput_optionsoutput_optionsuser_settingsuser_settingsjob_output_info, job_output_optionsjob_output_info, job_output_options

Additional – Interface parameters in detail…Additional – Interface parameters in detail…continuedcontinued

Page 39: SAP-SmartForms-Training-Material

Configuration required for Configuration required for SmartformSmartform

• Output Type : Output type connects the application program and the layout. The application program actually retrieves the data and layout defines the placement of this data. To attach the layout to an application program output type should be defined.

• How to define Output type : For SD module

SPRO Sales and Distribution Basic Functions Output Control Output Determination Maintain output types.

Page 40: SAP-SmartForms-Training-Material

How to migrate the SAP scripts to How to migrate the SAP scripts to Smartforms?Smartforms?

You can convert individual forms on the initial screen of the SAP Smartforms transaction. Steps for migration are:

1. Enter the ‘smartforms’ in command node. It will take you to smartform screen.

2. Enter the name of the SAP Smartform to be created in the Form field.

3. Choose Utilities at menu bar and select Migrate SAPscript form .

4. The program first tries to find the SAPscript form in the current client ; if the form does not exist there the system looks in client 000.If you choose Enter form is migrated.

Page 41: SAP-SmartForms-Training-Material

Downloading of SmartformDownloading of Smartform

1. 1. Go to Smartforms transaction. Specify a form name that you Go to Smartforms transaction. Specify a form name that you want to download.want to download.

2. Select to 2. Select to Utilities->DownloadUtilities->Download Form at menu bar. You will get a Form at menu bar. You will get a popup to specify the location where you want to download.popup to specify the location where you want to download.

3. On click on Save , smartform will be downloaded in .XML format 3. On click on Save , smartform will be downloaded in .XML format to a specified location.to a specified location.

Uploading of SmartformUploading of Smartform 1. Go to Smartforms transaction. To upload smartform , enter the 1. Go to Smartforms transaction. To upload smartform , enter the

smartform name in Form smartform name in Form field and select field and select Utilities->Upload Form.Utilities->Upload Form.

2. You will get a popup to specify .XML file . Specify the file 2. You will get a popup to specify .XML file . Specify the file name from which you want to create a smartform.name from which you want to create a smartform.

Page 42: SAP-SmartForms-Training-Material

Smartforms - AdvantagesSmartforms - AdvantagesSmartform offers following advantages :

• Creating and maintaining forms require half the time.

• Adapting to forms without any programming techniques due to GUI.

• Web publishing using generated XML output.

• High performance when printing in large quantities.

Page 43: SAP-SmartForms-Training-Material

How smartforms are different How smartforms are different than Sapscripts?than Sapscripts?

1. Multiple page formats are possible in smartforms which is not the case in Sapscripts.

2. It is possible to have smartform without a main window.

3. Routines can be written within smartform tool itself.

4. Smartforms generate a function module when activated. Because of which smartform can be called from any ABAP object type and thus increases reusability.

Page 44: SAP-SmartForms-Training-Material

Another Method to Debug a SmartformAnother Method to Debug a SmartformMethod 1.Method 1.• Goto SE37 and give the function module name of a Smartform.Goto SE37 and give the function module name of a Smartform.

• Open the Function ModuleOpen the Function Module

Page 45: SAP-SmartForms-Training-Material

• Goto Goto Main Program Main Program

Page 46: SAP-SmartForms-Training-Material

It will display three includes:It will display three includes:• First Include will have the Global Data Declaration.First Include will have the Global Data Declaration.• Second Include will have the Form Interface.Second Include will have the Form Interface.• Third Include will have the Main Program.Third Include will have the Main Program.

Page 47: SAP-SmartForms-Training-Material

• Open the third Include and set the Break-Point wherever necessaryOpen the third Include and set the Break-Point wherever necessary

Method2.Method2.• In same way we can do it through transaction SE80.In same way we can do it through transaction SE80.