Web Dynpro for ABAP
Exercise Unit: Using Object Value Help.
Estimated Time: 35 minutes
NOTES: If you wish to find out more about any field, first select that field and then hit F1. Logon to the !" system and start !#!" $or%bench & E'(). Logon data is *ro+ided by your instructor. a+e all your ob,ects as local ob,ects &*ac%age name -T.").
PURPOSE: !t the end of this Tutorial you will be able to /nderstand how larger $eb 0yn*ro *ro,ects can be structured with se+eral $eb 0yn*ro com*onents #e able to include a reusable $eb 0yn*ro com*onent into another $eb 0yn*ro com*onent 1now how methods of an used $eb 0yn*ro2s Interface 3ontroller is called
PREREQUISITES: Logon to the !" system and start !#!" $or%bench & E'(). Logon data is *ro+ided by your instructor.
PROCEDURE:
Page 1
janvier 31, 2014
Web Dynpro for ABAP
Create the Web Dynpro Component
STEPS: 1.
!""!#$%U&!HE'%
tart the !#!" $or%bench &se80) and create the new $eb 0yn*ro com*onent 445((5I6"/T57EL"
(. De)ine a Component Usage o) the *tan+ar+ Web Dynpro Component WD!OV*
0efine the com*onent usage of the tandard $0859: $eb 0yn*ro com*onent.
Page (
janvier 31, 2014
Web Dynpro for ABAP
,. De)ine an -ssistance Class )or the Component an+ maintain text element
3reate an !ssistance 3lass for maintaining the te;t symboles for the a**lication.
0ouble 3lic% on the !ssistance 3lass name and from the .enu <9T9=>Te;t Elements to created or edit te;t elements.
3reate the following Te;t Elements in the assistance class created.
Page ,
janvier 31, 2014
Web Dynpro for ABAP
.. Create /-#$ Vie0
3reate a :iew in the $eb 0yn*ro com*onent with the name .!I6.
Page .
janvier 31, 2014
Web Dynpro for ABAP
1. Create context *2'#3H& o) the /-#$ Vie0
3reate a node with the FLI<7T for the .!I6 +iew.
Page 1
janvier 31, 2014
Web Dynpro for ABAP
4. #nstatiate the Usage o) the component WD5!OV* in the Vie0 Controller an+ the Win+o0 Controller
<o the the :iew2s *ro*erty tab. 3lic% on the 38E!TE #utton to instantiate the usage of the a+ailable controllers.
In the window, follow the same *rocedure to instantiate the usage of $0859: controller.
Page 4
janvier 31, 2014
Web Dynpro for ABAP
1. Create /-#$ Vie0 'ayout
In the layout of +iew .!I6 :IEW create a T8!? called T8!?57EL". Enter @ elect the FlightsA in the 3!"TI96 *ro*erty of CAPTION51 of T8!? T8!?57EL". Inside TRAY_HELP create labels and in*ut fields for the two attributes CARRID and CONNID of conte;t node NODE_FLIGHT. 7int: /se function Create Container Form out of the conte;t menu of T8!?57EL".
(. Create metho+ O$!OV* on e6ent OV*
<o to methods Tab of AIN :iew and select the ty*e of method to be used. <i+e a name to the method.
Page 7
janvier 31, 2014
Web Dynpro for ABAP
Ta%e FB hel* on the e+ent colmn and e+ent O!" needs to be selected.
<i+e the decsri*tion In#$t He%#
et&o' to the created method
0ouble 3lic% on the method ON_O!" and modify the method as *er *ro+ided source code C declare data structures for the fields to be dis*layed and C for the table columns of the selection list, if necessary ty*es: begin of t5stru5in*ut, C add fields for the dis*lay of your search in*ut here early ty*e sflight>fldate, late ty*e sflight>fldate, end of t5stru5in*ut,
begin of t5stru5list, C add fields for the selection list here carrid ty*e sflight>carrid, connid ty*e sflight>connid, fldate ty*e sflight>fldate, end of t5stru5list.
Page 8
janvier 31, 2014
Web Dynpro for ABAP
data: l5search5in*ut ty*e t5stru5in*ut, l5select5list ty*e table of t5stru5list, l5te;t ty*e wdr5name5+alue,
l5label5te;ts ty*e wdr5name5+alue5list, l5column5te;ts ty*e wdr5name5+alue5list, l5window5title ty*e string, l5grou*5header ty*e string, l5table5header ty*e string, l5selo*t ty*e ba*isfldra,
l5selo*t5tab ty*e table of ba*isfldra, l5flight5list ty*e table of ba*isfldat, l5ba*i5return ty*e table of ba*iretD, wa5select5list ty*e t5stru5list, wa5flight5list ty*e ba*isfldat, l5a*i ty*e ref to if5wd5+iew5controller,
l5msg5manager ty*e ref to if5wd5message5manager, wa5ba*i5return ty*e ba*iretD, l5msg5te;t ty*e string,
l5flights
ty*e table of sflight.
field>symbols: EFuery5*arams= ty*e t5stru5in*ut, Eselection= ty*e t5stru5list.
case o+s5callbac%5ob,ect>=*hase5indicator.
Page 9
janvier 31, 2014
Web Dynpro for ABAP
when if5wd5o+sG=co5*hase5(. Hconfiguration *hase, may be omitted C in this *hase you ha+e the *ossibility to define the te;ts, C if you do not want to use the defaults &00I3>te;ts)
l5te;t>name G IE!8L?I. Hmust match a field name of search l5te;t>+alue G wd5assist>=if5wd5com*onent5assistanceJget5te;t& %ey G I((1I ). insert l5te;t into table l5label5te;ts.
l5te;t>name G IL!TEI. Hmust match a field name of search l5te;t>+alue G wd5assist>=if5wd5com*onent5assistanceJget5te;t& %ey G I((DI ). insert l5te;t into table l5label5te;ts.
C C C
l5te;t>name G K39L/.61K. Hmust match a field in list structure l5te;t>+alue G K.?TELTDK. Hwd5assist>=get5te;t& K((DK ). insert l5te;t into table l5column5te;ts.
l5window5title G wd5assist>=if5wd5com*onent5assistanceJget5te;t& %ey G I((3I ). l5grou*5header G wd5assist>=if5wd5com*onent5assistanceJget5te;t& %ey G I((BI ). l5table5header G wd5assist>=if5wd5com*onent5assistanceJget5te;t& %ey G I((5I ).
C C C
l5window5title G wd5assist>=get5te;t& K((3K ). l5grou*5header G wd5assist>=get5te;t& K((BK ). l5table5header G wd5assist>=get5te;t& K((5K ).
o+s5callbac%5ob,ect>=set5configuration&
Page 1"
janvier 31, 2014
Web Dynpro for ABAP
label5te;ts G l5label5te;ts column5te;ts G l5column5te;ts grou*5header G l5grou*5header window5title G l5window5title table5header G l5table5header col5count G D row5count G D( ). when if5wd5o+sG=co5*hase51. Hset search structure and defaults C In this *hase you can set the structure and default +alues C of the search structure. If this *hase is omitted, the search C fields will not be dis*layed, but the selection table is C dis*layed directly. C 8ead +alues of the original conte;t ¬ necessary, but you C may set these as the defaults). ! reference to the conte;t C element is a+ailable in the callbac% ob,ect. o+s5callbac%5ob,ect>=conte;t5element>=get5static5attributes& im*orting static5attributes G l5search5in*ut ). C *ass the +alues to the 9: com*onent o+s5callbac%5ob,ect>=set5in*ut5structure& in*ut G l5search5in*ut ).
when if5wd5o+sG=co5*hase5D. C If *hase 1 is im*lemented, use the field in*ut for the C selection of the table. C If *hase 1 is omitted, use +alues from your own conte;t.
Page 11
janvier 31, 2014
Web Dynpro for ABAP
if o+s5callbac%5ob,ect>=Fuery5*arameters is not bound. CCCCCCCC T909 e;ce*tion handling endif. assign o+s5callbac%5ob,ect>=Fuery5*arameters>=C to EFuery5*arams=. if not EFuery5*arams= is assigned. CCCCCCCC T909 e;ce*tion handling endif. C C call business logic for a table of *ossible +alues l5select5list G MMM l5selo*t>low G EFuery5*arams=>early. l5selo*t>high G EFuery5*arams=>late. l5selo*t>o*tion G I#TI. l5selo*t>sign G III. insert l5selo*t into table l5selo*t5tab.
call function I#!"I5FLI<7T5<ETLI TI tables date5range G l5selo*t5tab flight5list G l5flight5list return G l5ba*i5return.
l5a*i G wd5this>=wd5get5a*i& ). l5msg5manager G l5a*i>=get5message5manager& ).
Page 1(
janvier 31, 2014
Web Dynpro for ABAP
loo* at l5ba*i5return into wa5ba*i5return where ty*e G IEI or ty*e G I!I. l5msg5te;t G wa5ba*i5return>message. l5msg5manager>=re*ort5error5message& message5te;t G l5msg5te;t ). endloo*. loo* at l5flight5list into wa5flight5list. wa5select5list>carrid G wa5flight5list>airlineid. wa5select5list>connid G wa5flight5list>connectid. wa5select5list>fldate G wa5flight5list>flightdate. insert wa5select5list into table l5select5list. endloo*. o+s5callbac%5ob,ect>=set5out*ut5table& out*ut G l5select5list ). when if5wd5o+sG=co5*hase53. C a**ly result if o+s5callbac%5ob,ect>=selection is not bound. CCCCCCCC T909 e;ce*tion handling endif. assign o+s5callbac%5ob,ect>=selection>=C to Eselection=. if Eselection= is assigned. C C C o+s5callbac%5ob,ect>=conte;t5element>=set5attribute& name G K39L/.61K +alue G Eselection=>column1 ). o+s5callbac%5ob,ect>=conte;t5element>=set5static5attributes& static5attributes G Eselection= ). endif. endcase.
Page 1,
janvier 31, 2014
Web Dynpro for ABAP
,. -ttach the create+ OV* help to CO$$#D )iel+ in the Vie0 Context.
7ere we will try acti+ating the standard searchel* for 3!88I0 field in the :IE$ conte;t and will learn to attach the created 9: to the 3966I0 field of the :IE$ 3onte;t.
Page 1.
janvier 31, 2014
Web Dynpro for ABAP
.. Embe+ the /-#$ 6ie0 in the Win+o0
<oto $I609$ of the $eb 0yn*ro 3om*onent and right 3lic% to embed the AIN in the $indow.
1. Create an+ &est Web Dynpro application
Each $eb 0yn*ro com*onent needs a $eb 0yn*ro a**lication to be e;ecuted.
Steps :
3reate a $eb 0yn*ro a**lication for your $eb 0yn*ro com*onent:
Test your $eb 0yn*ro a**lication. The result will loo% li%e the following:
Page 11
janvier 31, 2014
Web Dynpro for ABAP
9n *ressing FB hel* for CARRID , following hel* should be *ro+ided.
9n *ressing FB hel* on Flight 0ate, followinh should be the screen seFuence.
Page 14
janvier 31, 2014
Web Dynpro for ABAP
Page 17
janvier 31, 2014