SmartForm Using Template – Practical 2

Creating a Smartform for displaying multiple line items

SmartForm Using Template

Free SAP ABAP Course

SAP ABAP Fundamentals

SAP ABAP Interview Questions – Real Time

Step 1: Go to t-code “SMARTFORMS” enter the form name and click on Create.

Step 2: In Form Attributes, enter the description of the form.

Step 3: Now double click on Global Definitions on the left panel, click on Global Data Tab and enter the variable names with their respective types.

Step 4: Now click on the Types tab and create a user-defined structure of table VBAP.

Step 5: Now double click on Page and change the Page name and description.

Step 6: Click on the down arrow beside the Page folder, Main Window will show. Right-click on Main Window: Create -> Template.

Step 7: Double click on the template. Change the name of the template and description. Click on Pencil icon and draw the number of columns in %C1.

Step 8: After creating the number of columns, click on the Details button.

Step 9: Now here adjust the height and width of the column according to your convenience.

Step 10: After adjusting columns click on the Table Painter button to come back. Now click on the button “Select Pattern..”.

Step 11: A pop-up will display and select a pattern of the template without the border if you want to select a pattern with a border click on Display Framed Pattern.


Step 12: Right click on Template: Create -> Text.

Step 13: Double click on Text and change its name and description and write the text in the Editor.
Do the same thing and create four more texts under the same template.

Step 14: Now click on the Output Options tab and set the position of the text by allotting column numbers and row numbers under Output Structure.

Step 15: Right click on Main Window: Create -> Flow Logic -> Program Lines.
Now double click on Program Lines and change the name and description of program lines
and enter the SQL code to fetch the data.

Step 16: Right click on Main Window: Create -> Flow Logic ->Loop.
Double click on Loop and change the name and description of it and Loop the internal table: IT_VBAP into work area: WA_VBAP.

Step 17: Now right-click on Loop: Create -> Template. Change the name and description of the template as before.

Step 18: Select the Pencil icon and create 5 columns as before for displaying the data here.

Step 19: Click on Details and set the height and width of the columns.

Step 20: Now Right-click on Template: Create -> Text. Change the name and description of the Text. Click on the Insert Field button to enter the variable on the page.

Step 21: Enter the Work area and field as given below. Do the same step for the other 4 columns.

Step 22: Save and activate the Smartform. Click on the Test button.

Step 23: A new screen will open and again click on Test Button.

Step 24: Another screen will open and click on Execute button.

Step 25: A new pop-up will display, give the Output Device name and click on the Print Preview button.