Upload
apurva2009
View
261
Download
2
Embed Size (px)
Citation preview
8/13/2019 Bapi Usage
1/16
Web Dynpro for ABAP
Exercise Unit: BAPI Usage Estimated Time: 45 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 obects as local obects &*ac%age name -T").
PURPOSE:
The goal of this e/ercise is to allow the *artici*ants to 0reate a $eb yn*ro com*onent for sim*le flightboo%ing with a single +iew.
PREREQUISITES:
Logon to the !" system and start !#!" $or%bench &E'(). Logon data is *ro+ided by your instructor.
DEVELOPMENT OBJECTIVES:
This e/ercise demonstrates the usage of #!"Is and how to im*lement a +iew with in*ut fields and a result
table.
PROCEDURE:
1. 0reate a $eb yn*ro 0om*onent and a 2iew.
3. 0reate a er+ice 0all for #!"I BAPI_FLIGHT_GETLIST.
. efine the 0onte/t a**ing
4. efine In*ut Fields and a #utton on the 2iew
5. efine an !ction and 0orres*onding !ction andler
6. efine the Table on the 2iew
7. Embedd the 2iew into the $indow
'. !cti+ation, 0reation of a $eb yn*ro !**lication and E/ecution
Page 1 janvier 30, 2014
8/13/2019 Bapi Usage
2/16
Web Dynpro for ABAP
1. Create a Web Dynpro Component and a View
STEPS:
1. 0reate a new $eb yn*ro com*onent with name 889((9#!"IFLIT and assign it to *ac%age -T"&local obect).
3. 0reate a +iew called FLIGHTLISTVIEW .
. a+e all the changes.
. Create a !er"ice Ca## $or BAPI BAPI%&'I()*%(E*'I!*
STEPS:
$ith the hel* of the ser+ice call function it is *ossible to call an e/isting function module from within a $ebyn*ro com*onent.To create a ser+ice call, you ha+e an easy;to;use wi
8/13/2019 Bapi Usage
3/16
8/13/2019 Bapi Usage
4/16
Web Dynpro for ABAP
4. The @eBuired ethods and 0onte/t Elements
=n the two subseBuent dialog windows, default +alues are listed for gi+ing names to the conte/t nodes
and attributes reBuired by the ser+ice call as well as to the reBuired methods. The *ro*osed names arebased on the names of the embedded ser+ice, but you can change them as reBuired. owe+er, heedthe res*ecti+e notes in the corres*onding dialog bo/.
a) !da*t 0onte/t: elect from ?odesC!ttributes ?ames $ESTI%ATI&%_F'&"($ESTI%ATI&%_T& and FLIGHT_LIST . "ress Continue.
b) *ecify ethod ?ame: lea+e all entries as *ro+ided:
0om*onent: ))_**_BAPIFLIGHT
0ontroller: C&"P&%E%TC&%T'&LLE'
ethod: E+CUTE_BAPI_FLIGHT_GETLIST
,"ress Continue.
5. 0om*leting the 0hoice
$hen you ha+e confirmed the last dialog bo/, the generation is triggered. !fterwards you now ha+e thereBuired methods and conte/ts at your dis*osal for using them within your $eb yn*ro com*onent.
The com*onent controller conte/t now contains the corres*onding conte/t nodes for the #!"I call.
Furthermore, in the method list there is a new method EXECUTE_BAPI_FLIGHT_GETLIST , which contains
the coding to read the conte/t nodes ETI?!T=?9F@= and ETI?!TI=?9T= and their underlyingconte/t attributes, calls the #!"I and assigns the resulting table to conte/t node FLIT9LIT.
Page , janvier 30, 2014
8/13/2019 Bapi Usage
5/16
Web Dynpro for ABAP
+. De$ine t-e Context apping
STEPS:
1. =*en +iew FLITLIT2IE$ and switch to tab Conte!t . a* conte/t nodes ETI?!TI=?9F@=,ETI?!TI=?9T= and FLIT9LIT to the +iew conte/t of FLITLIT2IE$ using rag and ro*.
0onfirm the dialoges whether you want to co*y or ma* the different conte/t nodes.
The result should loo% li%e this:
Page / janvier 30, 2014
8/13/2019 Bapi Usage
6/16
Web Dynpro for ABAP
3. a+e your changes.
Aou ha+e now ma**ed the com*onent controller conte/t elements to the +iew conte/t ofFLITLIT2IE$.
,. De$ine Inp0t &ie#ds and a B0tton on t-e View
STEPS:
1. witch to tab Laout of +iew FLITLIT2IE$.
3. elect Standard Container from DI Elements Library and drag and dro* the rou* icon to the 2iewesigner. The new DI element will be named G'&UP.
et the following *ro*erties for G'&UP :
Page janvier 30, 2014
8/13/2019 Bapi Usage
7/16
8/13/2019 Bapi Usage
8/16
Web Dynpro for ABAP
5. elect the attributes CIT/ and C&U%T' and lea+e the tandard 0ell Editor as I%PUTFIEL$.
@e*eat the same *rocedure &3;5) to create an DI element G'&UP_0, bind it with conte/t node$ESTI%ATI&%_T& and select again the attributes CIT/ and C&U%T' .
Page 3 janvier 30, 2014
8/13/2019 Bapi Usage
9/16
Web Dynpro for ABAP
et the following *ro*erties for G'&UP_0:
6. !dditionally, create a button within G'&UP_0, by right clic%ing the G'&UP_0 element below the'&&TUIELE"E%TC&%TAI%E' and select Inert Eleent from conte/t menu. 0hoose ty*e #utton asDI element and name it BUTT&%_0. The button will be *laced in the grou* container.
7. et the *ro*erty Te!t of #DTT=?91 to +alue Searc1 Fli21t.
Page 4 janvier 30, 2014
8/13/2019 Bapi Usage
10/16
8/13/2019 Bapi Usage
11/16
Web Dynpro for ABAP
Enter the following data &you may use F4 el* to get the *ossible entries).
0om*onent ?ame: 889((9#!"IFLIT
0ontroller ?ame: 0="=?E?T0=?T@=LLE@
ethod ?ame: EE0DTE9#!"I9FLIT9ETLIT
. elect Continue 3Enter4.
The generated coding will loo% li%e this.
Page 11 janvier 30, 2014
8/13/2019 Bapi Usage
12/16
Web Dynpro for ABAP
. De$ine t-e *ab#e on t-e View
STEPS:
1. witch to the Laout tab of the +iew and create a table TABLE using Standard Complex from DIElements Library in 2iew esigner &rag and ro*).
3. et the following *ro*erties for the new element T!#LE:
. 0reate the data binding of DI element TABLE with conte/t node FLIGHT_LIST .
Page 1 janvier 30, 2014
8/13/2019 Bapi Usage
13/16
Web Dynpro for ABAP
tandard 0ell Editor should be of ty*e TE+TVIEW . !cti+ate binding for all conte/t attributes.
Page 1+ janvier 30, 2014
8/13/2019 Bapi Usage
14/16
Web Dynpro for ABAP
4. "ress button Continue 3Enter4 and sa+e all the changes.
Page 1, janvier 30, 2014
8/13/2019 Bapi Usage
15/16
Web Dynpro for ABAP
2. Embedd t-e View into t-e Window
STEPS:
Embed the +iew FLITLIT2IE$ into $indow 889((9#!"IFLIT.
1. =*en in the =bect ?a+igator tree the $indow structure and select the window 889((9#!"IFLIT.
3. =*en the +iew structure and drag and dro* the +iew FLITLIT2IE$ inside the window structure onthe right hand side.
. =*en the window structure on the right hand side and you will see the embedded +iewFLITLIT2IE$.
4. a+e your changes.
Page 1/ janvier 30, 2014
8/13/2019 Bapi Usage
16/16
Web Dynpro for ABAP
3. Acti"ation6 Creation o$ a Web Dynpro App#ication and Exec0tion
STEPS:
1. !cti+ate all objects of $eb yn*ro com*onent ))_**_BAPIFLIGHT .
3. 0reate the $eb yn*ro a**lication 889((9#!"IFLIT and assign it to *ac%age -T" &local obect).
. @un your a**lication.
The result should loo% li%e this.
RESULT :
Aou ha+e now created a sim*le $eb yn*ro com*onent which uses a #!"I call for data collection. Aou ha+eseen how to use the ser+ice call wi