100% found this document useful (2 votes)
368 views32 pages

SmartForms - Conceptual

SmartForms - Conceptual

Uploaded by

Yong Benedict
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
368 views32 pages

SmartForms - Conceptual

SmartForms - Conceptual

Uploaded by

Yong Benedict
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 32

SmartForm Introduction

Summary
This document provides an introductory and practical overview of SAP SmartForm. It documents the
SmartForm Development Cycle with working examples.

Perquisites:
Basic SAP ABAP knowledge is required. SAP terminologies and jargons are applied for brevity.

Disclaimers:
Although the author and publisher have made every reasonable attempt to achieve complete accuracy of the
content, they assume no responsibility for errors or omissions. You should use this information as you see fit,
and at your own risk.
This publication is not affiliated with, sponsored by, or approved by SAP. Any trademarks, service marks,
product names or named features are assumed to be the property of their respective owners, and are used
only for reference.

1
SAP SmartForm

Table of Contents
Overview........................................................................................................................................................... 3
SmartForm Cycle.......................................................................................................................................... 5
Form Development Planning......................................................................................................................... 6
Development..................................................................................................................................................... 7
Requirement Scenario................................................................................................................................... 7
Data Sourcing: entry list table........................................................................................................................ 8
Form Layout: entry list table........................................................................................................................ 10
Form Result: putting it all together............................................................................................................... 21
Further Enhancement..................................................................................................................................... 23
Data Sourcing: record summary.................................................................................................................. 24
Form Layout: record summary.................................................................................................................... 25
Form Result: putting it all together............................................................................................................... 25
Logo Upload: logo inclusion........................................................................................................................ 26
Logo UI: logo inclusion................................................................................................................................ 27
Form Result: putting it all together............................................................................................................... 28
Appendix......................................................................................................................................................... 29
Conclusion...................................................................................................................................................... 30
Author Bio....................................................................................................................................................... 31
Reference....................................................................................................................................................... 32

2
SAP SmartForm

Overview
SmartForm is an SAP technology for printed form. In business, it is necessary to issue formal printed form or
pdf documentations. These documents include PO, GR note, Picking note, Loading note, Invoice copy,
Barcode printing and Cheque printing.

Here is an illustrative form output:

3
SAP SmartForm

SmartForm is the successor of the earlier SAP SAPScript technology. As much as plenty of SAP forms are
still in SAPScript format, there are modern requirements that SAPScript cannot fulfil – for instance, color/font
support, multi-paging support and web/xml support. SmartForm is a program at the backend (client-
independent), this enables much more development versatility (such as in-line coding). However,
SmartForms are developed using an GUI editor which makes much easier and intuitive to use (I guess it
makes sense to use GUI editor to develop graphical output).

Once a SmartForm is created, any program can use it - provided it can give the required interface data.
For example below: the form ‘ZTEST_FORM1’ needs an import data of ‘IT_BSEG’ which is an array of lines.
The structure of IT_BSEG will depends on the system definition of the standard SAP structure BSEG_T.

4
SAP SmartForm

SmartForm Cycle
SmartForm development comprises of at least two steps: Data Sourcing and Form Layout.
 Data Sourcing refers to defining the form attributes (e.g. languages, print format), form interface
(i.e. incoming data) and global definition (i.e. global variable declarations).

 Form Layout refers to the creation of UI (user interface) controls/components and its output (i.e.
display)

 UI controls available includes text labels, tables, addresses, graphics, and extended
windows.
 UI flow-logics available includes alternative, loop, program routine, and page command.
Alternative refers to conditional flow. Loop refers to iterative flow. Program routine is small
in-line routines. Page command allows switching of various page format based on certain
conditions.

5
SAP SmartForm

Form Development Planning

Our approach on the sample walk-through will come in two parts:


 Firstly, going through an example on putting a table in the form, and have it printed out.

 Secondly, enhancing the form further with label descriptions and a company logo.

6
SAP SmartForm

Development
Requirement Scenario
To display list of FI document lines in a tabular format, showing the Document Number, GL Account, Posting
Key and Amount (Ccy).
Document Number GL Account Posting Key Amount (Ccy)

#2600000000 430100 09 1,000.00 MYR

#2600000001 430100 19 1,000.00 MYR

Technically, to map the above table to SmartForm UI table control, we will need to define two ‘Line Type’
structure (this represents the column layout structure).
 Line Type1 (LType1) will be used for header; and have four columns (i.e. Document Number, GL
Account, Posting Key, Amount).
 Line Type2 (LType2) will be used for items; and five columns (i.e. Document Number, GL Account,
Posting Key, Amount, Currency).

LType1 Document GL Account Posting Key Amount (Ccy)


Number

LType2 Data field Data field Data field Data field Data field
name: name: name: name: name:

BSEG-BELNR BSEG-HKONT BSEG-BSCHL BSEG-DMBTR BSEG-PSWSL

Within SmartForms Editor, SmartForm UI table control is edited by ‘Table Editor’.

Below is the planned definition of the UI column structure.

7
SAP SmartForm

Data Sourcing: entry list table


The transaction to access SmartForms Editor is ‘smartforms’

In the form interface, we can input what is required by the smart form to run (i.e. the import parameter).

8
SAP SmartForm

In the global definition, we can declare global variables for usage.

For currency/quantity related field that we wished to display, we need to specify at global definition.

9
SAP SmartForm

Form Layout: entry list table


To create the UI table control, we have to call up “create/table” context menu (via right-click, on ‘Main
Window’).

Once created, it will be show in the table Form navigation (Left section).
Table Editor will be shown on the right section.

10
SAP SmartForm

Table columns are defined by drawing lines on the LineType structure (with in the Table Editor)

For additional LineType structure, call up “insert/empty line” context menu (via right-click, on Table Editor).

11
SAP SmartForm

Final layout definition will be as below. Noting that Line Type1 has 4 columns and Line Type2 has 5 columns.

12
SAP SmartForm

To bind data into the UI table control, we need to assign the source data (i.e. IT_BSEG from our ‘form
interface’) in the “Data” section of the UI table control. As IT_BSEG is an array of values (i.e. internal table), it
needs to be assigned to a work area line structure for process (i.e. WA_BSEG from our ‘global definition’).
Note: once the correct variables are assign correctly, the editor will generate the backend program – no need
to program directly.

13
SAP SmartForm

Next is to map the source data values (i.e. IT_BSEG / WA_BSEG) into column fields of the Line Type.
As mentioned earlier, Line Type1 is for header text and Line Type2 is item value (i.e. WA_BSEG). In
the actual UI table control instance, there are header, main area and footer sections. Each section
needs to be assigned to a LineType, so that columns are defined.
Table UI

Header Row Document GL Account Posting Key Amount (Ccy)


Number
(=>Line Type1)
Main Area (Item) Row &WA_BSEG- &WA_BSEG- &WA_BSEG- &WA_BSEG- &WA_BSEG-
BELNR& HKONT& BSCHL& DMBTR& PSWSL&
(=>Line Type2)

To add the Header Row to the UI table control, call up “create/table line” context menu (via right-click, on
Table).

Once created, Row 1 will be shown (as seen at the form navigation on the left pane).

14
SAP SmartForm

Here we assign LType1 to Header Row.

Once assigned, the header row will inherit the columns defined by the line type structure (as seen at the form
navigation on the left pane).

15
SAP SmartForm

To add the Main Area (Item) Row to the UI table control, call up “create/table line” context menu (via right-
click, on Table).

Once created, Row 2 will be shown (as seen at the form navigation on the left pane).

16
SAP SmartForm

Here we assign LType2 to Main Area (Item) Row.

Once assigned, the main area (item) row will inherit the columns defined by the line type structure (as seen
at the form navigation on the left pane).

17
SAP SmartForm

Each column of the Header columns (=4) will need to be assigned a header value.
Header Row’s Column Document GL Account Posting Key Amount (Ccy)
Number

Header Text “Doc. No” “GL Account” “Dr/Cr Key” “Amount (Ccy)”

In the below, we are assign the text “Doc. No” into column 1 of ‘Header’ Row. We will repeat this step 3 more
times for the remaining header texts (i.e. “GL Account”, “Posting Key” and “Amount (Ccy)”)

18
SAP SmartForm

Each column of the Main Area columns (=5) will need to be assigned an item value.
Main Area Row’s Document GL Account Posting Key Amount Currency
Column Number

Item Value &WA_BSEG- &WA_BSEG- &WA_BSEG- &WA_BSEG- &WA_BSEG-


BELNR& HKONT& BSCHL& DMBTR& PSWSL&

In the below, we are assign the formula “&WA_BSEG-BELNR&” into column 1 of ‘Main Area’ Row.
Note: when trying to output system variable, it needs to be enclosed with “&”.
We will repeat this step 4 more times for the remaining item values (i.e. GL Account, Posting key, Amount
and Currency

19
SAP SmartForm

We can turn on the ‘Form Painter’ (in the toolbar) to manual moving of the UI controls/component in the form.

20
SAP SmartForm

Form Result: putting it all together


The form is completed with layout and data sourcing defined.
As noted: there is no coding involved (maybe small scripting).
Form Structure & Data Definition & Binding
Components

21
SAP SmartForm

However, to test the form format, we need a Caller Program.

The Caller Program will do a function call to our form ‘ZTEST_FORM1’ – and populate it with the data given by
the Caller Program. Note: full code at appendix

22
SAP SmartForm

Further Enhancement
It would be useful to have a record count summary, with a logo inclusion.
 To implement record count summary, there are two steps: (1) Generate the backend value for Data
Sourcing and (2) Create the text UI control for Form Layout.
 To implement logo inclusion, there are two steps: (1) Upload logo image and (2) Create the graphics
UI control for logo.

23
SAP SmartForm

Data Sourcing: record summary


We will store the number of records from the incoming dataset into a global variable “GV_RECORDS”. The
value will be computed at the initialization routine (global declaration).

24
SAP SmartForm

Form Layout: record summary


We will create the text UI control and bind the value against the global variable “GV_RECORDS”. When
referencing to a system variable it needs to be enclosed with ‘&’.

Form Result: putting it all together


When the Caller is re-run, the below will be shown.

25
SAP SmartForm

Logo Upload: logo inclusion


Logo is uploaded via transaction SE78.

26
SAP SmartForm

Logo UI: logo inclusion


In SmartForm editor, we can call up “create/graphic” context menu (via right-click, on ‘Page’).

After UI grahpic control is created and is linked to the logo – the ‘Form Painter’ will show a preview of its
outlook and position.

27
SAP SmartForm

Form Result: putting it all together


When the Caller is re-run, the below will be shown.

28
SAP SmartForm

Appendix

REPORT  ztest_form.

**********************************************
*   Get Data                                 *
**********************************************
DATA: gt_bseg TYPE TABLE OF bseg.
SELECT * FROM bseg
  INTO TABLE gt_bseg
  WHERE bukrs = '1000'
    AND gjahr = '2000'.

**********************************************
*   Print Data                               *
**********************************************
DATA: gv_form      TYPE tdsfname value 'ZTEST_FORM1',
      gv_form_func TYPE rs38l_fnam.
"1.a Get the print program name based on form name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname = gv_form
  IMPORTING
    fm_name  = gv_form_func.
"1.b Call the print program
DATA: lw_output_info      TYPE ssfcrescl.
DATA: control_parameters  TYPE  ssfctrlop.
control_parameters-no_dialog = 'X'.
control_parameters-preview   = 'X'.
CALL FUNCTION gv_form_func
  EXPORTING
    control_parameters = control_parameters
    it_bseg          = gt_bseg.

29
SAP SmartForm

Conclusion
SmartForm is a helpful tool that can achieve form layout that SAPScript could not. The interface of
SmartForm is GUI based, which is useful for non-technical developers (front-end). SmartForm supports logic-
to-interface separation as well as inline-coding – this provides developers plenty of coding flexibility.
In this paper, we have walked-through how a multi-line form is created and ran.

30
SAP SmartForm

Author Bio
Benedict Yong is a PMP/ITIL trained Project Consultant with 9+ years Finance domain experience (FICO,
COPA, BPC) and 3+ years of Logistics experiences (SD, MM, PS, CS). He holds four SAP® Functional
Certifications (Financial Accounting, Management Accounting, Sales, Procurement) and three Technical
Certifications (S/4 HANA Implementation Architect, S/4 Cloud Onboarding with SAP Activate, SAP
Business Intelligence 7.0).

He holds a Bachelor of Management and a Diploma in IT. He has worked in Banking,


Retail and Manufacturing industries, playing both in-house and external consultant
role.

He is situated in Singapore and is bilingual in English and Mandarin. He


can be contacted at [email protected].

For people who are interested to have a holistic understanding of ERP, a PDF document will not be
enough. “ERP Made Simple” at Amazon might prove to be useful.
https://www.amazon.com/dp/B083C3X8YY

31
SAP SmartForm

Reference
1. SAP Help - SmartForm Framework
https://help.sap.com/viewer/e0ef07e1f76b4370b1baa502eace5ece/7.5.6/en-US

2. “SAP ABAP SmartForms” by Zafar Karnalkar, 2020, YouTube


https://www.youtube.com/playlist?list=PLl_MEz33D2N0bk_883AOBsAmLblnxAKA1

3. SAP RICEF and SAP ERP - “ERP Made Simple: : ERP Explained in 80 Pages or Less”
https://www.amazon.com/dp/B083C3X8YY

32

You might also like