9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
HOME ABOUT US CONTACT US
HOME BASICS STATEMENT CONTROL BREAK DATABASE QUERY ADVANCE ABAP DOWNLOAD APPLICATION
SUBSCRIBE
Simple Smart Form LearnSapAbap
8:58 PM YouTube 5K
T-code for smart form is SMARTFORMS. Various business processes need a standard form by which the
business can be run. Example of this kind of form is invoice, purchase orders, sales order details, delivery
notes etc. We see that there are various formats of invoices between various retail shops. It means each and
every organization uses a unique format of forms. Smart Form is one of the tools of SAP which fulfils this
GOOGLE TRANSLATE
requirement. There is another tool for this and that is SAP Script. SAP script was the only one tool before
release 4.6 and now from that release we have two options for the forms. Select Language ▼
In the following example we have demonstrated a simple smart form which prints Purchase Order list based
on the creation date at the selection screen. We can write a complete program inside a smart form. But in this
example we have created a driver program for that.
SEARCH THIS BLOG
Smart form always generates a function module while activating into the system. Now this system generated
function module is dependent on the system. It means if we transport the form into development to quality Search
system then the name of the function module gets changed. So to avoid naming conflict we can produce the
name at run time and then we can call that by a variable. To achieve this we have function module
SSF_FUNCTION_MODULE_NAME. It produces the FM for the form into a variable. After that we call that
variable as FM.
SLIDEBAR
We are passing an internal table from the driver program to the form. To do this we need to create a custom
structure in DDIC. The internal table for the program and smart form will hold this DB structure.
Discover more SAP Database
sap SAP ERP
ABAP for Hana
ABAP Development for SAP HANA
FOLLOW US
[Link] 1/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
3 0 2
5 4
.
4
SUBSCRIBE
The driver program is as follows. Subscribe via Email
Enter email address he Submit
REPORT zsr_test.
TABLES: ekko.
TYPES:
BEGIN OF ty_ekko,
ebeln TYPE ekko-ebeln, POPULAR POSTS
aedat TYPE ekko-aedat,
Parallel Cursor in SAP
END OF ty_ekko.
ABAP | Parallel cursor in
abap | Parallel cursor in
DATA:
sap
wa_ekko TYPE ty_ekko,
it_ekko TYPE TABLE OF ty_ekko, Extra Programs
lw_ekpo TYPE zsr_test,
lt_ekpo TYPE TABLE OF zsr_test,
wa_ekpo TYPE zsr_test,
it_ekpo TYPE TABLE OF zsr_test,
Object Oriented ABAP -
date_low TYPE sy-datum,
Events
date_high TYPE sy-datum.
INITIALIZATION.
How to Display ALV table
SELECT-OPTIONS: s_date FOR ekko-aedat.
as pop up screen | ALV
table | Display ALV output
START-OF-SELECTION.
table.
PERFORM get_po_details.
PERFORM call_smart_form.
*&---------------------------------------------------------------------*
*& Form GET_PO_DETAILS
*&---------------------------------------------------------------------*
PAGEVIEWS PAST WEEK
* text
*----------------------------------------------------------------------*
4 0 5 0
FORM get_po_details .
SELECT ebeln aedat
FROM ekko INTO TABLE it_ekko
WHERE aedat IN s_date.
IF sy-subrc = 0.
date_low = s_date-low.
date_high = s_date-high.
SORT it_ekko BY aedat.
SELECT ebeln ebelp txz01
matnr menge meins
FROM ekpo INTO TABLE lt_ekpo
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln
AND menge NE 0.
IF sy-subrc = 0.
LOOP AT lt_ekpo INTO lw_ekpo.
AT NEW ebeln.
wa_ekpo-ebeln = lw_ekpo-ebeln.
ENDAT.
[Link] 2/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
wa_ekpo-ebelp = lw_ekpo-ebelp.
wa_ekpo-txz01 = lw_ekpo-txz01.
wa_ekpo-menge = lw_ekpo-menge.
wa_ekpo-meins = lw_ekpo-meins.
IF lw_ekpo-matnr IS NOT INITIAL.
wa_ekpo-matnr = lw_ekpo-matnr.
ELSE.
wa_ekpo-matnr = '<Service PO>'.
ENDIF.
APPEND wa_ekpo TO it_ekpo.
CLEAR: wa_ekpo, lw_ekpo.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form CALL_SMART_FORM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM call_smart_form .
DATA: lv_form_name TYPE rs38l_fnam.
IF it_ekpo IS NOT INITIAL.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZTEST'
IMPORTING
fm_name = lv_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CALL FUNCTION lv_form_name
EXPORTING
date_low = date_low
date_high = date_high
TABLES
it_ekpo = it_ekpo
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
ENDIF.
ENDFORM.
Now go to SMARTFORMS and create a simple form step by step. At first we import all the variables, structure
& table into Form Interface.
[Link] 3/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
After that we create the variables, structure or internal tables inside Global Definition.
Now we create the nodes one by one at first page. The first page will contain a header window, main window
& a footer window. The header will be a secondary window which holds the condition of displaying at first
page. The main is the main window which is mandatory for any page. The footer will be the final window which
comes after finishing of every window.
The HEADER Part which holds the Condition - Only first page:
[Link] 4/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
Now create a template by right clicking on the Header Window.
[Link] 5/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
Now we create Logo, Header & body text by right clicking on the template.
Here we have to mention the position in Output Structure. (1,1) means 1st row & 1st column. Similarly (2,1)
means 2nd row & 1st column. Similarly we are creating the following.
[Link] 6/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
The MAIN Part:
In the main part we have to create a table to display item wise PO details.
Table contains a structure which needs to be designed at table painter.
[Link] 7/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
Now table always has a loop so we need to loop into work area in the data section.
The header must come each and every page.
[Link] 8/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
In the main the serial number will not come for different line items of same PO. So we have created code
inside the loop and also we are changing the format of Item numbers.
Based on this condition the text will come.
All of the texts are populated by hard coded text or variable text. Since table contains different variable texts
which are populated by clicking Field List (mark in red) and then drag and drop the particular field.
[Link] 9/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
Now the Total calculation will be done at footer level of the table. This footer will come only at the end of the
table.
In this way we create a table inside the main window. Now it’s time to create a footer window. Right click on
the page and create a window named Footer Window.
The FOOTER Part:
We have created the footer window as a final window.
It has a condition that it will trigger at the last page after the end of main.
[Link] 10/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
We create a template here by which the footer information will be displayed.
Now we create another small window which will display only Page number. The window is at the right last
location of any page. So it will be a Secondary window which contains only one text field.
The page number is populated by system fields. Current page = SFSY-PAGE & Total page = SFSY-
FORMPAGES. Just drag and drop to populate the text.
[Link] 11/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
Now we need to create a second page which holds the copy of Main, Footer & Page number window. If the
line item exceeds the first page then it will come at second page. The main window of second page will start
from the top of the page.
Now execute the report and mention the date range. It will generate the following Smart form.
[Link] 12/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
The output comes by one page. Now we are going to generate more than one page by expanding the date
range.
[Link] 13/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
[Link] 14/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
The problem is that the Footer window always captures a fixed height in every page. We shall sort out this by
next article.
RELATED POSTS
[Link] 15/16
9/26/25, 12:20 AM Simple Smart Form - LearnSapAbap
PREVIOUS NEXT
Smart Forms Dynamic Footer Window
POST A COMMENT
No comments
To leave a comment, click the button below to sign in with Google.
SIGN IN WITH GOOGLE
Discover more Database sap SAP SAP ERP ABAP for Hana
ABAP Development for SAP HANA
RECENT POSTS POPULAR POSTS
ABAP CDS View With Input Parallel Cursor in SAP ABAP |
parameters | Parameters in CDS Parallel cursor in abap | Parallel
Views | CDS View with Parameters cursor in sap
May 01, 2020
Extra Programs
ABAP For Iteration with Where
condition | For Statement with
Where clause | For syntax with
Where condition
Object Oriented ABAP - Events
April 25, 2020
ABAP 7.40 For Iteration Expression |
For Iteration in SAP ABAP | For
Statement in SAP ABAP 7.40 | For
syntax in ABAP
April 19, 2020
CREATED BY SORATEMPLATES | DISTRIBUTED BY GOOYAABI TEMPLATES
[Link] 16/16