What Are Smart Forms

Embed Size (px)

Citation preview

  • 7/29/2019 What Are Smart Forms

    1/20

    What are Smart Forms.

    SAP-Smart Forms are used to create and

    maintain forms for mass printing in SAP

    systems.

    It is possible to embed text, image, tables,barcodes , etc..

    Output medium supports printer, fax, email or

    the internet (xml coding).

  • 7/29/2019 What Are Smart Forms

    2/20

    Difference between SAP-Scripts

    and Smart Forms.

    Multiple page formats are possible inSmart Forms which is not possible in SAP-Scripts.

    Smart Forms are client independent whileScripts are client dependent.

    It is possible to have a Smart Form without

    a main window. Smart Forms generates a function module

    when activated.

  • 7/29/2019 What Are Smart Forms

    3/20

    Advantages of Smart Forms.

    Smart Forms are client independent.

    Half of the time is required.

    Easy to use Graphical User Interface(GUI).

    Less programming effort.

    Web publishing is possible with the help of

    XML coding. Easy migration of SAP-Scripts to SAP-

    Smart Forms.

  • 7/29/2019 What Are Smart Forms

    4/20

    What else is new in Smart Forms?

    Easy insertion of company logos etc.

    Flow logic is represented by a tree structure, inthe form of nodes. Thus, change in printing

    order is easy using node drag & drop. ABAP coding is possible using the Program

    Lines node.

    Different page layouts can be used for each

    page Syntax check for individual nodes.

  • 7/29/2019 What Are Smart Forms

    5/20

    What can you get form Smart Forms.

    In a Smart Form you describe:

    The layout of your form (element positions on apage)

    Individual elements you want to display (text,graphics, addresses, tables, and so on)

    the form logic you use, for example, to readapplication data from internal tables, to introduce

    conditions, and to control process flows. a form interface to transfer application data to

    the form definition

  • 7/29/2019 What Are Smart Forms

    6/20

    Transaction code for Smart Forms is Smartforms.

    In the form builder one can describe a smart form by a set of nodes.

  • 7/29/2019 What Are Smart Forms

    7/20

    Node types

    When a form is created, the tree structure of the

    form painter contains two root nodes.

    Global Settings: The successors of the global

    settings node are used to maintain form

    attributes, the form interface and globaldefinitions.

    Pages and Windows: The successors of the

    pages and windows node to create the pages of

    the form, position elements on these pages, and

    determine the sequence on how to process

    these created elements.

  • 7/29/2019 What Are Smart Forms

    8/20

    Different types of nodes that can be created under Pages and

    Windows are:

    Page Window

    Text

    Graphic

    Address

    Template Table

    Command

    Loop

    Alternate

    Program Lines

    Folder

  • 7/29/2019 What Are Smart Forms

    9/20

    This

    Pages and windows are created using the node Pages and

    windows.

  • 7/29/2019 What Are Smart Forms

    10/20

    After pressing text in the create option you will be lead to this kind of page

    SAVE and Activate the Smart form.

    Enter your text in the free area.

  • 7/29/2019 What Are Smart Forms

    11/20

    Output after Execution

    Like this we can add graphics, window, table, etc..

  • 7/29/2019 What Are Smart Forms

    12/20

    How to call a Smart Form from a driver program???

    There is a function module for accessing Smart Forms from a driver

    program.

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' .

    Example task:

    Create a smart form with this details given below.

    Fields required- matnr, mbrsh, ntgew

    Table- MARA

    In smart forms- add a company logo, and add the companys

    address to it.

  • 7/29/2019 What Are Smart Forms

    13/20

    Our first step is to create a Smart Form

    with companys address and logo.

    Go to t.code-Smartforms.

    In pages and windows create address

    Enter a name to the Address and add a short description

    Save and Activate

  • 7/29/2019 What Are Smart Forms

    14/20

    Now to add a logo in the same the

    procedure is as follows.

    Go to transaction code SE-78 and add agraphic to your system.

    To implement that graphic to the Smart

    Forms the steps are as follows Go to pages and windows

    Right click create graphics.

  • 7/29/2019 What Are Smart Forms

    15/20

    Use F4 help to fill the fields.

    Save and Activate

  • 7/29/2019 What Are Smart Forms

    16/20

    Now smart form is ready. We need to construct a program to call

    this Smart Form.

    Program for the Ex.task

    TABLES: MARA

    TYPES: BEGIN OF ty_mat,

    matnr TYPE matnr,

    meins TYPE meins,

    ntgew TYPE ntgew,

    mbrsh TYPE mbrsh,

    mtart TYPE mtart,

    END OF ty_mat.DATA: it_mat TYPE STANDARD TABLE OF ty_mat,

    wa_mat TYPE ty_mat.

    DATA: it_mat TYPE STANDARD TABLE OF mara,

    wa_mat TYPE mara.

    DATA: matnr TYPE matnr

    meins TYPE meins,

    ntgew TYPE ntgew,mbrsh TYPE mbrsh,

    mtart TYPE mtart.

    SELECT matnr meins ntgew mbrsh mtart FROM mara

    INTO TABLE it_mat WHERE matnr IN s_matnr.

  • 7/29/2019 What Are Smart Forms

    17/20

    SELECT matnr meins ntgew mbrsh mtart

    FROM mara

    INTO TABLE it_mat

    WHERE matnr IN s_matnr

    call function 'SSF_FUNCTION_MODULE_NAME'

    exporting

    formname = 'ZSMARTFORM ****smart form name that is created.

    VARIANT = ' '

    DIRECT_CALL = ' '

    IMPORTINGty_mat = it_mat

    EXCEPTIONS

    NO_FORM = 1

    NO_FUNCTION_MODULE = 2

    OTHERS = 3.

    if sy-subrc 0.

    WRITE: / 'ERROR 1'.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    endif.

  • 7/29/2019 What Are Smart Forms

    18/20

    A function module is generated whenever a Smart Form is activated. This

    Smart Form could be called from the driver program by calling this functionmodule.

    But this is not an efficient way of calling Smart Form for the following

    reason:

    Whenever a Smart Form is generated, a function module is generated and

    the naming convention for that Smart Form is done internally by using

    Number range object or something similar.

    So when this Smart Form is transported from the development to Quality or

    Production system, a new function module name is generated according to

    the number series available in that system. If the above program is

    transported to either quality or production system, the program might go for

    a dump as the function module is not available in that system. To handlethis situation, we use the function module

    SSF_FUNCTION_MODULE_NAME to get the name of the function module

    for a Smart Form dynamically. If the form is not active, the function module

    SSF_FUNCTION_MODULE_NAME raises the exception NO_FORM.

  • 7/29/2019 What Are Smart Forms

    19/20

    CALL FUNCTION FM_NAME

    EXPORTINGARCHIVE_INDEX =ARCHIVE_INDEX_TAB =ARCHIVE_PARAMETERS =CONTROL_PARAMETERS =MAIL_APPL_OBJ =MAIL_RECIPIENT =MAIL_SENDER =OUTPUT_OPTIONS =USER_SETTINGS = 'X'

    I_EBELN = P_EBELN

    IMPORTINGDOCUMENT_OUTPUT_INFO =

    JOB_OUTPUT_INFO =JOB_OUTPUT_OPTIONS =TABLESIT_mat = IT_matEXCEPTIONSFORMATTING_ERROR = 1INTERNAL_ERROR = 2SEND_ERROR = 3USER_CANCELED = 4OTHERS = 5

    .IF SY-SUBRC 0.MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNOWITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.

  • 7/29/2019 What Are Smart Forms

    20/20

    How to migrate to smart forms from scripts.

    Go to the SAP Smart Forms initial screen (transaction SMARTFORMS).

    In the Form field enter the name of the Smart Form you want tocreate.

    Choose Utilities Migrate SAP script form.The dialog window Migrate SAP script Form appears.

    Enter the name and the language of the source form (SAP script).

    Choose Enter.This takes you to the change mode of the SAP Form Builder (Ifthe selected SAP script form does not exist in the selectedlanguage, a dialog window appears on which you can select oneof the existing languages).

    Now change the design of the form and of the form logic. Toactivate the Smart Form choose Activate.