Creating A Smart Form
Creating A Smart Form
Creating A Smart Form
Input
MAKT-MATNR
Output
MAKT-MATNR
MAKT-MAKTX
Steps
Go to transaction ‘SE11’. Choose ‘Data type’ and enter a name (‘ZMAKT’) for the
structure and click on ‘Create’ button.
Step 2:
Go to transaction ‘SE11’. Choose ‘Data type’ and enter a name (‘ZMAKT_TBL’\’) for the
structure and click on ‘Create’ button. Choose ‘Table type’ in the create type pop up.
Step 5:
Enter a short description and select the line type as ‘ZMAKT’. Save and activate the
table type.
Step 6:
Step 7:
Choose ‘Form’ option and enter a form name to create (z/y *) and click on ‘Create’
button.
Step 3:
Enter the ‘Meaning’ for the form and click on Save in the tool bar (Select ‘Local Object’
while saving).
Step 4:
Step 7:
A table with three sections Header, Main Area and Footer is created.
In the table painter, draw the lines and columns required. A default line type %LTYPE1
will be available. We can use the same line or create further line types. Create columns
in the line by drawing vertical lines in the line. We can create as many columns as
possible. Save the changes made to the table layout.
In the ‘Data’ tab, specify the internal table and work area to be used for data display. You
can also specify where conditions for filtering and sorting criteria.
Step 9: Create table line.
Right click on the ‘Header’ section and create a table line. Choose the line type as
%LTYPE1.
On selection of the line type, the cells corresponding to the line type will be created in
the ‘Header’ section
Step 11: Enter the text as ‘Material Number’ in the ‘General Attributes’ tab and save.
You can also to the editor and specify some paragraph formats created from ‘Smart
styles’ (which will be explained later) for the text.
Step 12:
Similarly create a text element for %CELL2 and enter the text ‘Material Description’ and
Save.
Step 13:
Create a table line in the ‘Main Area’ section also choosing the line type as %LTYPE1
Also create text elements for each cell.
In the text element of %CELL1, type the following text in the editor.
&GS_MAKT-MATNR&
Similarly in the text element of %CELL2, type the following text in the editor.
&GS_MAKT-MAKTX&
Create a text element on the Footer window and the enter the text ‘Printer by TCS’
Step 16:
Click on ‘Form Painter’ button and align the window positions in the page.
Step 17:
Step 18:
Step 1:
Step 3:
Step 4:
Query the MAKT table with the select option material number range as input and put in
the internal table.
Step 5:
Call the function module which is generated from the smart form by passing the internal
table as an exporting parameter.
Driver Program:
*&---------------------------------------------------------------------*
*& Report Z_SF_EX1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT z_sf_ex1.
************************************************************************
* Data declarations
************************************************************************
DATA gv_matnr TYPE matnr.
************************************************************************
* Internal table declarations
************************************************************************
************************************************************************
* SELECTION SCREEN
************************************************************************
************************************************************************
* START-OF-SELECTION
************************************************************************
START-OF-SELECTION.
SELECT matnr
maktx
FROM makt
INTO TABLE gt_makt
WHERE matnr IN so_matnr.
IF sy-subrc EQ 0.
* 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.
ENDIF.
ENDIF.
Selection Screen:
Print preview of the smart form: