Top Banner
1. Tcode : SMARTFORMS 2. Give the name of SF - > Create. 3. This screen contains 2 Tabs: i. Global Settings: Contains all form level settings a. Form Attributes : Contains ‘General Attributes’ & ‘Output Options’. In Output Options, v’ve to define Page Format name, Chars. & Lines per inch, Style name, & Output Format(sud b STANDARD OUTPUT). b. Form Interface : Contains local Parameters for the SF. c. Global Definitions : Contains the global variables. The Internal Tables, work areas are defined here. 4. PAGES and WINDOWS : According to SMARTFORM, all data r printed in a window, & all the windows r placed in a Page. A main window is avail by defa. Right click on the main window. A popup will appear. Using this popup, v can create Additional Window, Graphic, Address, Text, Table, Template, Program Flow Logic etc. Each Page is known as a Node. Now dbclick on the %Page---. The flwg win. appears.
16

Documentation - SmartForms.doc

Jun 22, 2015

Download

Documents

Rajesh Nayak

Smartforms
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Documentation - SmartForms.doc

1. Tcode : SMARTFORMS2. Give the name of SF - > Create.

3. This screen contains 2 Tabs: i. Global Settings: Contains all form level settings

a. Form Attributes : Contains ‘General Attributes’ & ‘Output Options’. In Output Options, v’ve to define Page Format name, Chars. & Lines per inch, Style name, & Output Format(sud b STANDARD OUTPUT).

b. Form Interface : Contains local Parameters for the SF.

c. Global Definitions : Contains the global variables. The Internal Tables, work areas are defined here.

4. PAGES and WINDOWS : According to SMARTFORM, all data r printed in a window, & all the windows r placed in a Page. A main window is avail by defa.Right click on the main window. A popup will appear. Using this popup, v can create Additional Window, Graphic, Address, Text, Table, Template, Program Flow Logic etc.

Each Page is known as a Node.Now dbclick on the %Page---. The flwg win. appears.

Page 2: Documentation - SmartForms.doc

This is the Page Layout settings in SF. Here, in General Attributes tab, “NEXT PAGE” – Name of the Next page. The next pages willbe Static in the Processing sequence.

Output Options tab: - It determines the layout of the page.(Page Format, Portrait/Landscape etc.)Background Picture tab: - Used to add picture on the SF layout.

Creating & Using Windows:

By defa, a main window is available. If v need to create the additional windows, Right click on the Main window name, ->Create -> Window. All the windows has the flwg characteristics:

a. General Attributes tab: - Here v’ve to define the win. type. 4 types of Windows available : 1. Copies Window : 2. Final Window :3. Main Window : Set this type is win. is main win.4. Secondary Window : Set this type is win. is sub/secondary win.

Page 3: Documentation - SmartForms.doc

b. Output Options tab :- Here v’ve to define the attributes of the current window.

Left/Upper Margins, sets the left or upper margins of the window. & Sets Height/Width of the win.Lines With : If it’s ticked, an outline will b drawn for that window, in the output.Spacing : draws the outline, with particular no. of spaces from the window.Shading-Color : Fills the background of the windo with a colorSaturation : % of color filling into the window.

c. Conditions tab : is used to set conditions for the current window. The variable / field name, which is used in the Field Name –field, sud already be declared in the Input/Output Parameters boxes of the General Attributes tab.(Mostly, this tab is used only in the Program Lines window , not in the Windows. ) . Comparison Value : If u give a value here, that value is compared from that relevant field(given in Field Name) & displayed the report accordingly.

a. Only on First Page : If it’s ticked, the given condition is applied in the 1st page of the SF output.b. Not on First Page : If it’s ticked, the given condition is not applied in the 1st page of the SF output. But will b applied in the next

pages.c. Only After end of Main Windowd. Only Before End of Main Window

Page 4: Documentation - SmartForms.doc

Creating & Using Addresses in a Window:

To add addresses into a window: Right click on the Window name. Create->Address. The above win. appears. Select the ‘Address Number’ field & select an address. If u run the SF , the address will be printed in that window only.

Creating & Using Texts in a Window:To add texts or fields into one window., RClick on the window name Create->Text. The flwg. window with text will be displayed.

Text Type : 3 Types 1. Text Element 2. Include Text 3. Text Module (This is a predefined texts )

Paragraph window. Here, v can type our Paragraphs. To add a field, Click on Insert Field button & type the reqd. field name as follows : &<fieldname>&.Also, SF’s system fields can b used here. System Fields of Smart FormsField Name Description&SFSY-DATE& Displays the date. You determine the display format in the user master record.&SFSY-TIME& Displays the time of day in the form HH:MM:SS.&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.

Page 5: Documentation - SmartForms.doc

&SFSY-FORMPAGES& 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.

&SFSY-JOBPAGES& Contains the total page number of all forms in the currently processed print request. &SFSY-WINDOWNAME& Contains the name of the current window (string in the Window field)&SFSY-PAGENAME& Contains the name of the current page (string in the Page field)&SFSY-XSF& Smart Forms sets this flag ( SFSY-XSF = 'X' ), if you want to print the form in XSF format or

HTML format. On the Conditions tab of a node, you can use this field to suppress output that is intended only for these output formats (for example, pushbuttons).

&SFSY-COPYCOUNT& Queries whether the original is printed or which number the copy has. COPYCOUNT = 1 : orginal, COPYCOUNT = 2 : first copy; COPYCOUNT = 3: second copy, and so on.

&SFSY-COPYCOUNT0& Queries whether the original is printed or which number the copy has. COPYCOUNT = 0 : orginal, COPYCOUNT = 1 : first copy; COPYCOUNT = 2 : second copy, and so on.

SFSY-SUBRC Return value that you can query in program lines nodes. This enables you to react dynamically to error situations during output. Up to now, this field can be used only for include texts and text modules:

SFSY-SUBRC = 0 :Text module or include text found and printed SFSY-SUBRC = 4 :Text module or include text not found

SFSY-USERNAME Logon name of the user who prints the form.

Note: In a text window the Select query sud not b used.

Eg. Screen:

Creating & Using TABLES in a Window:V use tables line by line (row by row) printing. Steps to create Tables:1. To create table window, first v need a main window, in which the coding (Select qry) sud hv bn applied. Then create a separate

window for the tables. The table window sud b set at the bottom of all the components of Main Window. Ie. in the below shown picture(Picture 1.1),i’m abt to create the table by right clicking on the last component of Main Window(Here, last component is “%TEXT2 New Text”). But for better understanding v create the table in a new window.

Page 6: Documentation - SmartForms.doc

Picture 1.1

2. Change the window name as Table_Window. Then Rclick on that window name. Create->Table.Picture 1.2

3. Now a new table will b created as below(Picture 1.3):

Page 7: Documentation - SmartForms.doc

Picture 1.3:

The table contains Header, Main Area, Footer. 4. In the Table Painter in Table tab , u can increase the number of table columns , by choosing “Details” button. The screen will b appeared like this:

Pic 1.4:If u want to create many columns in the table u can add a new line type in this Line Type column, & can specify the column width of this line. The line type to describe the following attributes of a table line:

The width of the table line The number and width of individual cells within the table line

In Pic 1.5: I’ve created 3 line types.Pic 1.5:5. Now click on Table Painter button. The windo wud like this.

Page 8: Documentation - SmartForms.doc

Pic 1.6:

6. Now v’ve to get the data using the Loop. To do this, click the “Data” tab. U’ll get the below window.

Pic 1.7:

Here, in the 1st column of the Operand, give the Internal table name & in the 2nd input column give the work area name. As given below.

Page 9: Documentation - SmartForms.doc

Pic 1.8:(I’ve given the Internal table name as IT. It sud b defined in the Global Definitions. In Global Definitions give the variable name as ‘IT’, for eg., & in the Associated Type sud b a Table Type(A table type is a type that describes the structure and functions of an internal table in the ABAP program). In this eg., the table type is “ZSK_TAB_MATL”. The ‘Line Type’ of this table type sud b a structure. The purpose to define like this is, to define Internal Tables in SF, its associated type sud be a Table Type(To create a Table Type, SE11->DataType (give a new name)-> Create. Now v’ve to assign a Line(Row) Type, that sud b a structure) I’ve assigned the Line Type for this Table Type as the Structure “ZSK_STRUC1”.So that in Global Definitions, I’ve give the Associated Type as “ZSK_TAB_MATL” for the Internal Table variable name “IT”)

Pic 1.9:(Also, v’ve to create a work area, to fetch the data from the Internal Table variable name. To assign the Associated Type for that Work area variable name , v can assign same structure name, which is used by the Associate Type of the Internal table variable name. Here, I’ve defined the work area name as “WA_MARA” & its Associated Type as “ZSK_STRUC1”, which is a structure.)

So that, as per in PIC 1.8: in Operand fields I’ve given ‘IT’ into ‘WA_MARA’. So that while processing the SF, the fields, said in the Select qry, is fetched by internal table IT & stored in the w.a. ‘WA_MARA’.

7. Now v’ve to Print the data in the Table. To do that, do the flwg.:

In a table thr r 3 attributes: 1. Header(here, the headings sud b printed) 2. Main Area(data r printed) 3. Footer (Bottom dtls r printed)Here, I’m going to print the Material Number & Name, 1st I’ve to define the Heading.

Page 10: Documentation - SmartForms.doc

8. Rclick on the Header. Create->Table Line. The flwg will get:Pic 1.10:In this window , 1st v’ve to define the Row & its Line Type. Give the Line Type as ‘Header_Line’, what v’ve created in Table tab.

9. Next, v’ve to set the heading, to do it: Rclick on ‘%CELL1 New Column 1’ -> Create-> Text. Here v can type our First heading, as its Header.

Pic 1.11:

10. Next, Rclick on “MAIN AREA”, now v’ve to give the data. Now “%Row2 New Line2” will appear. Give its line type as Detail_Line. Next to this, as said in 9, Rclick on ‘%CELL1 New Column 1’ -> Create-> Text. The flwg win get.

Page 11: Documentation - SmartForms.doc

Pic 1.12:V’ve to give the field name, In the right side window, by clicking the Insert Field button. A window as shown in Pic 1.13, will appear.In this window type ur field name in the flwg format:

&<wa>-<fieldname>&and press enter. Now, the field name will b displayed in the Text window.

Pic.1.13.

11. If u want to print anything , in the bottom of the table, u can give it in the Footer.12. Next , If u want to add another column , click on ‘%TABLE1 New Table 1’ . Now the window , as said in, PIC 1.6 , will displays.13. Click on Details button. The flwg win appears:

Page 12: Documentation - SmartForms.doc

Pic 1.14.Here, in LineType table, 1 is the first column, 2 is the second column, & so on. Here, v’ve assigned the UOM for the each line types. For eg., For the Line Type ‘HEADER_LINE’, v’ve assign 6.63 CM. So, 6.63 CM has bn assigned for HEADER_LINE contents.Same like this, v’ve to assign for the rest of the line types. If u need to add second column to that table, Just give the width of that column in each line type. For eg., I want to add another column for my table. So I gave 7.67CM in the column no ‘2.’. So that the 2nd column contents will be printed in the 7.67cm width.

Note: The width of all columns, sud b equal to the Table Width (It can be defined in the TABLE WIDTH input column, here, Table Width is 14.30).

Looping & Internal Tables in a Window:

As v already hv seen the Loops in SF, Let’s go for the ‘Program Lines’ option.1. Right Click on the Window name.

Create-> Flow Logic-> Program Lines. The flwg win appears. In this window only , v can apply the Select qry.

Page 13: Documentation - SmartForms.doc

Pic 2.1:This win contains Input / Output Parameters.In the Input Parameters pane, give the parameter which will be used in Select qry. These Input Parameters is same like the SELECT-OPTIONS or PARAMETERS in ABAP. For eg., in Pic 2.2 has given as Input Para., & used in the WHERE cond. of Select qry.Output Parameters: here , v’ve to define what is the output given by the Select qry. For eg., in Pic 2.2, the Select qry gives the internal table – IT, as output. So, IT is defined as Output Parametes.

Pic 2.2:

Finally Save & Activate ur S.Form. Now v’ve to write a program to access this SF. From that prgm , v can access this SF, using a Fun. mod. Each SF is saved as a FM. This FM can b identified by Environment->Function Module Name.

Calling Program for SF:

Page 14: Documentation - SmartForms.doc

TABLES : mara.

DATA : err_msg(80) TYPE c, control_para TYPE ssfctrlop.

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.PARAMETERS : pr_matnr TYPE mara-matnr.SELECTION-SCREEN : END OF BLOCK b1.

START-OF-SELECTION.

SELECT SINGLE matnr FROM mara INTO mara WHERE matnr EQ pr_matnr. IF sy-subrc <> 0. MESSAGE e000(zprecot) WITH 'No data found for the billing document'. ENDIF.

CALL FUNCTION '/1BCDWB/SF00000119' <= This is the SF’s FM. EXPORTING* ARCHIVE_INDEX =* ARCHIVE_INDEX_TAB =* ARCHIVE_PARAMETERS =* CONTROL_PARAMETERS =* MAIL_APPL_OBJ =* MAIL_RECIPIENT =* MAIL_SENDER =* OUTPUT_OPTIONS =* USER_SETTINGS = 'X' pr_matnr = PR_MATNR* IMPORTING* DOCUMENT_OUTPUT_INFO =* JOB_OUTPUT_INFO =* JOB_OUTPUT_OPTIONS =* 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.

--*--*--*--*---*--*--*----*--*--*--*---*--*--*----*--*--*--*---*--*--*----*--*--*--*---*--*--*----*--*--*--*---*--*--*----*--*--*--*---*--*--*--