Sunteți pe pagina 1din 5

Here is the shopping cart application developed in SRM system.

Old application was in


ITS which was not user friendlylot of screen navigations. So we developed the BS
application in SRM with only one page with multiple views. !ach section on the screen is
one view. There are two "inds of approaches in BS# one is age with $low %ogic and
other is M&'. (e have used the M&' )Model &iew 'ontroller*
Model + It is a class where we write the ,usiness logic and populate the data so that it is
displayed on the $ront end. It uses the -ata ,inding concept for populating data.
.enerally we will create one model class.
&iew + (hich is used to display the front end element li"e ta,s# lin"s# ta,les# te/t
editor.S0 has provided tags for each of them which are called as BS tags which is
similar to HTM% tags. (e can have multiple views on single page.
'ontroller + It is a class againwhich is used to call the corresponding view. It is
interface ,etween the &iew and Model 'lass. $or e/ample + (hen the ,utton is clic"ed
on the view then it will go to controller class methods where we write the logic to call the
corresponding ,usiness logic in the model class.
The important controller class methods are.
-O1I2IT 3 This method will trigger only one time when the
application is called.
!/ample code + (e are creating the instance of the class.
METHOD do_init.
DATA: lr_model TYPE REF TO zcl_model.
lr_model ?= get_model( 'm' .
!F lr_model !" !#!T!A$.
lr_model ?= cre%te_model( model_id = 'm' cl%&&_n%me =
''($_"(_MO#!TOR_MODE$' .
E#D!F.
E#DMETHOD.
-O1R!45!ST 3 This application will ,e called for each server input
including first time when the application is called + %i"e BO in 0B0.
This is used for displaying the corresponding view3 li"e calling screen in 0B0. 0nd
also sends the model instance to the &iew so that it can use the data populated on model
access class. 0nd also if we modify the data on the view then it will reflected ,ac" in
controller class and model class. This is due to data ,inding.
met)od DO_RE*+E"T.
d%t%:
lr_model TYPE REF TO '($_MODE$,
l-_m%in_-ie. TYPE REF TO i/_0&1_1%ge. 2 3ie. /or m%in 1%ge
.
di&1%tc)_in14t( .
!F i&_n%-ig%tion_re54e&ted( !" #OT !#!T!A$.
RET+R#.
E#D!F.
lr_model ?= get_model( 'm' .
6 O4t14t t)e m%in -ie.
l-_m%in_-ie. = cre%te_-ie.( -ie._n%me = 'm%in.)tm' .
l-_m%in_-ie.78&et_%ttri04te( n%me = 'gr_model' -%l4e = lr_model .
c%ll_-ie.( l-_m%in_-ie. .
endmet)od.
-O1H02-%!1!&!2T + $or each input + %i"e 0I.
!/ample 'ode in the this method.here we are handling the ,utton clic" and
calling the method of the Model class to populate some data.
DATA: lr_model TYPE REF TO zcl_model.
!F )tml0_e-ent !" !#!T!A$ A#D
)tml0_e-ent_e9 !" !#!T!A$.
RET+R#.
E#D!F.
6 :et t)e in&t%nce o/ t)e model %cce&& cl%&&.
lr_model ?= get_model( 'm' .
!F lr_model !" !#!T!A$.
RET+R#.
E#D!F.
6 ;4ttton
!F )tml0_e-ent !" #OT !#!T!A$ A#D )tml0_e-ent78i/_)tml0_d%t%<e-ent_n%me =
'04tton' A#D
)tml0_e-ent78i/_)tml0_d%t%<e-ent_t=1e = 'clic>'.
DATA lr_04tton_e-ent TYPE REF TO cl_)tml0_e-ent_04tton.
lr_04tton_e-ent ?= )tml0_e-ent.
(A"E lr_04tton_e-ent78i/_)tml0_d%t%<e-ent_&er-er_n%me.
?HE# 'get!tem&'.
lr_model78g-_&creen = lr_model78gc_det.
lr_model78:ET_DETA!$"( .
E#D(A"E.
E#D!F.
?e %re )%-ing ot)er met)od& %l&o@@li>e get_model@&et_model@do_)%ndle_d%t%
@@@@@@@@@..
O-er%ll De&ign A
M%in 3ie. A ?)ic) di-ided t)e -ie.B1%ge into m4lti1le &ection&@.%nd e%c)
&ection i& % -ie..
?)en .e %cti-%te ;"P %11lic%tion it gener%te& t)e +R$ .)ic) c%n 0e gi-en
on internet e91lorer.
?e c%n do client &ide -%lid%tion 4&ing C%-%&cri1t& @@@.
?e c%n de-elo1 o4r o.n ;"P t%g&

S-ar putea să vă placă și