Вы находитесь на странице: 1из 20

What are Smart Forms.

SAP-Smart Forms are used to create and maintain forms for mass printing in SAP systems. It is possible to embed text, image, tables, barcodes , etc.. Output medium supports printer, fax, email or the internet (xml coding).

Difference between SAP-Scripts and Smart Forms.


Multiple page formats are possible in Smart Forms which is not possible in SAPScripts. Smart Forms are client independent while Scripts are client dependent. It is possible to have a Smart Form without a main window. Smart Forms generates a function module when activated.

Advantages of Smart Forms.


Smart Forms are client independent. Half of the time is required. Easy to use Graphical User Interface (GUI). Less programming effort. Web publishing is possible with the help of XML coding. Easy migration of SAP-Scripts to SAPSmart Forms.

What else is new in Smart Forms?


Easy insertion of company logos etc. Flow logic is represented by a tree structure, in the form of nodes. Thus, change in printing order is easy using node drag & drop. ABAP coding is possible using the Program Lines node. Different page layouts can be used for each page Syntax check for individual nodes.

What can you get form Smart Forms.


In a Smart Form you describe: The layout of your form (element positions on a page) Individual elements you want to display (text, graphics, addresses, tables, and so on) the form logic you use, for example, to read application data from internal tables, to introduce conditions, and to control process flows. a form interface to transfer application data to the form definition

Transaction code for Smart Forms is Smartforms. In the form builder one can describe a smart form by a set of nodes.

Node types When a form is created, the tree structure of the form painter contains two root nodes. Global Settings: The successors of the global settings node are used to maintain form attributes, the form interface and global definitions. Pages and Windows: The successors of the pages and windows node to create the pages of the form, position elements on these pages, and determine the sequence on how to process these created elements.

Different types of nodes that can be created under Pages and Windows are: Page Window Text Graphic Address Template Table Command Loop Alternate Program Lines Folder

Pages and windows are created using the node Pages and windows.
This

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

Enter your text in the free area.

SAVE and Activate the Smart form.

Output after Execution

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

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

There is a function module for accessing Smart Forms from a driver program. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' .

Example task: Create a smart form with this details given below. Fields required- matnr, mbrsh, ntgew Table- MARA In smart forms- add a company logo, and add the companys address to it.

Our first step is to create a Smart Form with companys address and logo.
Go to t.code-Smartforms. In pages and windows create address

Enter a name to the Address and add a short description Save and Activate

Now to add a logo in the same the procedure is as follows. Go to transaction code SE-78 and add a graphic to your system. To implement that graphic to the Smart Forms the steps are as follows Go to pages and windows Right click create graphics.

Use F4 help to fill the fields. Save and Activate

Now smart form is ready. We need to construct a program to call this Smart Form. Program for the Ex.task
TABLES: MARA TYPES: BEGIN OF ty_mat, matnr TYPE matnr, meins TYPE meins, ntgew TYPE ntgew, mbrsh TYPE mbrsh, mtart TYPE mtart, END OF ty_mat. DATA: it_mat TYPE STANDARD TABLE OF ty_mat, wa_mat TYPE ty_mat. DATA: it_mat TYPE STANDARD TABLE OF mara, wa_mat TYPE mara. DATA: matnr TYPE matnr meins TYPE meins, ntgew TYPE ntgew, mbrsh TYPE mbrsh, mtart TYPE mtart. SELECT matnr meins ntgew mbrsh mtart FROM mara INTO TABLE it_mat WHERE matnr IN s_matnr.

SELECT matnr meins ntgew mbrsh mtart FROM mara INTO TABLE it_mat WHERE matnr IN s_matnr

call function 'SSF_FUNCTION_MODULE_NAME' exporting formname = 'ZSMARTFORM ****smart form name that is created. VARIANT ='' DIRECT_CALL ='' IMPORTING ty_mat = it_mat EXCEPTIONS NO_FORM =1 NO_FUNCTION_MODULE =2 OTHERS = 3.

if sy-subrc <> 0. WRITE: / 'ERROR 1'. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. endif.

A function module is generated whenever a Smart Form is activated. This Smart Form could be called from the driver program by calling this function module. But this is not an efficient way of calling Smart Form for the following reason: Whenever a Smart Form is generated, a function module is generated and the naming convention for that Smart Form is done internally by using Number range object or something similar. So when this Smart Form is transported from the development to Quality or Production system, a new function module name is generated according to the number series available in that system. If the above program is transported to either quality or production system, the program might go for a dump as the function module is not available in that system. To handle this situation, we use the function module SSF_FUNCTION_MODULE_NAME to get the name of the function module for a Smart Form dynamically. If the form is not active, the function module SSF_FUNCTION_MODULE_NAME raises the exception NO_FORM.

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' I_EBELN = P_EBELN IMPORTING DOCUMENT_OUTPUT_INFO = JOB_OUTPUT_INFO = JOB_OUTPUT_OPTIONS = TABLES IT_mat = IT_mat 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.

How to migrate to smart forms from scripts.


Go to the SAP Smart Forms initial screen (transaction SMART FORMS). In the Form field enter the name of the Smart Form you want to create. Choose Utilities Migrate SAP script form. The dialog window Migrate SAP script Form appears. Enter the name and the language of the source form (SAP script). Choose Enter. This takes you to the change mode of the SAP Form Builder (If the selected SAP script form does not exist in the selected language, a dialog window appears on which you can select one of the existing languages). Now change the design of the form and of the form logic. To activate the Smart Form choose Activate.

Вам также может понравиться