Wednesday

SAP Smart Forms

What is Smartforms ?


SAP Smart Forms are used to create and maintain forms for mass printing in SAP Systems. As an output
medium SAP Smart Forms support a printer, a fax, e-mail. Many a times there is requirement to download
output of SAP Smart Forms in a PDF file.


SAP Smart Forms allow us to execute simple modifications to the form and in the form logic by using simple
graphical tools.  To print a form, we need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, we must only adapt the Smart Form if changes to the form logic are necessary.


Transaction Code of Smartforms is  SMARTFORMS.
When you create a Smart Form, the tree structure of the Form Painter already contains two root nodes:
• Global setting


  • Form Attribute
  • Form Interface
  • Global Definitions
      We can initialize the Local and Global Variable, Tables and types.
In Global Definitions->Global Data,
Variable Name  Type Assignment       Reference Type
ZMARA       TYPE                     ZMARA
ITAB        TYPE STANDARD TABLE OF   ZMARA
WA          TYPE                     ZMARA

Command
Then Right Click the Loop and create a Command. Make the Command (move accordingly).

Loop

In Loop->Data,
Internal table itab into wa.
The settings of Loop->Output options is shown below [Since in the output, we are going to display a box with border].


Table
Right click %Code1 and Create a 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

Global Setting The node Global Settings as well as its three successors Form attributes, Form interface, and Global definitions always exist for any newly created forms.



What is the Main Window in smart forms ? What is the Secondary Window or Variable Window smart froms?

You can identify only one window of a form as main window. You use the main window to spread output over several print pages, which is a prerequisite for printing tables. The output control of the main window triggers an automatic page break as soon as the main window is full, that is as soon as in the main window no space is left for printing outout.

However, the main window "keeps in mind" the exact location at which the output was interrupted. On the next page, the output control resumes printing at exactly this position as soon as in the processing tree the main window is reached again. The subsequent print pages may also include other windows or output areas; they are printed unless a condition suppresses them.
Depending on your needs, it may make sense to use the main window either only on one draft page or on several draft pages.
*Soruce http://help.sap.com/saphelp_nw70/helpdata/en/b1/243fdabeee11d4b633006094192fe3/content.htm




How to import/Export the Value from /to other program?
  We can define the Internal Table and Varriables in Global Setting Section.
How to call the Program?
  For call the Smartforms through se38 Program. 


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.
---Define the table in Smartforms.


Find some more information about this Press Here

No comments:

Followers

DISCLAIMER

All about contents or data or information taken from sap.com or other sap related web sites which are available on the Internet for this BLOG.
If you find any doubts or mistakes please refer the other SAP/ABAP related sites .