0% found this document useful (0 votes)
71 views

Smart Forms

The document provides steps to create smart forms in SAP. Key steps include: 1. Enter form name and description, select page format and style. 2. Define import parameters, global data like tables and work areas. 3. Add pages, graphics, windows, and program lines to fetch and display company address and purchase order details from tables. 4. Create a purchase order number loop to display order details in a template with column headings and table.

Uploaded by

ranga
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Smart Forms

The document provides steps to create smart forms in SAP. Key steps include: 1. Enter form name and description, select page format and style. 2. Define import parameters, global data like tables and work areas. 3. Add pages, graphics, windows, and program lines to fetch and display company address and purchase order details from tables. 4. Create a purchase order number loop to display order details in a template with column headings and table.

Uploaded by

ranga
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 83

Proprietary & Confidential

By Nageshwar, Satyam Computers


Smart Forms: Transaction Code for Create Smart Forms: SMARTFORMS Transaction Code for Create Styles (Paragraph Formats, Character Formats, etc.,) Used in Smart Forms: SMARTSTYLES Steps to be followed while creating Smart Forms: 1. Enter the Form Name (e.x. ZEKKO_EKPO) and Press Create Button.

2.

Enter Form Description and Select the Output options Tab Enter the Page Format (e.x. DINA4) and Style (e.x.SF_STYLE_01).

Document1 May 6, 2013

Proprietary & Confidential

3. 4.

Double click the Form interface Left Sub-tree. Enter the Import Parameters (The values that passed from the Print Program into the Form) (e.x. Company Code) Parameter name Type assignment Pass value COMPANY_CODE TYPE Reference type Default value

EKKO-BUKRS

Document1 May 6, 2013

Proprietary & Confidential

5.

Double click the Global definitions from the Left Sub-tree. Assume that we are using two tables EKKO and EKPO in this example:

6. 7.

Click the Types Tab. Enter the Code as following:

Document1 May 6, 2013

Proprietary & Confidential

8.

Click the Global data Tab. Declare the Internal Tables and Work Areas as follows:

Document1 May 6, 2013

Proprietary & Confidential

9.

Double click the %PAGE1 New Page in the Left Sub-tree.

10.

Change the %PAGE1 to FIRST or any name and Enter the Description (e .x. First Page). Select the Next Page as FIRST

11.

Document1 May 6, 2013

Proprietary & Confidential

12.

Select the Output options Tab and select the format of the page (Portrait or Landscape) and all other print attributes.

13.

Select the Background Picture Tab, and Enter the Name, Object and Id of the image file. (Before this step, go to SE78 and import the image first) for the Image which has to be appeared in the Background of the Script. If you want to add any LOGO in the First Page of the Script then right click the FIRST New Page in the Left Sub-tree from the Menu option Create select the Graphic.

14.

Document1 May 6, 2013

Proprietary & Confidential

15. 16.

Double click the %Graphic1 New Graphic 1 in the Left Sub-tree. Give the Name and Description (e.x. Graphic = COMP_LOGO and Description = LOGO WINDOW)for the New Graphic Inserted. Enter Name, Object and ID for the Graphic image and Select the Color grid screen (BCOL) option button in the General attributes Tab.

17.

Click - Output options Tab. Set Left and Upper Margins as given:

Document1 May 6, 2013

Proprietary & Confidential

18.

Right click the FIRST New Page in the Left Sub-tree and from the Menu option Create select the Window.

Double click the %WINDOW1 New Window1 in the Left Sub-tree and enter the Window name and Description (e.x. Window = ADD_WIN and Description = Address Window)

Document1 May 6, 2013

Proprietary & Confidential

Set the Left and Upper margins for the ADD_WIN as follows:

19.

Right click ADD_WIN Address Window in Left Sub-tree and from the Menu option Create select the Program Lines.

Document1 May 6, 2013

Proprietary & Confidential

20.

Enter the Program Lines name and description (e.x. Program Lines = ADD_FETCH and Description = FETCHING COMPANY ADDRESS)

21.

Enter the Input Parameter as COMPANY_CODE and Export Parameter as V_ADRNR in the General attributes Tab and write the select query as following: SELECT SINGLE ADRNR INTO V_ADRNR FROM T001 WHERE BUKRS EQ COMPANY_CODE.

(Note: Before writing the select query first declare the Variable V_ADRNR in the Global definitions area as follows: V_ADRNR TYPE T001-ADRNR.
Document1 May 6, 2013

10

Proprietary & Confidential

22.

Right click the ADD_WIN Address Window in the Left Sub-tree and from the Menu option Create select the Address.

23.

Double click the %ADDRESS1 New address1 and change the Address name and description (e.x. Address = COMP_ADD and Description = COMPANY ADDRESS).

11

Document1 May 6, 2013

Proprietary & Confidential

24.

Select the Type of the address in the General attributes Tab. (Since we are retrieving the Organization address, we selected the first radio button) and in the Address number text box pass the V_ADRNR Variable as &V_ADRNR&. Set the Main window attributes like this: (Setting of window co-ordinates)

25.

12

Document1 May 6, 2013

Proprietary & Confidential

26.

Right click the MAIN Main Window in the Left Sub-tree and from the Menu option Create select the Program Lines.

27.

Enter the name and description (e.x. Program Lines = SELECT_RECORD and Description = SELECTING RECORDS).

13

Document1 May 6, 2013

Proprietary & Confidential

28.

Enter the Input Parameter as COMPANY_CODE and Output Parameter as I_EKKO and I_EKPO in the General attributes Tab and write the select query as following:
SELECT EBELN BUKRS INTO TABLE I_EKKO FROM EKKO UP TO 10 ROWS

14

Document1 May 6, 2013

Proprietary & Confidential

WHERE BUKRS EQ COMPANY_CODE. IF SY-SUBRC EQ 0. SORT I_EKKO BY EBELN. SELECT EBELN EBELP MENGE NETPR INTO TABLE I_EKPO FROM EKPO FOR ALL ENTRIES IN I_EKKO WHERE EBELN EQ I_EKKO-EBELN. IF SY-SUBRC EQ 0. SORT I_EKPO BY EBELN EBELP. ENDIF. ENDIF.

29.

Right click MAIN Main Window in the Left Sub-tree and from the Menu option Create select the Complex Section.

30.

Enter the Section name and description (e.x. Section = PO_LOOP and Description = PURCHASE ORDER NUMBER LOOP) and check the Repeat processing check
Document1 May 6, 2013

15

Proprietary & Confidential

box and select the Output type as Unstructured (i.e. select the Unstructured radio button) in the General attributes Tab.

31. 32.

Select the Data Tab. Enter the Internal Table Name as I_EKKO and Work area name as WA_EKKO and sort by the BUKRS and EBELN fields.

33.

Right click PO_LOOP PURCHASE ORDER NUMBER LOOP in Left Sub-tree and from the Menu option Create select the Text.

16

Document1 May 6, 2013

Proprietary & Confidential

34.

Enter the Text name and description (e.x. Text = PO_NO_DISPLAY and Description = PURCHASE ORDER NUMBER DISPLAY) and enter the values as in the screen shot

17

Document1 May 6, 2013

Proprietary & Confidential

Click the Text Editor

18

Document1 May 6, 2013

Proprietary & Confidential

Display the values of Company Code and Purchase Order Number as shown below:

Press Back Button, then Press Save and Check Buttons

19

Document1 May 6, 2013

Proprietary & Confidential

35.

Right click the PO_LOOP PURCHASE ORDER NUMBER LOOP in the Left Subtree and from the Menu option Create select the Template.

20

Document1 May 6, 2013

Proprietary & Confidential

36.

Double click on %TEMPLATE1 New template and enter the Template name and description (e.x. Template Name = OI_HEAD and Description = ORDER ITEM HEADER).

21

Document1 May 6, 2013

Proprietary & Confidential

Before press save or enter click the Table Painter Button which will take you to following screen. To avoid the cross line in the Editor click the Settings Button

22

Document1 May 6, 2013

Proprietary & Confidential

which will result in the following popup, in which you un-check the Cross Check Box and press enter.

37.

Split the Cell into Four or into any number of columns you want to display in the script by right clicking the %C1. and press Back Button.

23

Document1 May 6, 2013

Proprietary & Confidential

38.

Select the cv cv of the table to be displayed in the script by the clicking Select pattern Button

24

Document1 May 6, 2013

Proprietary & Confidential

Selected table pattern 39. Inorder to Display the Column Text for the table columns, insert the Text as shown below: Right click the OI_HEAD ORDER ITEM HEADER and from the Menu path Create Select the Text .

40.

41.

Enter the Text name and description (e.x. Text = HEAD1 and Description = COLUMN1) and enter the values as in the screen shot (i.e. as explained in the point no 34).

25

Document1 May 6, 2013

Proprietary & Confidential

42.

In order to match the Template Column with the inserted Text HEAD1 COLUMN1, select the Output options Tab and Enter the Line Number and Column Number in which the above Text has to be printed in the form

Repeat Step No.40 & 41 for all the remaining column headings.

26

Document1 May 6, 2013

Proprietary & Confidential

27

Document1 May 6, 2013

Proprietary & Confidential

43.

The Form is ready with all data upto Table Header. Inorder to populate data under each column header, insert a table. Insert the Table under PO_LOOP PURCHASE ORDER NUMBER LOOP by right clicking the same.

44.

28

Document1 May 6, 2013

Proprietary & Confidential

45.

Enter Table Name and Description (e.x. Table Name = OI_DISPLAY and Description = ORDER ITEM DISPLAY)

46.

Match the column width with the OI_HEAD ORDER ITEM HEADER Template (refer step no 38 screet shot no 2) and Select the Default radio button and No page break check box. Click the Select pattern push button to select the table pattern to be displayed.

47.

29

Document1 May 6, 2013

Proprietary & Confidential

Click the Data and populate the Item details by looping the Internal Table I_EKPO into the Work Area WA_EKPO sorted by EBELN and EBELP as shown in the following screen shot

30

Document1 May 6, 2013

Proprietary & Confidential

48.

Inorder to Display the values for each column, we have to Insert Separate Text for each column under the Table OI_DISPLAY ORDER ITEM DISPLAY by Right clicking the same. Enter the Name and Description for the Each Text Inserted under the Table.

Column 1 for Line Item of each Purchase Order Populate the values for each column as explained in the step no 34.

31

Document1 May 6, 2013

Proprietary & Confidential

Inorder to Match the Item values with the Template Header, In the Inserted Text ORD_ITM_COL COLUMN1 Click the Output options and Select the New line Check box and Select the Line type as Detail and also check the New cell Check box.

49.

Similarly add one Text for the remaining columns.

32

Document1 May 6, 2013

Proprietary & Confidential

33

Document1 May 6, 2013

Proprietary & Confidential

For the Third Column Text also You need only to select the New cell Check box.

50.

Before Inserting the 4 Text for the 4 Column, we have to calculate the Amount by Multiplying the Quantity and Unit Price and for the same we have to insert Program Lines by Right clicking OI_DISPLAY ORDER ITEM DISPLAY

th

th

34

Document1 May 6, 2013

Proprietary & Confidential

51.

Similarly calculate the subtotal by adding the totals and calculate the grand total by adding the subtotals. Before doing the calculations, declare variables for total, subtotal and grand total in Global definitions.

InputParameters: WA_EKPO-MENGE,WA_EKPO-NETPR & OutputParameters: V_TOTAL,V_SUBTOTAL, V_GRDTOTAL.

35

Document1 May 6, 2013

Proprietary & Confidential

52.

Now add the 4 Text to display the 4 column in the Form.

th

th

For the Fourth Column Text also You need only to select the New cell Check box.

36

Document1 May 6, 2013

Proprietary & Confidential

53.

In order to display the Subtotals (which has been created earlier i.e. refer to step no 52) of all the Line Items for each Purchase Order, we have to Insert a separate Text Under the Table OI_DISPLAY ORDER ITEM DISPLAY by right clicking the same.

37

Document1 May 6, 2013

Proprietary & Confidential

54.

Enter the Name and Description for the Inserted Text (e.x. Text = SUB_TOTAL_DISPLAY and Description = SUB_TOTAL_DISPLAY and populated the value for subtotal.

38

Document1 May 6, 2013

Proprietary & Confidential

55.

After each purchase order, the Variable V_SUBTOTAL has to be refreshed, In order the clear the subtotal variable we have to insert Program Lines by right clicking the OI_DISPLAY ORDER ITEM DISPLAY.

39

Document1 May 6, 2013

Proprietary & Confidential

40

Document1 May 6, 2013

Proprietary & Confidential

56.

Enter Name and Description for the Program Lines (%CODE1 New program lines 1) Inserted (e.x. Program lines = CLR_VAR and Description = CLEAR SUBTOTAL VARIABLE. Input parameters = V_SUBTOTAL. Clear the variable as shown below:

41

Document1 May 6, 2013

Proprietary & Confidential

57.

Now, we have to display the Grand Total (i.e. summation of all the subtotals). Insert Text under the PO_LOOP PURCHASE ORDER NUMBER LOOP by right clicking the same.

42

Document1 May 6, 2013

Proprietary & Confidential

Text %TEXT1 New text1 gets inserted. Now enter the name and description for the same and also populated the value for grand total

43

Document1 May 6, 2013

Proprietary & Confidential

Text = GRD_TOT_DISP, Description = GRAND TOTAL DISPLAY and Variable V_GRDTOTAL has been populated to display the grand total in the form.

44

Document1 May 6, 2013

Proprietary & Confidential

58.

Inorder to display the Current Page Number and Total Number of pages in the form we need a separate window and to obtain the sa me right click the FIRST First Page and the insert window.

45

Document1 May 6, 2013

Proprietary & Confidential

Window %WINDOW1 New window 1 get inserted under the first page.

46

Document1 May 6, 2013

Proprietary & Confidential

59.

Enter the Window name and description (e.x. Window = PG_WIN and Description PAGE NUMBER WINDOW)

47

Document1 May 6, 2013

Proprietary & Confidential

Set the window co-ordinates for page number window PG_WIN as given below:

48

Document1 May 6, 2013

Proprietary & Confidential

60.

In order to display the page numbers we have to insert a Text by right clicking the PG_WIN PAGE NUMBER WINDOW.

49

Document1 May 6, 2013

Proprietary & Confidential

Text %TEXT1 New text 1 gets inserted and now enter the text name and description.

50

Document1 May 6, 2013

Proprietary & Confidential

Text = PG_DISP, Description = PAGE NUMBER DISPLAY and Page Number gets displayed from the Transparent Table SFSY.

51

Document1 May 6, 2013

Proprietary & Confidential

61.

General Screen Shot of Entire Left Sub-tree:

52

Document1 May 6, 2013

Proprietary & Confidential

62.

Form output:

53

Document1 May 6, 2013

Proprietary & Confidential

63.

SOME MORE FURTHER MODIFICATIONS / ADDITIONAL OPTIONS IN THE ABOVE CREATED FORM: Condition-1: Create second page and company logo should get printed only in the first page and not in the second page. Similarly, company address window should get printed only in the last page and not in other

54

Document1 May 6, 2013

Proprietary & Confidential

pages. To create the second page right click the FIRST First Page in the left sub tree.

64.

Another page gets inserted with name %PAGE1 New page 1.

65.

Enter Page name and description for the inserted new page (e.x. Page = SECOND and Description = Second Page) and set the next page as inserted second page and select the mode as increase counter as shown below:

55

Document1 May 6, 2013

Proprietary & Confidential

66.

Now change the FIRST First Pages Next page as SECOND and change the mode as Initialize counter.

67.

Now copy the Main, Company Address, Page No windows from FIRST First Page to SECOND Second Page.

56

Document1 May 6, 2013

Proprietary & Confidential

68.

Arrange all the windows under the Main window in both first and second page. In order to restrict the company logo to be printed only in the first page, go to the first page and double click the LOGO_WIN LOGO WINDOW and select the Conditions tab and Check the only on first page Check Box.

69.

Output showing the main window got printed only in the first page and not in the second page and so on .

57

Document1 May 6, 2013

Proprietary & Confidential

First Page: With LOGO

58

Document1 May 6, 2013

Proprietary & Confidential

Second Page: Without LOGO

59

Document1 May 6, 2013

Proprietary & Confidential

70. In order to restrict the Company address to be printed only in the last page and not in the remaining pages, double click the ADD_WIN ADDRESS WINDOW in the first page and Check the only after end of main window Check Box. Repeat the same process for the second page also.

60

Document1 May 6, 2013

Proprietary & Confidential

71.

Output showing the address window got printed only in the last page and

61

Document1 May 6, 2013

Proprietary & Confidential

not in the first page and so on . First Page: without company address

62

Document1 May 6, 2013

Proprietary & Confidential

Last page (second page): with company address window

Click here to continue...


Document1 May 6, 2013

63

Proprietary & Confidential

72.

Condition-2: Purchase orders whose value is more than 5000 only should get displayed / printed.

Inorder to achieve the same, right click the PO_LOOP PURCHASE ORDER NUMBER LOOP and select the Loop.

73.

%LOOP1 New loop 1 gets inserted

74.

Enter Loop name and description.

64

Document1 May 6, 2013

Proprietary & Confidential

75.

Select the Data Tab Loop the Internal I_EKPO as shown below:

76.

In order to check the subtotal value for each purchase order (i.e. purchase order value should be more than 5000), Insert a program lines under the new

65

Document1 May 6, 2013

Proprietary & Confidential

loop inserted.

77.

%CODE1 New program lines 1 gets inserted

78.

Enter the name and description for Program lines. Before calculating the subtotal declare two variables one for total and another for subtotal in Global definitions. Calculate the Subtotal as shown below:

66

Document1 May 6, 2013

Proprietary & Confidential

Input parameters: WA_EKPO-MENGE, WA_EKPO-NETPR, V_TOT; Output Parameters: V_VALUE.

79.

Now we calculated the subtotal for each purchase order. Inorder to restrict the display of purchase orders whose values are more than 5000, we need to insert Alternate and for the same right click the PO_LOOP PURCHASE ORDER NUMBER LOOP and from the menu path create select the Alternate.

67

Document1 May 6, 2013

Proprietary & Confidential

80.

%CONDITION1 New alternate 1 gets inserted.

81.

Enter Alternate name and description. Select the General attributes Tab and Enter the condition of subtotal > 5000 as shown:

68

Document1 May 6, 2013

Proprietary & Confidential

82.

Now, move PO_NO_DISPLAY PURCHASE ORDER NUMBER DISPLAY, OI_HEAD ORDER ITEM HEADER, OI_DISPLAY ORDER ITEM DISPLAY, SUB_TOTAL_DISPLAY DISPLAY SUBTOTAL and CLR_VAR New program lines under the TRUE part.

83.

In the FALSE part (i.e. If subtotal value is less than 5000, then clear the variable), insert program lines and code as shown:

69

Document1 May 6, 2013

Proprietary & Confidential

84.

Only those purchase order whose value is more than 5000 gets displayed First Page.

70

Document1 May 6, 2013

Proprietary & Confidential

Only those purchase order whose value is more than 5000 gets displayed Second Page.

71

Document1 May 6, 2013

Proprietary & Confidential

72

Document1 May 6, 2013

Proprietary & Confidential

85.

Condition-3 Each Purchase Order should get printed in a new page. Logo should get printed in the first page along with the first purchase order and similarly, Grand total should get printed in the last page with the last purchase order. Inorder to achieve this, when the first successful purchase order whose value is more than 5000 is found then increase one counter variable by 1 (this is required because the New page command should not get triggered in the first page itself) and for the same we have to insert a Program lines under the TRUE part of CHK_COND SUBTOTAL CONDITION.

86.

Before increasing the counter variable first declare the counter variable in the Global definitions part.

73

Document1 May 6, 2013

Proprietary & Confidential

Output parameters: V_COUNTER.

Click here to continue...

74

Document1 May 6, 2013

Proprietary & Confidential

. 87.

Inorder to avoid triggering New page command in the first page, we have to insert Command in the TRUE part of CHK_COND SUBTOTAL CONDITION by right clicking the same as shown below:

88.

%COMMAND1

New command 1 gets inserted.

89.

Enter name and description for the inserted Alternative. Select General attributes Tab and check whether for the counter variable is more than 1.

75

Document1 May 6, 2013

Proprietary & Confidential

90.

If the counter variable is more than 1 means, we got the second successful purchase order whose value is more than 5000. Hence, we can trigger new page command here and for the same right click the TRUE part in NEW_PG NEW PAGE COMMAND as shown:

%COMMAND1 New command 1 gets inserted

76

Document1 May 6, 2013

Proprietary & Confidential

91.

Enter the name and description for Command and select the General attributes Tab and Check the Go to new page and select the page as SECOND as shown below:

92.

The following is the output: First Page with company logo and without company address window, first purchase order whose value is more than 5000.

77

Document1 May 6, 2013

Proprietary & Confidential

Second page: without company logo and with company address window for the last purchase order whose value is more than 5000.

78

Document1 May 6, 2013

Proprietary & Confidential

93.

The new PROBLEM we faced when we create the smart form is page number. Total Page Number got displayed as * as shown:

79

Document1 May 6, 2013

Proprietary & Confidential

94.

In order to solve the above problem Double Click the PG_DISP PAGE NUMBER DISPLAY and Click the Text Editor.

80

Document1 May 6, 2013

Proprietary & Confidential

Upon clicking the text editor it will take you to the following screen:

Go to the menu path Insert Symbols New as shown

Which will result you in the following popup and fill the popup as shown.

81

Document1 May 6, 2013

Proprietary & Confidential

95.

It will takes you to the following screen.

96.

Now replace &SFSY-FORMPAGES+4(4CZ)& as &SFSY-FORMPAGES+0(4CZ)&

97.

Press back and then check, activate and execute You can observe that the problem has resolved.

82

Document1 May 6, 2013

Proprietary & Confidential

Enjoy and try to create more smart forms..

83

Document1 May 6, 2013

You might also like