You are on page 1of 23

Solution to the exercise on printing Invoices

By T.N.Swapna, YASH Technologies


Let us print an Invoice whose output will be as follows:

Step 1 :
Go to Transaction SMARTFORMS fro! the SA" #as$ Access Screen%

Give the S!art For! na!e which starts with & or ' an( clic) on *reate%

Step + :
Rena!e "a,e1 as FIRST b$ e-pan(in, the no(e "a,es an( .in(ows/ (ouble clic) on the no(e
0"AG#1%
As per the Re1uire!ent we nee( to have 2 win(ows%
1% 1
st
win(ow for (ispla$in, Lo,o
+% +
n(
win(ow for (ispla$in, 3illin, 4ocu!ent 4etails
5% 5
r(
win(ow for (ispla$in, *usto!er 4etails
6% 6
th
win(ow for (ispla$in, the Ite! 4etails an( the Total A!ount
2% 2
th
win(ow for (ispla$in, the Footer 4etails
Of all these win(ows the Main win(ow i%e% the win(ow/ which hol(s the Ite! 4etails is alrea($ (efine(% So
let us now create the other win(ows%
Step 5 :
#-pan( the no(e FIRST to see the !ain win(ow% 7ow to create the Lo,o win(ow%
The followin, screen appears% #nsure that the win(ow t$pe is Secon(ar$% 7ow Rena!e .I74O.1 as
LOGO.I7 b$ (ouble clic)in, on the no(e 0.I74O.1%
The followin, screen appears%
Repeat the sa!e for creatin, re!ainin, win(ows% After creatin, the re!ainin, win(ows the screen shoul(
loo) li)e this:
Step 6 :
7ow ,o to the For! "ainter b$ clic)in, on the button present on the application
toolbar% A(8ust all the win(ows as per the re1uire!ent%
&ou can close the For! painter b$ pressin, the button %
Step 2 :
7ow let us place a Graphic into the LOGO.I7 9Lo,o .in(ow:%
For that we nee( to first i!port the i!a,e fro! the local s$ste!% To (o this Go to transaction S#;< fro!
the SA" #as$ Access screen% The initial screen for A(!inistration of For! Graphics appears% #-pan( the
no(e GRA"=I*S an( select 3it!ap i!a,es% Select the Ra(io 3utton *olor for uploa(in, *olore( i!a,es%
7ow *lic) on I!port 3utton in or(er to i!port an i!a,e fro! $our s$ste!%
A pop up appears% Give the File path in the File 7a!e/ #nter a 7a!e an( 4escription as shown below
an( *ontinue%
Step > :
7ow ,o bac) to the transaction SMARTFORMS% Ri,ht *lic) on the LOGO.I7 *reate Graphic%

As per the followin, screen shot !a)e the chan,es% In the fiel( 7AM# with the F6 help select the i!a,e
which $ou have i!porte( fro! S#;<%
Step ; :
7ow co!in, to the 4eclarations% As re1uire( the (ata into the for! co!es fro! 5 tables na!el$/
?7A1 @ For printin, the *usto!er 4etails in the *usto!er 4etails .in(ow%
A3R? @ For printin, the 3illin, 4ocu!ent =ea(er 4etails in the 3illin, 4ocu!ent 4etails .in(ow%
A3R" @ For printin, the Ite! 4etails in the Main .in(ow%
The 4ata Retrieval an( printin, the For! is (one throu,h a 4river "ro,ra! calle( 'SFB"RI7TI7AOI*#%
In the For! we nee( to (eclare so!e I!port para!eters an( also (efine so!e Global 4efinitions%
For (eclarin, I!port para!eters (ouble clic) on For! Interface an( inclu(e the lines as shown below :
If $ou have table t$pes (efine( for A3R? an( A3R" tables ,ive those na!es in the Associate( t$pes
colu!n%
IMBFSB?7A1 @ The fiel( strin, for =ol(in, *usto!er 4etails%
IMBTBA3R? @ Table to hol( 3illin, 4ocu!ent =ea(er 4ata%
IMBTBA3R" @ Table to hol( 3illin, 4ocu!ent Ite! 4ata%
For Global 4efinitions/ (ouble clic) on the Global 4efinitions an( inclu(e the lines as follows :
IMBTB?7A1 @ Table to hol( *usto!er 4etails%
IMBFSBA3R? @ Fiel( Strin, to hol( 3illin, 4ocu!ent =ea(er 4ata%
IMBFSBA3R" @ Fiel( Strin, to hol( 3illin, 4ocu!ent Ite! 4ata%
.BTOTAL @ Stores the Total A!ount of the fiel( 7#T.R%
If the above screen shot is observe( we fin( a arrow which is place( on *urrenc$CDuant% Fiel(s% Open
this Tab to inclu(e the followin, lines%
This is to refer the currenc$ fiel( 7#T.R in the table A3R" to its correspon(in, currenc$ )e$ fiel( in the
table A3R?%
Step < :
4ispla$in, the contents in 3ILL.I7 93illin, .in(ow:%
*reate a Loop un(er the no(e 3ILL.I7
7a!e the Loop as LOO"B3ILL/ ,ive a (escription as Loop for 3illin, 4etails% In the fiel( Operan( ,ive
the (etails as IMBTBA3R? I7TO IMBFSBA3R?% In the where con(ition ,ive the fiel( na!e as ?E7AG/
Select the operator as F an( co!parison value as IMBFSB?7A1@?E77R%

*reate Te-t un(er the Loop LOO"B3ILL to (ispla$ 3illin, 4ocu!ent 4etails

Give the 7a!e for the T#GT an( a 4escription% To (ispla$ the fiel(s clic) on Fiel( List onCoff button
on the application toolbar% A list with fiel( na!es appear at the botto! left corner as shown in the screen
shot below% 4ra, H 4rop the fiel(s fro! IMBFSBA3R? on to the e(itor%

Step I :
4ispla$in, the contents in *EST.I7 9*usto!er .in(ow:
*reate Te-t un(er the no(e *EST.I7 to (ispla$ the *usto!er 4etails%

Give the 7a!e for the T#GT an( a 4escription% *lic) on Fiel( List onCoff button on the application
toolbar% A list with fiel( na!es appear at the botto! left corner as shown in the screen shot below% 4ra, H
4rop the fiel(s fro! IMBFSB?7A1 on to the e(itor%
Step 1J :
4ispla$in, contents in MAI7 9Main .in(ow:
*reate a Table un(er the no(e MAI7%
Give 7a!e for the table an( 4escription% Ri,ht clic) on 0LT&"#1 an( rena!e the Line as Line1%
Since we have to (ispla$ 2 colu!ns/ LI7#1 has to be (ivi(e( into 2 cells% To (raw lines Select the button
4raw Lines an( *olu!ns%
7ow create a Table line un(er the no(e =ea(er an( ,ive the Line T$pe as Line1%
As soon as $ou ,ive the Line t$pe as Line1 an( press #7T#R $ou can see that un(er the 0RO.1 2
*ells na!el$ 0*#LL1KK0*#LL2 are create(% 7ow Rena!e each of these as shown below:

7ow un(er each *ell create T#GT for 4ispla$in, the *olu!n =ea(in,s%

Repeat the sa!e steps for the no(e Main Area%
4efine a Table line% Give the Line T$pe as LI7#1%
As soon as $ou ,ive the Line t$pe as Line1 an( press #7T#R $ou can see that un(er the 0RO.1 2
*ells na!el$ 0*#LL1KK0*#LL2 are create(% 7ow Rena!e each of these *ells an( *reate Te-ts
un(er each *ell to (ispla$ the 4etails fro! A3R"% After *reatin, all these $our screen shoul( loo) li)e
this :
In the Main Area 4ra, an( 4rop the fiel(s fro! the fiel( strin, IMBFSBA3R" to print the Ite! 4etails% So
in the Te-t IT#M7O1 it will be HIMBFSBA3R"@"OS7RH an( so onK as shown above%
Since we have to (ispla$ the Total a!ount in the Footer area/ *reate a Table Line with one *ell% To
create a Table Line Ri,ht *lic) on the Line 1 Insert #!pt$ line un(erneath % An e!pt$ Line appears
after Line 1% 7a!e this Line as Line+%
*reate a Te-t un(er the cell TOTAL% Give the Line t$pe as Line +% The Followin, screen appears

In or(er to calculate the Total 9.BTOTAL: ,o to the Table IT#M4#T% Select the Tab *alculations an(
,ive the (etails as shown in the screen shot below:
Go bac) to the Footer Te-t for 4ispla$in, the TOTAL% 4ra, an( 4rop .BTOTAL fro! the Global 4ata%
To (ispla$ the fiel( list *lic) on the button Fiel( list onCoff%
Step 11 :
4ispla$in, contents in 3OTTOM.I7 9Footer 4etails:
*reate a T#GT un(er the 7o(e 3OTTOM.I7 to (ispla$ the Footer Infor!ation%

Give the 7a!e for the T#GT an( a 4escription an #nter the Te-t $ou want to 4ispla$ in the win(ow% So
$our screen loo)s so!ethin, li)e this:
Step 1+ :
Finall$ Save an( Activate the For!%
As we )now/ when we Activate the S!art For! it ,enerates a Function Mo(ule auto!aticall$% To view the
Function Mo(ule ,enerate( for this S!art For!/ Go to #nviron!ent Function Mo(ule 7a!e%
3$ *lic)in, on the Function Mo(ule 7a!e/ a pop up appears which ,ives the na!e of the Function
Mo(ule%
7ote (own the Function Mo(ule na!e%
Step 15 :
4river pro,ra! to #-ecute the for! 'SFBI7AOI*#
Go to Transaction S#5< fro! the SA" #as$ Access Screen an( create an #-ecutable "ro,ra! with
so!e na!e sa$ 'SFB"RI7TI7AOI*#%
As in the followin, pro,ra!/ (eclare the Selection screen ele!ents/ .or) variables/ Internal Tables etcK
an( call the Functions LSSFBFE7*TIO7BMO4EL#B7AM#L an( C13*4.3CSFJJJJJ+J1 9The one which
we ,ot in S!art for! b$ ,oin, to #nviron!ent Function Mo(ule 7a!e:% After callin, the Function C
13*4.3CSFJJJJJ+J1 8ust replace it b$ FMB7AM# as shown in the co(e below:
REPORT zsf_printinvoice.
*"Table Declarations...................................................
TABLES:
na!"
vbr"
vbrp.
*"Select Screen Ele#ents...............................................
PARA$ETERS :
p_%nnr L&'E vbr(%na)"
p_vbeln L&'E vbr(vbeln.
*"Data Declarations....................................................
*"((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((*
* *or +ariables
*
*"((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((*
DATA :
f#_na#e T,PE rs-.l_fna#. " /a#e of t0e 1%nction $o2%le
*"((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((*
* &nternal Table to 3ol2 Billin) Doc%#ent 3ea2er Details *
*"((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((*
DATA :
t_vbr L&'E
STA/DARD TABLE
O1 vbr.
*"((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((*
* &nternal Table to 3ol2 Billin) Doc%#ent &te# Details *
*"((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((*
DATA:
t_vbrp L&'E
STA/DARD TABLE
O1 vbrp.
DATA :
fs_na! T,PE na!" " 3ol2s 4%sto#er Details
fs_vbr L&'E L&/E O1 t_vbr" " 3ol2s Billin)Doc 3ea2er Details
fs_vbrp L&'E L&/E O1 t_vbrp. " 3ol2s Billin)Doc &te# Details
*"((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((*
* START(O1(SELE4T&O/ E+E/T *
*"((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((*
START(O1(SELE4T&O/.
SELE4T S&/5LE *
1RO$ na!
&/TO fs_na!
*3ERE %nnr E6 p_%nnr.
SELE4T *
1RO$ vbr
&/TO TABLE t_vbr
*3ERE %na) E6 p_%nnr
A/D vbeln E6 p_vbeln.
SELE4T *
1RO$ vbrp
&/TO TABLE t_vbrp
1OR ALL E/TR&ES &/ t_vbr
*3ERE vbeln 7 t_vbr(vbeln.
4ALL 18/4T&O/ 9SS1_18/4T&O/_$OD8LE_/A$E9
E:PORT&/5
for#na#e 7 9;S1_&/+O&4E9
&$PORT&/5
f#_na#e 7 f#_na#e
E:4EPT&O/S
no_for# 7 !
no_f%nction_#o2%le 7 <
OT3ERS 7 -.
&1 s=(s%brc >? @.
* $ESSA5E &D S,($S5&D T,PE S,($S5T, /8$BER S,($S5/O
* *&T3 S,($S5+! S,($S5+< S,($S5+- S,($S5+A.
E/D&1.
4ALL 18/4T&O/ f#_na#e
E:PORT&/5
i#_fs_na! 7 fs_na!
i#_t_vbr 7 t_vbr
i#_t_vbrp 7 t_vbrp
E:4EPT&O/S
for#attin)_error 7 !
internal_error 7 <
sen2_error 7 -
%ser_cancele2 7 A
OT3ERS 7 B.
&1 s=(s%brc >? @.
* $ESSA5E &D S,($S5&D T,PE S,($S5T, /8$BER S,($S5/O
* *&T3 S,($S5+! S,($S5+< S,($S5+- S,($S5+A.
E/D&1.
.hen the Above "ro,ra! is #-ecute( the final output woul( be:

You might also like