1 of 32

SMART FORMS

© 2009 Wipro Ltd - Confidential

2 of 32

Agenda

3

4

Global definition and Program lines

1

Smartform Creation

2

Graphics in Smartform

Form interface in Smartform

5

Tables in SMARTFORMS

© 2009 Wipro Ltd - Confidential

2

© 2009 Wipro Ltd - Confidential

2

3 of 32

SMARTFORM PROGRAMMING

© 2009 Wipro Ltd - Confidential

3

4 of 32

SMARTFORM

  • SAP Smart Forms offer the following advantages:

> Creating and maintaining forms requiring half the time

> Adapting forms without any programming knowledge due to

entirely graphical user interface

> Web Publishing using the generated XML output

  • Transaction Code for Creating SMARTFORMS is �SMARTFORMS

  • Transaction Code for Create Styles (Paragraph Formats, Character Formats, etc.,) Used in Smart Forms: SMARTSTYLES 

© 2009 Wipro Ltd - Confidential

4

© 2009 Wipro Ltd - Confidential

4

5 of 32

SMARTFORMS PROGRAMMING

Go to transaction “Smartforms”.  

Enter a name for the form and click on Create.  

Enter a short description for the form. 

© 2009 Wipro Ltd - Confidential

5

© 2009 Wipro Ltd - Confidential

5

6 of 32

SMARTFORMS PROGRAMMING

In this example, we will print a simple text using our form. To create a text, expand “Pages and Windows” 🡪 New Page. Select Main Window and Right click on that. Select Create 🡪 Text

Give a name to the text and short description. 

Also enter the text you want to see on the form. 

© 2009 Wipro Ltd - Confidential

6

© 2009 Wipro Ltd - Confidential

6

7 of 32

SMARTFORMS PROGRAMMING

SAVE and Activate the Smart form. 

To know the function module that is generated upon activation of this smart form, click on Environment 🡪 Function module name. 

Following popup with the function module would appear. 

© 2009 Wipro Ltd - Confidential

7

© 2009 Wipro Ltd - Confidential

7

8 of 32

SMARTFORMS PROGRAMMING

Test the smart form by clicking on Test. You would be navigated to the function builder with the function module defaulting to the one that is generated earlier. 

Click on execute.

© 2009 Wipro Ltd - Confidential

8

© 2009 Wipro Ltd - Confidential

8

9 of 32

SMARTFORMS PROGRAMMING

Since we do not have any parameters to pass on, click on Execute. 

© 2009 Wipro Ltd - Confidential

9

© 2009 Wipro Ltd - Confidential

9

10 of 32

SMARTFORMS PROGRAMMING

Go to transaction “Smartforms”.  

Enter a name for the form and click on Create.  

Enter a short description for the form. 

© 2009 Wipro Ltd - Confidential

10

© 2009 Wipro Ltd - Confidential

10

11 of 32

SMARTFORMS PROGRAMMING

Expand “Pages and Windows” and click on “%PAGE1”. Rename the page

to your needs and add a short description to the same.

To display the address on the form, right click on “Main Window”, select Create 🡪 Address

© 2009 Wipro Ltd - Confidential

11

© 2009 Wipro Ltd - Confidential

11

12 of 32

SMARTFORMS PROGRAMMING

Following screen appears. 

Enter a name to the Address and add a short description for the same. 

You all might be aware that Addresses are stored in the table ADRC. Now pick an address number from that table, add provide the same in the “Address Number” as shown below:

© 2009 Wipro Ltd - Confidential

12

© 2009 Wipro Ltd - Confidential

12

13 of 32

SMARTFORMS PROGRAMMING

Save and Activate the form. 

Now execute the Smart form. The output would be similar as shown below:  

© 2009 Wipro Ltd - Confidential

13

© 2009 Wipro Ltd - Confidential

13

14 of 32

SMARTFORMS PROGRAMMING

Go to transaction SE78 (Administration of Form Graphics). 

        

Double-click on “GRAPHICS” node and click on “Import (F5)” to import the image. 

        

© 2009 Wipro Ltd - Confidential

14

© 2009 Wipro Ltd - Confidential

14

15 of 32

SMARTFORMS PROGRAMMING

Select the file name by using the F4 functionality available. Name your graphic and enter a short description. If you have color image, select the radio button “Color Bitmap image”. Click on tick mark to proceed. 

The graphic is imported and is stored

in “Business Document Server”. 

You can test this by selecting print

preview:

             

© 2009 Wipro Ltd - Confidential

15

© 2009 Wipro Ltd - Confidential

15

16 of 32

SMARTFORMS PROGRAMMING

Now go to transaction SMARTFORM. 

Create a new form and give a short description for the same.

© 2009 Wipro Ltd - Confidential

16

© 2009 Wipro Ltd - Confidential

16

17 of 32

SMARTFORMS PROGRAMMING

To display an image, right click on Main Window 🡪 Create 🡪 Graphic

© 2009 Wipro Ltd - Confidential

17

© 2009 Wipro Ltd - Confidential

17

18 of 32

SMARTFORMS PROGRAMMING

Use F4 help to fill the fields.

Save and activate the workflow. 

Test run the smart form, to check the appearance of the graphic.

© 2009 Wipro Ltd - Confidential

18

© 2009 Wipro Ltd - Confidential

18

19 of 32

SMARTFORMS PROGRAMMING

Scenario: Let us take a simple scenario of passing Material Number and Material description from Driver program to the Smart Form. 

Go to transaction SMARTFORMS and create a Smart Form. 

To pass the values from the driver program to Smart Form, we need to define the form interface with the parameters to be passed on. 

Click on Global Settings 🡪 Form Interface. 

© 2009 Wipro Ltd - Confidential

19

© 2009 Wipro Ltd - Confidential

19

20 of 32

SMARTFORMS PROGRAMMING

Now define the import parameters for MATNR and MAKTX (From table MAKT) 

Now create a Text in the Main window to display the above two parameters.

To add a field, we need to click on “Insert Field”. 

                                      

© 2009 Wipro Ltd - Confidential

20

© 2009 Wipro Ltd - Confidential

20

21 of 32

SMARTFORMS PROGRAMMING

Enter the field names between the ‘&’ (Ampersand) as shown below:

Similarly create for Description. 

© 2009 Wipro Ltd - Confidential

21

© 2009 Wipro Ltd - Confidential

21

22 of 32

SMARTFORMS PROGRAMMING

Save and Activate the Smart Form. Test run the Smart Form by clicking on Execute.

Enter the values as shown below and click on execute. 

  

© 2009 Wipro Ltd - Confidential

22

© 2009 Wipro Ltd - Confidential

22

23 of 32

SMARTFORMS PROGRAMMING

Scenario: To calculate the total seats available using the values “Maximum seats available” and the “Occupied seats”. In this case, we would be defining Maximum Seats and Occupied Seats in the form interface and Seats Available in the Global definitions. We would write some code to calculate Seats available and then print the same.  

Procedure: Create a new smart form and, in the Form Interface, define the following two fields:

Now click on “Global definitions” :

© 2009 Wipro Ltd - Confidential

23

© 2009 Wipro Ltd - Confidential

23

24 of 32

SMARTFORMS PROGRAMMING

Now define a variable, SEATS_AVAIL

Now to calculate Seats Available, select Main Window 🡪 Create 🡪 Flow Logic 🡪 Program Lines

© 2009 Wipro Ltd - Confidential

24

© 2009 Wipro Ltd - Confidential

24

25 of 32

SMARTFORMS PROGRAMMING

Now mention the input parameters as SEATS_MAX and SEATS_OCC and the output parameter as SEATS_AVAIL. Write the code to calculate SEATS_AVAIL. 

Now to print these values on the layout, create a text by selecting Main Window 🡪 Create 🡪 Text:

© 2009 Wipro Ltd - Confidential

25

© 2009 Wipro Ltd - Confidential

25

26 of 32

SMARTFORMS PROGRAMMING

Save and do the syntax check. Activate the Smart Form. 

Test the smart form by clicking on F8. Enter some values for max_seats and avail_seats 

Execute the function module. 

© 2009 Wipro Ltd - Confidential

26

© 2009 Wipro Ltd - Confidential

26

27 of 32

Step1: T-code for smart forms is “SMARTFORMS”. Provide the name of the smart form.

Tables in SMARTFORMS

And provide the short text for this smart form “YDEMO_TABLE”. 

Step2: Now go to Global definitions where we can define the Global data, Types, Initialization and etc.

Define Structure using Types Parameter as shown below. In Types parameters we usually define user defined data types. 

© 2009 Wipro Ltd - Confidential

27

© 2009 Wipro Ltd - Confidential

27

28 of 32

Step3: Now define the internal table and work area in Global Data parameter

Step4: In Initialization parameter, we can write a code as shown below. We have to mention the output result in the output parameter so that we can use it further. Here in this case we are outputting IT_TAB and we are going to use this IT_TAB further in the Table painter. 

Tables in SMARTFORMS

© 2009 Wipro Ltd - Confidential

28

© 2009 Wipro Ltd - Confidential

28

29 of 32

Step5: Now we create a Table painter as shown below. 

Tables in SMARTFORMS

© 2009 Wipro Ltd - Confidential

29

© 2009 Wipro Ltd - Confidential

29

30 of 32

Step6: Now we define number of table columns in %LTYPE1. Here, %LTYPE1 is renamed as LINE as shown below. 

Here, in this scenario we have to divide the LINE area into 4 columns as we have to display 5 columns. To draw a line we have to select Draw lines and columns button as shown above. 

Step7: Now we have to create Table line for Header and Main area of Table painter as shown below. 

Tables in SMARTFORMS

© 2009 Wipro Ltd - Confidential

30

© 2009 Wipro Ltd - Confidential

30

31 of 32

Here we have to provide line type. Here, the line type is LINE. 

Step8: Provide the text for all columns. 

Step9: Repeat the same process to the Main Area too. 

Step10: Now Loop the internal table data as shown below. 

Tables in SMARTFORMS

© 2009 Wipro Ltd - Confidential

31

© 2009 Wipro Ltd - Confidential

31

32 of 32

Step11: Save and activate the smart form. Execute the smart form now. The output is as shown below.

Tables in SMARTFORMS

© 2009 Wipro Ltd - Confidential

32

© 2009 Wipro Ltd - Confidential

32