Top 45 Sap Smart Forms Interview Questions You Must Prepare 19.Mar.2024

Yes, one can restrict the translations of Smart forms to specific languages by creating a super set of languages for which you want to allow the translations. Go to form Attributes --> General Attributes --> Language Attributes --> Into Selected Language.

Select all the languages for which you want the translation to happen.

Final window is to be used where there is a requirement to show/display details that has to be processed only at the end of the form processing.

The windows in a page are processed from top to bottom. So the execution first skips all the Final windows and completes the processing of other windows. Once all the non-final windows are processed, the Final windows are processed from top to bottom. 

For example if there is a requirement to display the total value of all the items on the first page but the total value is known only at the end of the form processing, we can use the Final window for displaying the total value. The sum of line items is calculated in the MAIN window.

First activate the Smart Form. Go to Environment -> Function Module Name and get the automatically generated function module for the Smart Form.

Following steps needs to be carried out to convert Smart Forms output to PDF:

  • Print the Smart Form to the spool.
  • Note the spool number.
  • Download the PDF file version of the spool by running Program RSTXPDFT4 and entering the noted spool number.

It is possible to create Smartforms without a main window also. In case, confirmation of a mail to client or customer is required there is no need of main window, this can be achieved or done through smartforms without main window.

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.

Auxiliary nodes help to control and format the print but do not print any contents by themselves. Following are the different auxiliary nodes available in Smart Form:

  • Table: Output of a table containing application/dynamic data.
  • Template: output of a table containing static data.
  • Program Lines: Executes ABAP Code.
  • Folder: Combines successor nodes to logical groups.
  • Loop: Processes successor nodes repeatedly.
  • Alternative: Branches depending on conditions.
  • Command: Executes Special Commands.

SAP Smartform is a graphical user interface tool to create and maintain forms. SAP Smart Forms supports printer, fax, e-mail or internet (XML) as its output medium.

SAP Smartform 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.

Transaction Code to create and maintain forms is SMARTFORMS.

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.

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.

The Smart Form that is created in the Development may not have the same name in the Production server. So it is always advised to use the Function Module 'SSF_FUNCTION_MODULE_NAME' to get the Function Module name by passing the Smartform name. 

DATA: fm_name TYPE rs38l_fnam. 
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' 
EXPORTING 
      formname = 'ZSMARTFORM' 
IMPORTING
      fm_name = fm_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. 
CALL FUNCTION fm_name 
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.

Once you transport the Smartform from Development to Production server, a new function module name for the Smartform in generated in the Production server. For a particular Smartform , generated function module names are different in different systems. 

Use SFSY-FORMPAGES to display the total number of pages in the Smartforms 

  • &SFSY-PAGE& : Current page number
  • &SFSY-FORMPAGE& : Total number of pages in the currently formatted layout set
  • &SFSY-JOBPAGE& : Total number of pages in the currently formatted print request
  • &SFSY-COPYCOUNT& : Original-1,1st copy-2
  • &SFSY-DATE& : Date
  • &SFSY-TIME& : Time
  • &SFSY-USERNAME& : Username

It happens when the two printers having different Printer Controls. We can go to SPAD Transaction Menu (Spool Administrator Menu) where we can see the difference in the Printer Control and if we make the Printer control setting for both the printers as same then there would be no difference in the output of characters per inch. Also we will have to check what is the device type used for both the output devices if the issue persist.

First go to SE73 SAP Script Font Maintenance to create or display the system bar codes.

Then go to SMARTSTYLES transaction, create a new character format and assign the barcode name that you have created in it. Then you can use the character format in your Smartform wherever you want the barcode to be displayed.

Once you are done with your translation and you want to push the translation to your target system, you need a transport request. Run the transaction code SLXT or program RS_LXE_RECORD_TORDER for creation of transport request.

At the Page level in Smartforms, you can find something called as Print Mode. Set the Print mode to duplex to print on both sides of the Smartform.

There may not be enough space in the window to display the variable, either increase the window dimensions or condense the spaces using &SFSY-FORMPAGES(C)& or using &SFSY-FORMPAGES(ZC)& or using &SFSY-FORMPAGES(4ZC)&.

Here

  • '4' reserves a four character wide output. (It can be set to any value.)
  • 'Z' eliminates the leading zeroes.
  • 'C' Compress Spaces.

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.

Four Types of windows available in Smart Forms. They are:

  • Main Window
  • Secondary Window
  • Copies Window
  • Final Window

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.

Unlike SAP Scripts, in Smart Forms you can have only one main window. And that too its width should be same in all the pages whereas height can be varied. Only one main window per smartforms is allowed but you can have 99 sub-windows.

Main Window - Smartforms – Only 1

Main Window – SAP Scripts - 99

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.

Various text formatting options available in Smart Forms are:

  • &symbol(Z)& : Omit Leading Zeroes
  • &symbol(S)& : Omit Leading Sign
  • &symbol(<)& : Display Leading Sign to the Left 
  • &symbol(>)& : Display Leading Sign to the Right
  • &symbol(C)& : Compress Spaces
  • &symbol(.N)& : Display up to N decimal places
  • &symbol(T)& : Omit thousands separator
  • &symbol(R)& : Right justified
  • &symbol(I)& : Suppress output of the initial value

By Putting a break point on the generated function module of the Smartform, one can debug it.

Template contains a fixed number of rows and columns, where the output is fixed where as a table can have variable number of rows. Templates are also preferred where there is a need of proper alignment. Templates are used to print tables whose layout and rows are fixed and known before the application program runtime. Example: Tax Forms

Template is a static entity i.e. its dimensions cannot be changed at run time whereas Table is a dynamic entity i.e. its dimensions can be changed at run time. Hence, based on the data, it can last from one page to multiple pages. For line items display, normally table is used because one does not have prior information about the number of line items and no of pages.

Table node has 3 components- HEADER, ITEM and FOOTER

  • The Header component will be executed once.
  • The Item component can be used to process/display table contents.
  • At the end footer will be executed.

Templates can be used to define the following:

  • No. of rows and cell
  • Height of each row
  • Width Of individual cells
  • Separators or frames to be displayed or not
  • Alignment of the table in the window

Tables are used to print dynamic data which is not known before the application program runtime. Example: Material list Of Purchase orders.

Tables node to be used only in main window and no such fixed height can be set for table rows. 

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.

Command Nodes can be used to achieve page break. By using Command Node, one can manually control the numbers of records to be displayed per page based on some condition.

Folder option is useful for placing all the contents into a single place which we call as logical grouping. If we want to put a condition on a group of text elements or templates we can place them in a folder and apply the condition once to the folder. 

Folder option allows you to place all the contents into a single place. This is basically useful when you have number of windows and with each window you have different graphics, texts, tables, templates used. So to differentiate between 2 windows we generally go for folders and place all contents of one window in a folder and wise versa.

Page Protection property of Folder control will be used in order to display text in the same page without separating it into two different pages. If there is not enough space for a text node, or a group of text nodes, a group of table rows, etc. the items will be displayed as a group on the next page with maintaining the integrity of these items. 

In SAP Smartforms documents frequently it is a requirement to print data in same page. For example in a Smart Form table, some of the table rows are required to print in same page together. If the empty space is not enough it is preferred to print those table rows in following page together. In such cases Smartforms Folder control helps ABAP developers creating SAP Smartforms documents. Folder control is the key for page protection in Smartforms.

SAP Smartform Folder control has the Page Protection attribute which can be used by SAP Smart Form developers as a switch for keeping items in the same page.

The function module for Smartform is created when the Smartform is activated. You can find the name of the Function Module for a Smartform by going to Environment --> Function Module Name.

  • 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.

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.

A Text Module acts as some sort of container of text, which makes reuse of text easier. There are texts that frequently appear in different forms. Text Modules can be used to store these texts centrally in the system. This detaches text maintenance from form maintenance, with the result that there will be no need to call the Form Builder to edit individual texts.

Text modules can be maintained using smartforms transaction. The text module is maintained exactly like the Text element. Text literals as well as fields can be written in the text module. Fields of the Text module take values from the Smart Form from which it is called. Since a Text Module is a separate entity, it has its own Management (Attributes) screen.

The main advantages of using a Text module are:

  • Central storage and maintenance of texts: Commonly used texts like Terms and Conditions, Address line on footer, etc. do not have to be typed and maintained on every Smart Form being made. Also, changes made to the text at one place can be cascaded to all Forms where it is used if the Copy option is not used.
  • Language specific maintenance: Text modules can be maintained in different languages. Thus, by referring to the same Text module name, Smart Forms in different languages pick up the text of the corresponding language.
  • Client independence: This is an advantage over Include texts that are client dependent.
  • Can be assigned to CTS: An advantage over Standard Texts that are not assigned to a Transport System by default.
  • Can be translated to other languages through the transaction SE6@

Basically, secondary window is used to display text or data output with a fixed length.

Secondary windows are used when there is a need to display text and data in a predetermined output area. There is no flow text display with page break. 

If we position a secondary window with the same name on several pages, the system displays the contents of this secondary window on each page.

Text & data that do not fit into the secondary window are truncated and not displayed.

In the CALL FUNCTION of the Smartform Function Module (CALL FUNCTION fm_name ), set the output options parameter to set the printer name. The output option is of the type SSFCOMPOP which contains the field TDDEST. Set the TDDEST field to your default printer name.

For Example:

OUTPUT_OPTIONS-TDDEST = 'Printer Name'.

  • 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.

The Page represents the layout of the Page that is printed on and the items to be printed on the Page are contained in Windows. The page together with the windows defined on the page determines how the print will appear and the contents of the print.

In the CALL FUNCTION of the Smartform Function Module (CALL FUNCTION fm_name ), set the Output Options and Control Parameters as mentioned below:

control_options-preview = 'X'. " Print Preview
control_options -no_open = 'X'. 
control_options -no_close = 'X'. 
control_options -no_dialog = 'X'. 
control_options -device = 'PRINTER'. 
output_options-TDDEST = 'PRINTER NAME'. "Spool: Output Device
output_options-TDNOPRINT = 'X'. "No printing from print preview
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
   formname = c_formname
IMPORTING
   fm_name = lf_fm_name
EXCEPTIONS
   no_form = 1
   no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
CALL FUNCTION LF_FM_NAME
EXPORTING
   CONTROL_PARAMETERS = control_options
   OUTPUT_OPTIONS = output_options
EXCEPTIONS 
   FORMATTING_ERROR = 1
   INTERNAL_ERROR = 2
   SEND_ERROR = 3
   USER_CANCELED = 4
   OTHERS = 5.

There are 4 different types of Text available in Smart Forms. They are:

  • Text Element
  • Text Module
  • Include Text
  • Dynamic Text

Form Interface is where we can 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 Definition is where we declare data to be used within the smartform on a global scope i.e. anything we declare here can be used in any other node in the form.

Select the Text Node --> Change Editor --> Go to Menu Option 'Insert' --> Characters --> SAP Symbols.

Choose the SAP symbol that you want to insert.

In smart forms, if you want a user to see the text in other languages (other than language in which smart form is created) , in Global settings ,we need to select radio button Into Selected languages and maintain the Translations in that particular language using SE63.

There is no other way to automate this process but to maintain translations with human intervention for selected languages.

In SE63 transaction, Use path Translations -> ABAP objects -> Other Long Text. Click on Forms and Styles & Select Forms.

Please give object name in CAPITALS. Also select Source and target language from F4 help.

Differences between SAP Scripts and Smart Forms are:

  • Smart Forms are client independent and SAP Scripts are client dependent.
  • Multiple page formats are possible in Smart Forms which is not the case in SAP Scripts.
  • It is possible to have a Smart Form without a main window where as you create a SAP Script without a main window.
  • Smart Forms generates a function module when activated, which is not the case with SAP Scripts.
  • SAP Scripts require a driver program to display the output whereas in Smart Forms the form routines can be written so that it is standalone.
  • An integrated Form Builder helps to design Smart Forms more easily than SAP Scripts.
  • A Table Painter and Smart Styles to assist in building up the Smart Forms which is not available in SAP Scripts.
  • Smart Forms generates XML output which can be viewed through the web.

Basically, we use main window when there is a need to display text or data which can cover several pages. Say there is a requirement to display data of all the rows of a table (a table in which you are not very sure as to how many row it has), in such cases we always use main windows.

As soon as a main window is completely filled with text/data, the system continues to display the text/data in the main window of the next page. It automatically triggers the page break.

Only one window can be defined in a form as main window. The main window can be called in other pages of the form but it must have the same width on each page, but can differ in height.

A page without main window must not call itself as next page, since this would trigger an endless loop. In such a case, the system automatically terminates after three pages.

Basically, Copies Window is a special type of secondary window for making pages as copy or original. This window type is used to output data either on original, or on copies, or both.

In simple words, Copies window is to be used when there is a requirement to print copies of the pages.

Copies window is used to define an output area for the print output, whose content you want to appear either only on the copy or only on the original. This allows you to flag copies as copies when the form is printed.

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.