Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

regarding smart forms (really urgent)

Former Member
0 Likes
2,635

hi,

i am new to smartforms and i got report to make changes in the smart forms,plzz help me out as i know nothing about the smart forms by providing me it in easiest & simplest form.

if find useful help will be deifnately rewarded.

Edited by: ric .s on Mar 6, 2008 5:16 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,621

Hi,

Fetaures of Smartforms:

1.SAP Smart Forms is used to create and maintain forms for mass printing in SAP Systems.

2.As output medium SAP Smart Forms support a printer, a fax,

e-mail, or the Internet (by using the generated XML output).

3.SAP introduced SmartForms in 1998 to overcome the limitations in SAP Scripts.

4.SmartForms are easier to develop, maintain and transport than SAP Script.

SmartForms Vs SAP Script:

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

the case in SAPScripts

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

3.Labels cannot be created in smartforms.

4.Routines can be written in smartforms tool.

5.Smartforms generates a function module when activated.

SAP Smart Forms offer the following advantages:

Creating and maintaining forms requiring half the time.

Adapting forms without any programming knowledge due to entirely graphical user interface

Web Publishing using the generated XML output

The smart forms allow the user to execute simple modifications to the form and in the form logic

by using simple graphical tools.

 When activating the smart form the system automatically generates the function

module and at the runtime processes it.

The user designs the form using the graphical form painter and the graphical table painter.

The form logic is represented by the hierarchical structure that consists of individual nodes

To make any changes we have to use the Drag&Drop, Cut & Paste. These actions do not include

writing of coding lines or using a script language.

We can insert static and dynamic tables. These include the line feeds in the individual table cells,

triggering events for table headings and subtotals and sorting data before output.

The smart forms allow the user to include graphics, which can be displayed as a part of the form or as

background graphics. During printout the user can suppress the background graphic as and when necessary.

The SAP Smart Forms has replaced the SAPscript forms. Migration of SAPscript forms into Smart Forms is supported.

Most of the new projects would be using this technology. Clients would increasingly demand smartforms to be used rather than sapscript .

Pleasse reward if its helpful.

Thanks,

Abhishek

hi,

i am new to smartforms and i got report to make changes in the smart forms,plzz help me out as i know nothing about the smart forms by providing me it in easiest & simplest form.

if find useful help will be deifnately rewarded.

Edited by: ric .s on Mar 6, 2008 5:16 AM

8 REPLIES 8
Read only

Former Member
0 Likes
1,622

Hi,

Fetaures of Smartforms:

1.SAP Smart Forms is used to create and maintain forms for mass printing in SAP Systems.

2.As output medium SAP Smart Forms support a printer, a fax,

e-mail, or the Internet (by using the generated XML output).

3.SAP introduced SmartForms in 1998 to overcome the limitations in SAP Scripts.

4.SmartForms are easier to develop, maintain and transport than SAP Script.

SmartForms Vs SAP Script:

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

the case in SAPScripts

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

3.Labels cannot be created in smartforms.

4.Routines can be written in smartforms tool.

5.Smartforms generates a function module when activated.

SAP Smart Forms offer the following advantages:

Creating and maintaining forms requiring half the time.

Adapting forms without any programming knowledge due to entirely graphical user interface

Web Publishing using the generated XML output

The smart forms allow the user to execute simple modifications to the form and in the form logic

by using simple graphical tools.

 When activating the smart form the system automatically generates the function

module and at the runtime processes it.

The user designs the form using the graphical form painter and the graphical table painter.

The form logic is represented by the hierarchical structure that consists of individual nodes

To make any changes we have to use the Drag&Drop, Cut & Paste. These actions do not include

writing of coding lines or using a script language.

We can insert static and dynamic tables. These include the line feeds in the individual table cells,

triggering events for table headings and subtotals and sorting data before output.

The smart forms allow the user to include graphics, which can be displayed as a part of the form or as

background graphics. During printout the user can suppress the background graphic as and when necessary.

The SAP Smart Forms has replaced the SAPscript forms. Migration of SAPscript forms into Smart Forms is supported.

Most of the new projects would be using this technology. Clients would increasingly demand smartforms to be used rather than sapscript .

Pleasse reward if its helpful.

Thanks,

Abhishek

Read only

Former Member
0 Likes
1,621

hi ,

For Smart Forms u have to do 2 steps

1. Use Smart Forms Transaction to design ur screen

As it is a user friendly one, U can simply use it.

2.A driver program to trigger our Smart form

This i l help u thru code


     Tables: likp,lips  .
DATA: W_FMODNAM TYPE RS38L_FNAM.

data : var type SSFCTRLOP.
 var-NO_DIALOG = 'X'.
 var-PREVIEW = 'X'.
PARAMETERS  :  P_VBELN like likp-vbeln obligatory..

data: wa_likp type ZCS_STRLIKP.
data: wa_lips type ZCS_STRLIPS.
data: it_likp type standard table of ZCS_STRLIKP with header line.
data: it_lips type standard table of ZCS_STRLIPS with header line.


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001 .

  parameters: smart  radiobutton group c.
  parameters: script  radiobutton group c.

SELECTION-SCREEN END   OF BLOCK b1.


            select single vbeln kunag kunnr vkbur prvbe bldat fkdat lifnr
                                          from likp
                                          into wa_likp
                                          where vbeln = p_vbeln.

            select posnr kdmat matnr arktx lfimg vrkme
                                      from lips
                                      into table it_lips
                                      where vbeln = wa_likp-vbeln.
if smart = 'X'.

              CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
                EXPORTING
                  FORMNAME                 = 'ZCS_SMRTFRM_276'
*                 VARIANT                  = ' '
*                 DIRECT_CALL              = ' '
               IMPORTING
                 FM_NAME                  = W_FMODNAM
*               EXCEPTIONS
*                 NO_FORM                  = 1
*                 NO_FUNCTION_MODULE       = 2
*                 OTHERS                   = 3
                        .




CALL FUNCTION '/1BCDWB/SF00000837'
  EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
   CONTROL_PARAMETERS         = var
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
    WA_LIKP                    = wa_likp
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
  TABLES
    IT_LIPS                    = it_lips
* EXCEPTIONS
*   FORMATTING_ERROR           = 1
*   INTERNAL_ERROR             = 2
*   SEND_ERROR                 = 3
*   USER_CANCELED              = 4
*   OTHERS                     = 5
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Reward if useful

Regards,

Karthik.T

Read only

Former Member
0 Likes
1,621

Hi,

This Smartform Information I read, really helped me out.

I think it would be of some good help to you too..

What is SAP Smart Forms?

SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.

SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can configure forms with data from an SAP System for the relevant business processes.

To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.

You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.

You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.

SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.

SAP Smart Forms also support postage optimizing.

Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C

What Transaction to start SAP Smart Forms?

Execute transaction SMARTFORMS to start SAP Smart Forms.

Key Benefits of SAP Smart Forms:

SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.

You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.

To make changes, use Drag & Drop, Copy & Paste, and select different attributes.

These actions do not include writing of coding lines or using a Script language.

Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.

For Web publishing, the system provides a generated XML output of the processed form.

Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.

Advantages of SAP Smart Forms

1. The adaption of forms is supported to a large extent by graphic tools for layout and logic, so that no programming knowledge is necessary (at least 90% of all adjustments). Therefore, power user forms can also make configurations for your business processes with data from an SAP system. Consultants are only required in special cases.

2. Displaying table structures (dynamic framing of texts)

3. Output of background graphics, for form design in particular the use of templates which were scanned.

4. Colored output of texts

5. User-friendly and integrated Form Painter for the graphical design of forms

6. Graphical Table Painter for drawing tables

7. Reusing Font and paragraph formats in forms (Smart Styles)

8. Data interface in XML format (XML for Smart Forms, in short XSF)

9. Form translation is supported by standard translation tools

10. Flexible reuse of text modules

11. HTML output of forms (Basis release 6.10)

12. Interactive Web forms with input fields, pushbuttons, radio buttons, etc. (Basis-Release 6.10)

A Simple Smartform Tutorial

SAP Smartforms can be used for creating and maintaining forms for mass printing in SAP Systems. The output medium for Smartforms support printer, fax, e-mail, or the Internet (by using the generated XML output).

According to SAP, you need neither have any programming knowledge nor use a Script language to adapt standard forms. However, basic ABAP programming skills are required only in special cases (for example, to call a function module you created or for complex and extensive conditions).

1. Create a new smartforms

Transaction code SMARTFORMS

Create new smartforms call ZSMART

2. Define looping process for internal table

Pages and windows

• First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)

Here, you can specify your title and page numbering

&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)

• Main windows -> TABLE -> DATA

• In the Loop section, tick Internal table and fill in

• ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2

3. Define table in smartforms

Global settings :

Form interface

Variable name Type assignment Reference type

ITAB1 TYPE Table Structure

Global definitions

Variable name Type assignment Reference type

ITAB2 TYPE Table Structure

4. To display the data in the form

Make used of the Table Painter and declare the Line Type in Tabstrips Table

e.g. HD_GEN for printing header details,

IT_GEN for printing data details.

You have to specify the Line Type in your Text elements in the Tabstrips Output options.

Tick the New Line and specify the Line Type for outputting the data.

Declare your output fields in Text elements

Tabstrips - Output Options

For different fonts use this Style : IDWTCERTSTYLE

For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&

5. Calling SMARTFORMS from your ABAP program

REPORT ZSMARTFORM.

  • Calling SMARTFORMS from your ABAP program.

  • Collecting all the table data in your program, and pass once to SMARTFORMS

  • SMARTFORMS

  • Declare your table type in :-

  • Global Settings -> Form Interface

  • Global Definintions -> Global Data

  • Main Window -> Table -> DATA

  • Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming

  • http://sapr3.tripod.com

TABLES: MKPF.

DATA: FM_NAME TYPE RS38L_FNAM.

DATA: BEGIN OF INT_MKPF OCCURS 0.

INCLUDE STRUCTURE MKPF.

DATA: END OF INT_MKPF.

SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.

SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.

MOVE-CORRESPONDING MKPF TO INT_MKPF.

APPEND INT_MKPF.

ENDSELECT.

  • At the end of your program.

  • Passing data to SMARTFORMS

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTFORM'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

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.

call function FM_NAME

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

GS_MKPF = INT_MKPF

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

if sy-subrc <> 0.

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

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

endif.

Additional Fonts for your SMARTFORMS

You can create additional fonts and style with transaction SMARTSTYLES

This can then be define in the paragraph and character formats, which you can then be assign to texts and fields in the Smart Form.

The character formats includes effects such as superscript, subscript, barcode and font attributes.

Difference with SMARTFORMS vs. SapScript(SE71)

The Following are the differences :-

a) Multiple page formats are possible in smartforms which is not the case in SAPScripts

b) It is possible to have a smartform without a main window .

c) Labels cannot be created in smartforms.

d) Routines can be written in smartforms tool.

e) Smartforms generates a function module when activated.

f) Unlike sapscripts (RSTXSCRP), you cannot upload/download Smartform to your local harddisk.

It was said that it was provided in CRM 3.0 version, but not available in R/3. You can download smartforms into Local PC in a XML format. In the same way you can upload this XML format into Smartform. From the smartform editor itself you can call download option, if you are working in CRM 3.0 environment.

In R3 also, you can download into XML format. However, it's not sure about uploading. Refer to the program 'SF_XSF_DEMO'.

In 4.7 Enterprise, other have seen this utlity which is completey missing in 4.6c. There is functionality to downlaod a complete form or only a particular node. (Utilities -> Download form). It will create a XML file and save it in the hard disk.

For others, if you want to download/upload the Smartforms source, you will need the help from the Basis people. What you can do is to create a Transport and then FTP down to your local harddisk. When you need the Smartform source in another system, you have FTP up the Smartforms file back to the SAP server. Finally, the Basis team, will tp it into your system.

g) The protect and endprotect command in sapscript doesn't work with smartforms. For example on a invoice: First data of position no 80. is printed on page one, other data of position no 80 is printed on page 2. And there's nothing you can do about it. Actually, there is something you can do about it. By using a folder node and checking the 'protect' checkbox, everything in that folder will be page protected.

FAQ on Migrating SAPscript to SmartForms

Is it possible to migrate a SAPscript form to a Smart Form?

Smart Forms provides a migration tool for this purpose which migrates layout and texts of a SAPscript form to a Smart Form. It does not migrate SAPscript form logic of the print program. Using Smart Forms, this logic is described by the tree structure of the Form Builder. The effort involved in migrating it depends on the complexity of the print program.

Which Basis Release do I need to use SAP Smart Forms?

SAP Smart Forms is available as of R/3 Basis Release 4.6C.

I have heard that Smart Forms replaces SAPscript. What does "replace" mean?

It does not mean that SAPscript is removed from the Basis shipment. Even as of Basis Release 4.6C, SAPscript remains part of the SAP standard and there are no plans to remove it. Since Smart Forms is currently, and will continue to be, the tool for form maintenance for mySAP.com solutions, our further development efforts will focus on Smart Forms, not on SAPscript.

Do we have to migrate all SAPscript forms to Smart Forms?

There is no point in migrating all SAPscript forms already in use. Since SAPscript can still be used and will be available in the future, there is no need to. If you plan to migrate a SAPscript form, it is recommended that you check whether benefit is worth the effort involved

Conversion of SAPSCRIPT to SMARTFORMS

SAP provides a conversion for SAPscript documents to SMARTforms.

This is basically a function module, called FB_MIGRATE_FORM. You can start this function module by hand (via SE37), or create a small ABAP which migrates all SAPscript forms automatically.

You can also do this one-by-one in transaction SMARTFORMS, under

Utilities -> Migrate SAPscript form.

You could also write a small batch program calling transaction SMARTFORMS and running the migration tool.

SmartForms System Fields

Within a form you can use the field string SFSY with its system fields. During form processing the system replaces these fields with the corresponding values. The field values come from the SAP System or are results of the processing.

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.

&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 (syntax: user_exception <exception name >).

Example Forms Available in Standard SAP R/3

SF_EXAMPLE_01

Simple example; invoice with table output of flight booking for one customer

SF_EXAMPLE_02

Similar to SF_EXAMPLE_01 but with subtotals

SF_EXAMPLE_03

Similar to SF_EXAMPLE_02, whereby several customers are selected in the application program; the form is called for each customer and all form outputs are included in an output request

Smart forms Frequently Asked Questions

Forcing a page break within table loop

Create a loop around the table. Put a Command node before the table in the loop that forces a NEWPAGE on whatever condition you want. Then only loop through a subset of the internal table (based on the conditions in the Command node) of the elements in the Table node.

Font style and Font size

Goto Transaction SMARTSTYLES.

There you can create Paragraph formats etc just like in sapscript.

Then in your window under OUTPUT OPTIONS you include this SMARTSTYLE and use the Paragraph and character formats.

Line in Smartform

Either you can use a window that takes up the width of your page and only has a height of 1 mm.

Then you put a frame around it (in window output options).

Thus you have drawn a box but it looks like a line.

Or you can just draw "__" accross the page and play with the fonts so that it joins each UNDER_SCORE.

Difference between 'forminterface' and 'global definitions' in global settings of smart forms

The Difference is as follows.

To put it very simply:

Form Interface is where you declare what must be passed in and out of the smartform (in from the print program to the smartform and out from the smartform to the print program).

Global defs. is where you declare data to be used within the smartform on a global scope.

ie: anything you declare here can be used in any other node in the form.

Smartforms function module name

Once you have activated the smartform, go to the environment -> function module name. There you can get the name of funtion module name.

The key thing is the program that calls it. for instance, the invoice SMARTFORM LB_BIL_INVOICE is ran by the program RLB_INVOICE.

This program uses another FM to determine the name of the FM to use itself. The key thing is that when it calls this FM (using a variable to store the actual name), that the parameters match the paramters in your smartform.

Another thing to note is that the FM name will change wherever the SF is transported to.

So you need to use the FM to determine the name of the SF.

Here is the code that can be use to determine the internal name of the function module:

Code:

if sf_label(1) <> '/'. " need to resolve by name

move sf_label to externalname.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = externalname

importing

fm_name = internalname

exceptions

no_form = 1

no_function_module = 2

others = 3.

if sy-subrc <> 0.

message 'e427'.

endif.

move internalname to sf_label.

endif.

It checks to see if the sf_label starts with a '/', which is how the internal names start. if it does, the name has already been converted. If not, it calls the FM and converts the name.

You would then CALL FUNCTION sf_label.

Smartforms FAQ Part Two

Smartforms output difference

Problem with Smartforms: in a certain form for two differently configured printers, there seem to be a difference in the output of characters per inch (the distance between characters which gives a layout problem - text in two lines instead of one. It happens when the two printers having different Printer Controls' if you go to SPAD Menu (Spool Administrator Menu) you can see the difference in the Printer Control and if you make the Printer control setting for both the printers as same. then it will be ok. and also u have to check what is the device type used for both the output devices.

SmartForms Output to PDF

There is a way to download smartform in PDF format.

Please do the following:

1. Print the smartform to the spool.

2. Note the spool number.

3. Download a PDF file (Acrobat Reader) version of the spool by running Program RSTXPDFT4 and entering the noted spool number.

SmartForm Doublesided printing question Your customer wants your PO SmartForm to be able to print "Terms and Conditinos" on the back side of each page. They don't want to purchase pre-printed forms with the company's logo on the front and terms & conditions on the back. Now this presents an interesting problem.

Has anyone else ever had a request like this? If for example there was a 3 page PO to be printed, they want 3 pieces of paper, the front side of each to containe the PO information (page 1, 2, and 3) and the back side of each piece of paper to containg the static "Terms & Conditions" information.

Anyone have a clue how to force this out?

Easy - page FRONT lists page CONTACTS as next page and CONTACTS lists FRONT as next page. Since CONTACTS does not contain a MAIN window, it will print the contacts info and then continue on to FRONT for the rest of the main items. Additionally, set print mode on FRONT to D (duplex) and set CONTACTS to 'blank' (for both resource name and print mode - this is the only way to get to the back of the page).

Transport Smart Forms

How does one transport SMARTFORM? SE01?

How do you make sure that both, the SMARTFORM & it's function module gets transported? Or does the FM with same name gets generated automatically in the transported client?

A smartform is transported no differently than any other object. if it is assigned to a development class that is atteched to a transport layer, it will be transported.

The definition is transported, and when called, the function module is regenerated.

This leads to an interetsing situation. On the new machine, it is very likely the function module name will be different than the name on the source system. Make sure, before you call the function module, you resolve the external name to the internal name using the 'SSF_FUNCTION_MODULE_NAME' function module.

Typically, generate the SF, then use the pattern to being in the interface. Then change the call function to use the name you get back from the above function module.

Smartforms: protect lines in main window.

How to protect lines in the main window from splitting between pages?

It was easy with SAPscript, but how to do it with SF's. For 4.7 version if you are using tables, there are two options for protection against line break:

- You can protect a line type against page break.

- You can protect several table lines against page break for output in the main area.

Protection against page break for line types

- Double-click on your table node and choose the Table tab page.

- Switch to the detail view by choosing the Details pushbutton.

- Set the Protection against page break checkbox in the table for the relevant line type. Table lines that use this line type are output on one page.

Protection against page break for several table lines

- Expand the main area of your table node in the navigation tree.

- Insert a file node for the table lines to be protected in the main area.

- If you have already created table lines in the main area, you can put the lines that you want to protect again page break under the file using Drag&Drop. Otherwise, create the table lines as subnodes of the file.

- Choose the Output Options tab page of the file node and set the Page Protection option. All table lines that are in the file with the Page Protection option set are output on one page.

Regards,

Rohini.

Read only

Former Member
0 Likes
1,621

Hi,

SMARTFORMS:

-


ADVANTAGES OF SMARTFORMS:

-


1. Smartforms does not require paragraph formats as a mandatory one.

2. Smartforms does not duplicate the data.

3. Smartforms are Client-independent and language-independent.

4. We can apply styles for the texts using Smartforms.

5. Print programs does not contain any function modules to call the form.

SMARTFORMS is the Tcode to create smartforms in ABAP.

Smartforms has three components:

-


Global Settings:

-


1. Form Attributes - Holds the description about the smartform.

2. Form Interface - Holds the import and export parameters for the smartforms.

3. Global Definitions - Used to declare variables for the smartform that can be accessed by any component within the smartform.

Pages and Windows:

-


This area is used to create new pages, windows (header, footer, constant window, main window, variable window, graphic window).

Navigations to create Smartforms:

-


SMARTFORMS -> Specify form name starting with Z or Y -> Click on Create -> Opens an interface -> Enter short description -> Double click on Form Interface -> Specify following parameter in IMPORT tab button:

STR TYPE C

-> Expand Pages and Windows -> By default, a Main Window is present -> Right click on Main Window -> Create -> Text -> Opens Form Editor -> To go to line editor, Click on 'Txt Editor' pushbutton on the upper left corner of the form editor -> Specify the variable (&STR&) in the first line of line editor -> Come back -> Save -> Activate -> Execute -> Opens Form Builder with autogenerated function module for the smartform ('/1BCDWB/SF00000042') -> Copy the function module generated.

To invoke the smartform from SE38 editor, Call the Function module and paste the FM copied from smart form function builder screen as follows:

DATA NAME(10) VALUE 'INDIA'.

CALL FUNCTION '/1BCDWB/SF00000042'

EXPORTING

STR = NAME.

-> Save -> Activate -> Execute in the same way as Sapscript.

Navigations to pass internal table as an argument to Smartforms:

-


Create a smartform -> In the Form interface -> Click on Tables tab button -> Specify the following internal table:

ITAB LIKE MARA.

-> Double click on Global Definitions -> Specify the global variable as follows:

-

ITAB1 LIKE MARA.

-> Expand Pages and Windows -> Right click on Main Window -> Create -> Table -> Click on Data tab button -> In the LOOP section, for the operand fields, specify the following:

ITAB INTO ITAB1.

-> Right click on Main Area -> Create -> Table Line -> In the Line Type input field, a line type called %LTYPE1 is automatically generated -> Select it.

To create internal table fields, right click on Text cell -> Create -> Text -> Select General Attributes tab button -> Opens Form Editor -> Goto Line editor by clicking on 'Txt Editor' pushbutton -> Specify the following in the first line:

&ITAB1-MATNR&,,&ITAB1-MTART&,,&ITAB1-MBRSH&,,&ITAB1-MEINS&

-> Come back -> Save -> Activate -> Execute -> Copy the autogenerated FM.

In SE38 program, specify the following:

DATA ITAB1 LIKE MARA OCCURS 0 WITH HEADER LINE.

SELECT * FROM MARA INTO TABLE ITAB1.

CALL FUNCTION '/1BCDWB/SF00000043'

TABLES

ITAB = ITAB1.

Save -> Activate -> Execute in the same way as above.

Regards,

Priya.

Read only

Former Member
0 Likes
1,621

What are Smart Forms?

SAP’s new print form solution, SAP Smart Forms, is the successor of SAPscript. All new

development of forms at SAP will be done using the Smart Form print solution. However,

SAPScript will still be supported for those forms already created in SAPScript, and for customers

who have created their own forms in SAPScript.

SAP Smart Forms is a tool for the maintenance of forms on which application data from the SAP

system can be output. Depending on the application, the number of forms to be printed can be

very high, and they might have to be printed in a short period of time, in a mass printing.

Examples of mass printing are monthly invoices sent by telecom companies or salary statements.

The output of application data is placed into a dynamically expandable table where the size and

layout of the output table is determined by the number of records being retrieved.

What About SAPscript?

Customers can use either SAPScript or Smart Forms as their forms solution. SAP recommends

you use Smart Forms for new developments (from 4.6C), because these forms are much easier

to edit when using the Smart Forms graphical tools. Also, further development is planned for the

Smart Form print solution.

For example, the customer can use a preconfigured Smart Form for the Purchase Order, and a

SAPscript form for the Production Order (if no suitable Smart Form is available), or create the

Smart Form.

While unnecessary, a user’s prior knowledge of SAPScript forms can accelerate their Smart

Forms learning because some tools are used both by Smart Forms and SAPscript (for example,

font maintenance transaction SE73, SAPScript texts, and more).

SAP Smart Form Process Overview

The basic structure of SAP Smart Forms consists of the Smart Form Builder, the Smart Form

print form template (which you create or is given to you as a preconfigured starting point), the

Smart Form function module, and the Smart Form print program (also described as a driver

program).

4

The Smart Form print programs are not the same as SAPScript programs, and you cannot use a

SAPScript print program with a Smart Form print form.

Programming Flow

When an SAP Smart Form template is created, a user creates the form layout, defines the

required fields, conditions, and special programming instructions in the Smart Form template

using the Smart Form Builder.

After the form design is complete, the form needs to be activated before it can be tested or

accessible by print programs.Activating the form initiates the generation of a function module that

handles all of the form’s processing.

This function module interacts with the application program and print program to create the output

in the user-defined output media for the specified device.

Smart Form Architecture Diagram

Data Retrieval

Application

Program

Smart Form

Form Logic

ABAP

Function

Module

(generated)

Output Device

Web Browser

Printer

Fax

5

Smart Form Components

SAP Smart Form Builder

The main SAP Smart Form interface is the Smart Form Builder. Call this transaction by entering

the transaction code smartforms in the Command field.

The initial screen allows you to enter the name of the form you want to modify or copy, or you can

create a new form.

After entering the name of the form in the Formular (or form) field, select the desired button:

either Display, Change, or Create. The SAP Form Builder screen appears next.

6

Smart Form Builder Components

Smart Form Builder Screen

The three frames of Smart Forms Builder screen are the:

• Navigation menu: This frame 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 your Form Painter is

not visible on the screen, choose Form Painter. You can control whether the Form Painter

is visible or hidden using this button.

Each frame can be resized by clicking and dragging the borders.

By a selecting a node in the navigation menu, the view in the other frames changes

as follows:

&#8722; Maintenance frame: By double-clicking on the desired navigation menu node, the

corresponding information (general attributes, options, and conditions) is

selected.

Maintenance Navigation Menu Frame Form Painter

7

&#8722; Form Painter: By single or double-clicking on the desired navigation menu node,

the appearance of the Form Painter changes to highlight the corresponding

ouput area (the box with the label based on the node label in the navigation

menu) is highlighted.

&#8722; You can reposition the output area box by dragging and dropping it to a new

position.

Smart Form Print Form Template

A Smart Form print form is designed using the Smart Form Builder. This formdoes not create the

final output. The Smart Form function module, generated by the Smart Form print form, creates

the output.

Smart Form Function Module

The Smart Form function module is the code generated automatically when you activate your

Smart Form print form. Each time you make a change to your print form in the Smart Form

Builder, the change needs to be activated in the Smart Form Builder before taking effect in your

output.

Smart Form Print Program

The Smart Form print program is where the majority of data extraction occurs. Typically, one

Smart Form print program should be associated with one type of form. For example, the Smart

Form purchase order has a corresponding Smart Form purchase order print program that only

handles data extraction for that form.

This one-to-one relationship improves the transparency for the user between what is being

performed in the form versus the print program.

We recommend that customer-specific customization be performed in the Smart Form print form,

and not in the Smart Form print program.

Amajor benefit of the Smart Form print solution over SAPscript is that if the layout or

order of information changes in the Smart Form print form, you do not need to alter

the print program. The layout of data on the form is controlled only in the Smart Form

print form.

Specifics about Smart Form Development

Important Objects for Form Development

The following objects can be edited from the Smart Forms initial screen (transaction

SMARTFORMS):

• Smart Style: Each form uses at least one Smart Style. A style is a collection of paragraph

and character formats.

• Text modules: Forms can include text modules (encapsulated text), making it possible to

reuse texts in several forms.

• The form itself: The form contains form processing logic, content, and layout, and refers to

Smart Styles and text modules. The form is also called a Smart Form.

8

The objects are cross-client and have a translation connection (but until now no workbench

connection). You can include old SAPscript texts in a Smart Form using include texts. However,

all SAPscript commands will be ignored.

Graphics

Graphics to be used in forms must first be stored on the Business Document Server (BDS) of the

SAP System (as a bitmap image or TIFF). The transaction code SE78 is used for this purpose.

Applications graphics include:

• Logos

• Preprinted forms that are scanned in as background pictures

Templates and Tables

SAP Smart Forms has a powerful new tool called the Table Painter. The Table Painter provides

more powerful functionality over SAPScript. For example, table and template outputs that are

rather difficult to create in SAPscript are much easier in Smart Forms. One exciting feature in

Smart Forms is the ability to create dynamically expandable tables.

In Smart Forms, although templates still have a fixed number of rows, the number of rows in a

Smart Form table can be dynamic. In both Smart Form templates and tables, you can determine

how many cells a line of a table output should have using the Table Painter's row types.

Additionally, you can use a scanned-in image of a preprinted third-party form (such as a W2 form

for Employee Earnings in the U.S.) as a background image in the creation of templates. A

background image proves especially useful when laying out fields on a template. This

background image can either be printed or not when the form is output.

Tables

When you work on a table node in your form, the node is marked with the table icon . In the

maintenance frame, you get a new type of tab, the Table tab. See below.

On this tab, you can define the table characteristics, and turn on the Table Painter to help lay out

the rows and columns. Turn on the Table Painter by choosing Table Painter.

9

The display in the Table Painter does not exactly show what the actual output will be, because

the depth of a table row output depends dynamically on the number of records received from the

application. Instead, the rows displayed in the Table Painter all display the same table depth.

For tables, know that:

• The application data is selected in the application program and transferred to the form using

the form interface.

• In contrast to the template node, the table node has another tab called the Data tab. On this

tab, you enter the internal table whose data is to be output. The data is read to a work area in

row format.

• The table layout is determined using row types (same for templates).

• A header area (for table headers), main area (for items of the table), and footer area (for

whole sums, or similar) are table output areas. Table rows are created as subnodes of these

areas.

Read only

Former Member
0 Likes
1,621

Hi,

Difference with SMARTFORMS vs. SapScript(SE71)

The Following are the differences :-

a) Multiple page formats are possible in smartforms which is not the case in SAPScripts

b) It is possible to have a smartform without a main window .

c) Labels cannot be created in smartforms.

d) Routines can be written in smartforms tool.

e) Smartforms generates a function module when activated.

Hope this is useful...Reward points if helpful..

Thanks,

Ginni

Read only

Former Member
0 Likes
1,621

Hi,

This is a simple smart form to display header and item details.

create a layout in samrtform transaction.

--


Declarations of WORKAREAS AND INTERNAL TABLES--

DATA: it_ekpo TYPE z50889_ekpo_table,

wa_lfa1 TYPE z50889_lfa1,

wa_ekko TYPE z50889_ekko.

DATA:V_NAME TYPE RS38L_FNAM.

----


Declarations of Parameters -

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETER:p_sales TYPE ekko-ebeln.

SELECTION-SCREEN END OF BLOCK b1.

*Fetching data from Purchase Order Header

SELECT SINGLE ebeln

lifnr

FROM ekko

INTO wa_ekko

WHERE ebeln = p_sales.

IF SY-SUBRC <> 0.

MESSAGE E003(Z50850MESSAGE).

ELSE.

*Fetching data from vendor master table

SELECT SINGLE lifnr

land1

name1

ort01

pstlz

regio

FROM lfa1

INTO wa_lfa1

WHERE lifnr = wa_ekko-lifnr.

*Fetching data from Purchase Order Items

SELECT ebeln

ebelp

ematn

bukrs

werks

netwr

FROM ekpo

INTO TABLE it_ekpo

WHERE ebeln = wa_ekko-ebeln.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'Z50889_PO_SMARTFORM'

IMPORTING

FM_NAME = V_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3

.

IF sy-subrc <> 0.

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

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

ENDIF.

***calling function module

  • CALL FUNCTION '/1BCDWB/SF00000723'

  • EXPORTING

  • OUTPUT_OPTIONS = 'X'

  • wa_lfa1 = wa_lfa1

  • wa_ekko = wa_ekko

  • IMPORTING

    • DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO

    • JOB_OUTPUT_INFO = JOB_OUTPUT_INFO

  • JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

  • TABLES

  • it_ekpo = it_ekpo

    • EXCEPTIONS

    • FORMATTING_ERROR = 1

    • INTERNAL_ERROR = 2

    • SEND_ERROR = 3

    • USER_CANCELED = 4

    • OTHERS = 5

  • .

  • IF sy-subrc <> 0.

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

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

  • ENDIF.

**/1BCDWB/SF00000723

CALL FUNCTION V_NAME

EXPORTING

wa_lfa1 = wa_lfa1

wa_ekko = wa_ekko

TABLES

it_ekpo = it_ekpo

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5

.

IF sy-subrc <> 0.

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

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

ENDIF.

Regards,

kavitha.