Академический Документы
Профессиональный Документы
Культура Документы
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).
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
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.
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.