smartform form layout creation tcode - smartforms.pdf

Upload: dipesh

Post on 24-Feb-2018

258 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    1/23

    Smartform Form Layout creation TCode -

    SMARTFORMS

    TechVantage IT Solution & Private Ltd.

    By-Shreedhar Apte

    To Create Form Layout for Smartforms we need to create new form using SMARTFORMS tcode. Step

    by Step details as below:

    A) Global Setting:

    1) Form Attributes: In this attributes, all system details are updated. User can select the Page

    Format, Style, and Output Format.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    2/23

    2) Form Interface: In this tab parameter details are provided, Import, Export parameters.

    Import Parameter: Developer need to provide parameters which will be output of driverprogram. Same parameters will be used for creating Smartforms.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    3/23

    Export Parameters: We need to provide export parameters. Normally we dont need to provide

    export parameters as it is used for print or output purpose.

    Table :Need to provide internal tables which need to be used , associated type should be

    defined in SE11 Table Defination . As in smartforms , only TYPEoption is available for

    type assignments.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    4/23

    3) Global Definition: In this developer need to define all the variables , work area and

    Internal table , Local structure definitions , Field symbols, currency/ Quan fields which will be

    used in smartforms.

    - Global Data : Developer need to add all the variable , work area and Internal table. Note

    for internal table associated type should be defined as Table type in SE11.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    5/23

    - Types : Developer need to define structure types in this tab.

    - Field Symbols: This is used to define field symbols ,used in OOPS.

    - Initialization : In this tab, developer need to write global code which can be used to work on the

    data transferred from Driver program.

    Input Parameters : Need to define all the input parameters required to execute code.

    Output Parameters : Need to define all the output parameters required to execute code. Code

    need to be written in text area , as per below screen shot.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    6/23

    - Currency/Quant Fields: Need to define all the currency / Quantity fields to be used in this

    smartforms.

    B) Pages and Windows (Layout creation): In this section developer can design Smartforms as

    per business needs. We can create Pages, Windows, Graphics and Address fields.

    There are four types of window that can be created:

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    7/23

    Main Window: It contains all the information which we need to display. Most of the times

    Data is dynamic in main window. We can define only one Main window in a page. We can

    create: Text, Table, Template, Flow Logic, Address window, Graphics, Address.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    8/23

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    9/23

    Graphics Section: As per business requirements user can assign image in graphics section. Normally

    this used to display company logo or plant address (to reduce the space)

    Address: Smartforms gives the option of giving the address number which is maintained in the

    central address management. The address will be directly taken from ADRC table and will be

    populated in the form.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    10/23

    Table Painter: In Table painter, you can draw the format as per client requirement (e.g. Heading,

    Sub Heading, Item, Sub Total, Grand Total etc.). In simple words Table = Loop + Template

    you can use the table layout to determine:

    The number of lines and cells

    The height of each line

    The width of each cell

    The alignment of the table in the window

    Table extends dynamically.

    Table contains dynamic data.

    The Table shows the different line types which will be used in the table. The Line types define the

    size of each cell and the number of cells in each line.

    Table has 3 sections, HEADER, ITEM, FOOTER the header section will be executed once and it will

    loop at the item level, and at the end footer will be executed.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    11/23

    ails

    Sections in table:

    - Table:In this section line type is defined. which will be used while defining sections in

    Header , Main area and Footer.Details > Field details section

    - Data:In this developer need to provide details of Internal Table and Work area

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    12/23

    - Calculations: If we need to display total , we need to provide operations which need to be

    executed , field details , Target field details and when this activity need to be executed.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    13/23

    Main Window Section :

    We need to add Row for Header , Main Areaand Footer Area.

    In each section we need to provide Line typewhich need to be displayed in

    Template:

    Template is a predefined format which you can design in the smartform like a ruled note book.Developer can graphically create no of rows and columns u want

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    14/23

    it is static

    You can create a template in any window you want.

    For putting any value in that u have to create text under the template and mention the position

    where the text will appear.

    In Text we can define in which that data to be displayed. Text > Output Options > Output Structure

    > Line and Columns

    Header:Static field labels are provided in text fields of Header section.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    15/23

    Main Area: This section is updated dynamically as per the data fetched from database. Values in

    main area are dynamic.

    Footer Section :This section normally used to display total values , total values or number of line

    items. We can add conditions in all the windows, if condition is satisfied then this section will be

    displayed or it will not be displayed. Similar toIF ... END IF Condition.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    16/23

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    17/23

    Secondary Window: Size of secondary window is always fixed. If data extends beyond the size of

    secondary window then it will be truncated. Normally Secondary window section is used to display

    address, final total, company logo or T&Cs.

    Final Window: Developer cannot add any other window after final window is defined on that page.

    System Fields for SMARTFORMS

    System fields of Smart Forms

    &SFSY-DATE&

    Displays the date. You determine the display format in the user master record.

    &SFSY-TIME&

    Displays the time of day in the form HH:MM:SS.

    &SFSY-PAGE&

    Inserts the number of the current print page into the text. You determine the format of the page

    number (for example, Arabic, numeric) in the page node.

    &SFSY-FORMPAGES&

    Displays the total number of pages for the currently processed form. This allows you to include texts

    such as'Page x of y' into your output.

    &SFSY-JOBPAGES&

    Contains the total page number of all forms in the currently processed print request.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    18/23

    &SFSY-WINDOWNAME&

    Contains the name of the current window (string in the Window field)

    &SFSY-PAGENAME&

    Contains the name of the current page (string in the Page field)

    &SFSY-PAGEBREAK&

    Is set to 'X' after a page break (either automatic [Page 7] or command-controlled [Page 46])

    &SFSY-MAINEND&

    Is set as soon as processing of the main window on the current page ends

    &SFSY-EXCEPTION&

    Contains the name of the raised exception. You must trigger your own exceptions, which you

    defined in the form interface, using the user_exception macro

    Flow Logic

    Alternative : In Alternative, we will give some condition. if the condition is true, only the elements within

    true node will be executed if its false only the elements within false node will be executed..

    Example :

    After creating Alternative your form will look like this

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    19/23

    In General Attributes of the alternate give condition COUNTRY = 'IN' as shown below

    Right Click on True and create text and write some text in that, likewise create text and write something forfalse condition also. Now our screen will appear as shown below

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    20/23

    (In this case I have written Alternate Condtion True Country is India for the text in true condition andAlternate Condtion True Country is India for text in false condition)

    Loop : Loop can be used in any window , it is not limited to Main Window alone. Give a descriptive

    name to the Loop Description text area.

    On the Data tab of the Smartform Loop element, define the loop for each IT_VBAK row as follows.

    On every turn of the defined loop, move each loop item into GS_VBAK vbak global structureor VBAK

    work area item.

    Also set the Row range from 1 to a logical number for example 9999, etc.

    Now we willcreatea data section which will show the SAP sales document number and the detail

    items of the VBAK row which maps to SAP VBAP records of the related VBAK header data.

    First of all, we willcreatea text element under the Loop element node.

    This text element will display the VBELN sales document number for each record of it_vbak selectedin the loop.Then we will add a table element in order to display the items of the loop item.

    The last Smartform element which we willcreateon this Smartforms example document is Command

    element.We will use the Command element in order to set page break between two vbak header records.

    Below is the screenshot that the SAP Smartform elements of this example Smartforms.Note that the descriptions of the Smartforms elements are given due to their respective tasks.

    Program Lines: In this section developer has to write program lines as per business requirements.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    21/23

    Developer has to provide input parameters and output parameters, as this fields are mandatory.

    Command:This section is used to add control break statements.

    Ex; in some cases user will ask only specific number of records should be displayed per page, but

    based on space availability of main window data will populate. To restrict manually the number of

    records displayed per page we can use COMMAND.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    22/23

    Developers have to write comparison value field and value in condition tab.

    Auxiliary Nodes in SMARTFORMS

    1) Table:O/p of a table containing application / dynamic data.

    2) Template:o/p of a table containing static data.

    3) Program Lines:Executes ABAP code.

    4) Folder:Combines successor nodes to logical group.

    5) Loop:Processes successor nodes repeatedly.

  • 7/25/2019 Smartform Form Layout creation TCode - SMARTFORMS.pdf

    23/23

    6) Alternative: In Alternative, programmer can give some condition. If the condition is true, only the

    elements within true node will be executed if its false only the elements within false node will be executed..

    7) Commands:Executes special commands.