Sunteți pe pagina 1din 8

http://wiki.sdn.sap.

com/wiki/display/ABAP/Smart+Forms+FAQ

Smart Forms FAQ

Page restrictions apply Attachments:22 Added by Wenceslaus Gnana, last edited by Sandra Rossi on May 27, 2010 (view change) show comment

Definition of basic elements o How can I insert symbols in Smart Forms?

o o o o o o o o o o o o o

How can I display the total number of pages in Smart Forms? What SFSY system fields are available? Why SFSY-FORMPAGES is output as a star "*" instead of the total number of pages? What are the various text formatting options in Smart Forms? How can I provide a background shading to the table? How to avoid an element to be printed on 2 pages? What is the difference between Template and Table in Smart Forms? Where can I define the paragraph and character format for the Smart Forms? How to print a watermark? How to print barcodes? How is a currency code variable associated to an amount variable? How to draw a single line? How to print Double sided?

Definition of the logic o Where can I provide the input parameters to the Smart Form?

o o o o o

Where can I define my own global types for the Smart Form? Though I declared a global variable, why do I get error variable is not defined? I have created a table node for display. Where can I check the condition which must satisfy to display the table? How to force a page break within a table? How to protect lines against page break?

Execution of Smart forms o How can I make the Smart Forms to choose a printer name by default?

o o o o

How can I make the Smart Forms to display a print preview by default without displaying the popup for print parameters? How to debug Smart Forms? How to get the Smart Form as a PDF? Why there seem to be a difference in the output of characters per inch?

Administration, transport, migration, ... o Why my Smart Form dumps after transporting it to PROD?

o o o

What are the differences between SAPscripts and Smart Forms? Is it possible to migrate SAPscript to Smart Form? Are there demo Smart Forms delivered in SAP system?

Definition of basic elements How can I insert symbols in Smart Forms?


Select the Text node. Change Editor (Click the button above Check near the Editor)

Go to menu Include->Characters->SAP Symbols Choose the SAP symbol that you want to insert.

How can I display the total number of pages in Smart Forms?


Use SFSY-FORMPAGES to display the total number of pages in the Smart Forms &SFSY-PAGE& Current page number

&SFSY-FORMPAGES& Total number of pages in the currently formatted layout set &SFSY-JOBPAGES& Total number of pages in the currently formatted print request

What SFSY system fields are available?


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. See SAP Library - Smart Forms - System Fields &SFSYCOPYCOUNT& &SFSY-DATE& &SFSY-TIME& Displays the date, you determine the display format in the user master record Displays the time of day in the form HH:MM:SS Original-1, first copy-2

&SFSY-USERNAME& Username &SFSYWINDOWNAME& &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 &SFSYFORMPAGES& 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 Contains the name of the current window (string in the Window field)

&SFSY-JOBPAGES& Contains the total page number of all forms in the currently processed print request &SFSY-PAGENAME& Contains the name of the current page (string in the Page field) &SFSYPAGEBREAK& &SFSY-MAINEND& &SFSYEXCEPTION& Is set as soon as processing of the main window on the current page ends 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 >) Is set to 'X' after a page break

etc.

Why SFSY-FORMPAGES is output as a star "*" instead of the total number of pages?
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(3CZ)&, or change the window type to Final.

What are the various text formatting options in Smart Forms?


It's using the SAPscript technology so it's unchanged. For more information, see sap library - sapscript - formatting options. &symbol(Z)& &symbol(S)& &symbol(<)& &symbol(>)& &symbol(C)& Omit Leading Zeros Omit Leading Sign Display Leading Sign to the Left Display Leading Sign to the Right Compress Spaces

&symbol(.N)& Display upto N decimal places &symbol(T)& &symbol(R)& &symbol(I)& Omit thousands separator Right justified Suppress output of the initial value

How can I provide a background shading to the table?


In the Table Painter, you can specify the color and shading for the table lines.

How to avoid an element to be printed on 2 pages?


To define Page Protect for a node go to the Output options and check the Page Protection checkbox.

What is the difference between Template and Table in Smart Forms?


The Template contains a fixed number of rows and columns, where the output is fixed. The Table can have variable number of rows.

Where can I define the paragraph and character format for the Smart Forms?
The paragraph and character format for the Smart Forms can be defined in the transaction SMARTSTYLES

How to print a watermark?


See Background pictures in Smart Forms.

How to print barcodes?


You may use either the old barcode technology which works exactly the same way as for SAPscript forms, or the new barcode technology which is only available for Smart Forms.

How is a currency code variable associated to an amount variable?


See How currency code is determined in Smart Forms for a given amount field

How to draw a single line?


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 "__" across the page and play with the fonts so that it joins each UNDER_SCORE.

How to print Double sided?


Your customer wants your PO Smart Form to be able to print "Terms and Conditions" 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. If for example there was a 3 page PO to be printed, they want 3 pieces of paper, the front side of each to contains the PO information (page 1, 2, and 3) and the back side of each piece of paper to containing the static "Terms & Conditions" information. This can be done by this method: - 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).

Definition of the logic Where can I provide the input parameters to the Smart Form?
The input parameters for the Smart Form can be defined in Global Settings->Form Interface. The Associated Type must be defined in the ABAP Dictionary.

Where can I define my own global types for the Smart Form?
The global types (within the Smart Form) can be defined in Global Settings->Global Definitions->Types The types defined here will be global through the entire Smart Form. Also the form routines can be defined Global Settings->Global Definitions->Form Routines

Though I declared a global variable, why do I get error variable is not defined?
Whenever using the global variables in the Program Lines, you must enter the variable name in Input Parameters of the if you are going to use/read the variable. If you are going to both read/write the variable, enter the same in Output Parameters.

I have created a table node for display. Where can I check the condition which must satisfy to display the table?
The conditions can be defined in the Conditions tab. In Smart Forms all the nodes have a condition tab where you can specify the condition to be satisfied to access the node.

How to force a page break within a table?


Put a Command node inside the table that forces a NEWPAGE on whatever condition you want.

How to protect lines against page break?


You can protect a table line type o Double-click on the Table node and choose the Table tab page, then 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.

You can protect several table line types o Expand the main area of your table node in the navigation tree.

o o

Insert a Folder 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 Folder using Drag Drop. Otherwise, create the table lines as sub nodes of the Folder. Choose the Output Options tab page of the Folder node and set the Page Protection option. All table lines that are in the Folder with the Page Protection option set are output on one page.

The "protection" checkbox can be checked in a Text node which is inside a window or folder, but it can't be checked if it's inside a table node (only possible to protect at line type level, see above) or inside a template node (a template is always protected)

The "protection" checkbox can be checked in any Folder node except the ones inside a Table Line Type node (but you can define a protected folder node in a table above table line type nodes) alternatively in a paragraph format use the Page protection attribute to determine whether or not to display a paragraph completely on one page. Mark it if you want to avoid that a paragraph is split up by a page break. If on the current page (only in the main window) there is not enough space left for the paragraph, the entire paragraph appears on the next page.

Execution of Smart forms How can I make the Smart Forms to choose a printer name by default?
In the CALL FUNCTION of the Smart Form Function Module, set the output options parameter to set the printer name. The output options is of the type SSFCOMPOP which contains the field TDDEST. Set the TDDEST field to your default printer name.

How can I make the Smart Forms to display a print preview by default without displaying the popup for print parameters?
In the SSF_OPEN function module, Set the OUTPUT OPTIONS paramter TDDEST to your printer name. Set the CONTROL PARAMETERS and control parameters as shown below, Set the CONTROL PARAMETERS and control parameters as shown below,

control-preview = 'X'. control-no_open = 'X'. control-no_close = 'X'. control-no_dialog = 'X'. control-device = 'PRINTER'. control_parameters-no_dialog = 'X'. control_parameters-no_open = 'X'. control_parameters-no_close = 'X'. OUTPUT_OPTIONS-TDDEST = 'PRINTER NAME'. OUTPUT_OPTIONS-TDNOPRINT = 'X'.

CALL FUNCTION 'SSF_OPEN'

EXPORTING output_options = output_options

control_parameters = control user_settings EXCEPTIONS formatting_error internal_error send_error user_canceled OTHERS = 1 = 2 = 3 = 4 = 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. How to debug Smart Forms?
By executing the Smart Form in test mode, the function module editor is displayed, and then you may set break-points (do not add neither BREAK-POINT statement nor BREAK as it pollutes the code, and sometimes it is forgotten to be removed). o If you want to debug a particular Smart Form node, insert a "Program Line" node just above, where you enter BREAK yourUserName statement.

You may also run SFTRACE transaction (or SMARTFORM_TRACE in releases before 6.10) to generate a log and activate break-points when abnormal events occur. For more information, see SAP Library - Smart Form Trace.

If you don't know the smart form name, you may add a break point in SSF_FUNCTION_MODULE_NAME function module to get the name. In some situations, break-points many not be reached, in that case read this wiki: ABAP Debugger.

How to get the Smart Form as a PDF?


If you don't want to generate the spool, When you call the smart form, you can request to get the OTF data (GETOTF field of CONTROL_PARAMETERS parameter), then you convert the OTF data using CONVERT_OTF function module. Or you can call RSTXPDFT4 and enter the spool number.

Why there seem to be a difference in the output of characters per inch?


(the distance between characters - 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.

Administration, transport, migration, ... Why my Smart Form dumps after transporting it to PROD?

It works fine in DEV. After transporting it to PROD, there is no Function module generated for this Smart Form. 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 Smart Form name.

DATA: fm_name TYPE rs38l_fnam.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname IMPORTING fm_name EXCEPTIONS no_form = 1 = fm_name = 'ZSMARTFORM'

no_function_module = 2 OTHERS IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. = 3.

CALL FUNCTION fm_name EXCEPTIONS formatting_error = 1 internal_error send_error user_canceled OTHERS IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. What are the differences between SAPscripts and Smart Forms?
See this wiki: Differences between Smart forms and Sap scripts

= 2 = 3 = 4 = 5.

Is it possible to migrate SAPscript to Smart Form?

That's a big effort to migrate a SAPscript to Smart Form, so it's better to analyze and create it from scratch Nethertheless, there's a tool to migrate the layout, it can be accessed from SMARTFORMS transaction. See SAP Library - Smart Forms - Migrating SAPscript Forms You may also migrate SAPscript style to Smart Style without loss from SMARTSTYLES transaction You may mass migrate using SF_MIGRATE program There is also FB_MIGRATE_FORM function module

Are there demo Smart Forms delivered in SAP system?


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

Labels parameters

Labels

Child Pages (20)


Hide Child Pages | View in Hierarchy Assigning a transport request for the translations in Smart Forms Background pictures in Smart Forms Check Box In Smartforms DUPLICATE TO BE DELETED 2 EMPTY - TO BE DELETED 2 How currency code is determined in Smart Forms for a given amount field How to display dynamic address in forms ? How to get static table borders (template)? How to maintain Smartforms in different languages? Importance of the function module SSF_FUNCTION_MODULE_NAME Main window in page 2 Page Break in SMARTFORMS Printing Invoices SMARTFORM BASICS Smartform output as BAR GRAPH Smartform Send via Email Smartform Tricks Smartform with BAR GRAPH To get subtotals on each page in smartforms Unique Driver Program for any smartform of a transaction

Comments (4)

Show Comments

S-ar putea să vă placă și