Documente Academic
Documente Profesional
Documente Cultură
Learning Objectives
$V D U HVX OW RI WKLV Z RUNVKRS \RX ZLOO UHVXO ZR
T T T T
Understand the Serverside Scripting model BSP Know how to use the BSP Extensions... ...and the Model View Controller concept See the way to Web Dynpro development in ABAP
Agenda
T T T T T
Business Server Pages BSP Extensions Model View Controller Outlook Web Dynpro for ABAP Summary
%DVLFVRI%XVLQHVV 6HUYHU3DJHV
which define the Web UI and contain serverside scripting (Images, background pics, button GIFs,...), Style-Sheets, etc.
Application Class
Attributes Methods
Demo
'HPR
'DWDEDVH$FFHVVLQ %63$SSOLFDWLRQV
Initialization
Every page has a defined step for data retrieval that is used in the layout step.
<%@page language="abap"%> <html> <body> <table border=1> <tr> <th>Carrier</th> <th>Connection</th> <th>Date</th> </tr> <% data: wa like line of flights. loop at flights into wa. %> <tr> <td> <%= wa-carrid %> </td> <td> <%= wa-connid %> </td> <td> <%= wa-fldate %> </td> </tr> <% endloop. %> </table> </body> </html>
Layout
The layout part contains script code mixed with static formatting directives (e.g. HTML). The data sources declared as page attributes are directly accessible in the initialization and layout step.
Event Handler
(YHQWV WKDW DUH FDOOHG GXULQJ WKH SURFHVVLQJ RI WKH UHTXHVW RI WKH SDJH 2Q,QLWLDOL]DWLRQ
page is rendered
2Q,QSXW3URFHVVLQJ
input
2Q&UHDWH
Page Attributes
Objects that are accessible in all page events and the layout section Example: tables that are filled in the Initialization step and used in the layout step
Application Class
BSP Application
BSP Page BSP Page BSP <html> ... BSP <% application->... %>
Application Class
Attributes Methods
An instance of the application class is created at every request to the page (stateless) and is available in all events and in the layout
MIME Repository
&RQWDLQV DUELWUDU\ ILOHV WKDW DUH XVHG E\ %63 $SSV
+DQGOLQJ8VHU ,QWHUDFWLRQ
HTML Forms
8VHG IRU XVHU LQSXW
<form action="/cgi-bin/proc.pl" method=get> your Nickname: <input type=text name="nickname"> <input type=submit name="Submit"> </form> <form method=get> <input type=checkbox name="sel" value="apple"> Apple <input type=checkbox name="sel" value="orange"> Orange <input type=checkbox name="sel" value="cherry"> Cherry <input type=submit name="Submit"> </form> <form action="/cgi-bin/procxls.pl" method=post> Upload Text File: <input type=file name="data" accept="*/text"> <input type=submit value="Upload"> </form> <form action="output.htm" method="post" > <select name="sel_category"> <option value="apple"> Apples <option value="orange"> Oranges </select> <input type="text" name="search" value=""> <input type="submit" value="Select"> </form>
Demo
'HPR
Adress.htm
... <form ...> <input type=text name=state ...> </form>
Order.htm
... <form ...> <input type=text name=number ...> </form>
must be processed by the initialization of the next page Y coding for events coming from an arbitrary number of other pages
PriceInfo.htm
if state ... select * ... itStreets if number ... endif. <html> price:...
NotAvail.htm
Order.htm
... <form ...> <input type=text name=number ...> </form> if number... navigation->
process the input coming from page X at the end of page X and then to determine the next page event OnInputProcessing that belongs to the page which contains the HTML form dynamically, depending on the users input
PriceInfo.htm
if state ... select * ... itStreets if number ... endif. <html> price:...
NotAvail.htm
data: carr TYPE string. carr = request->get_form_field( 'carrier' ). navigation->set_parameter( name = sel_carr' value = carr ). navigation->goto_page('flights.htm' ).
depending on the users input (input fields, pressed buttons, links) the Input Processing allows database updates and the dynamic navigation to the next page
case event_id. when 'select'. data: carr TYPE string. carr = request->get_form_field( 'carrier' ). navigation->set_parameter( name = sel_carr' value = carr ). navigation->goto_page('flights.htm' ). when 'exit'. navigation->exit( exit_url='http://www.sap.com' ). endcase.
more then one submit button can be distinguished by an arbitrary event name that is available as EVENT_ID in the Input Processing
%63([WHQVLRQV
BSP Extensions
T T T T
<htmlb:tableView id ="table" table ="<%=FLIGHTS%>" rowCount ="15" headerVisible="true" design ="ALTERNATING" />
HTML
SAP AG 2002, SAPSkills Conference, Klingels / 22
T Well known from JSP T User defined tags linked T Program coding that
with generates at runtime the HTTP response (TableView, TreeView, InputFields,...)
Demo
'HPR
T<textView> T<textEdit> T<button> T<inputField> T<tabStrip> T<itemList> T<breadCrumb> T<comboBox> T<listBox> T<radioButtonGroup> T<checkBoxGroup> T<checkBox> T<tree> T<treeNode> T<form> T<link> T<gridLayout> T<gridLayoutCell> T<image>
SAP AG 2002, SAPSkills Conference, Klingels / 25
7KH JRDO
whole application
T Build special
composite Extensions
0RGHO9LHZ&RQWUROOHU
Model-View-Controller (MVC)
Design pattern for decoupling presentation and logic of an application
Request
Controller
T Handle events T Handle events T Update application data T Update application data T Define control flow T Define control flow
Model
T Defines application data T Defines application data T Usually connected to T Usually connected to
business functionality business functionality
Response
View
BSP page
T T T
Layout rendering and event handling is done by the pages Business logic included via application class Flow between pages defined in event handler
Request
BSP page
events <form ...> <input application-> ...> </form>
Response
Application Class
Attributes Methods
Model-View-Controller in BSPs
T T T
Extend the BSP programming model with the MVC paradigm Enable programming model similar to Java world Simplify BSP pages in order to support further customizing options
Request
BSP Controller
METHOD DO_REQUEST ... CALL_VIEW
Application Class
Attributes Methods
BSP View
Response
Demo
'HPR
T T
Complex call sequence during one HTTP request Parts of a page aggregated during runtime
BSP Controller
METHOD DO_REQUEST ... CALL_VIEW
BSP View
<form ...> <input ...> </form>
BSP View
<form ...> <input ...> </form>
BSP View
<form ...> <input ...> </form>
BSP Controller
Request Response
BSP Controller
METHOD DO_REQUEST CALL_VIEW CALL_CONTR
BSP View
<form ...> <input ...> </form>
BSP Controller
METHOD DO_REQUEST ... CALL_VIEW
BSP View
<form ...> <input ...> </form>
Demo
'HPR
T Minimize coding, maximize design T Support reuse of components T Support web services and data-binding T Separate layout and programming logic T From platform T From UI technology
$FKLHYH ,QGHSHQGHQFH
T Browser based front-end, zero footprint T Flicker-free screen, minimal refreshes T Client-side dynamics T Minimal response times T Personalization of the user interface T 508 accessibility compliance
Dynpro Converter
ABAP Generator
Dynpros
ABAP ABAP Runtime
Designtime
WD Tools (SE80)
Project Browser View Designer Application Modeler Model Editor
Runtime
WD Runtime for ABAP
Generator
Metadata API
Database
SAP AG 2002, SAPSkills Conference, Klingels / 38
T T T T
New object list for Web Dynpro Component Tool navigation Active/InactiveManagement Integrated in the Transport Organizer
T Hierarchical editing of Viewset hierarchy T Hierarchical/table editing of navigational links T Wizards for optimizing complex operations T Property box T No graphical support
Trigger events
Render (UR)
SAP AG 2002, SAPSkills Conference, Klingels / 41
Controller Editor
)XQFWLRQDOLW\
T Tabstrip for entities (e.g. events, validators, eventhandlers, ) T Wizards for frequently used tasks T Integrated method editor (syntax check, ) T Automatic code generation T Synchronization of T Separation of generated
declarative and coded parts and manually implemented parts
Context Editor
)XQFWLRQDOLW\
T Hierarchical editing of context T Data binding T Drag and drop support T Property box T Context view for View
Designer nodes/attributes
Pattern-based UI Design
Business Processes
Components
Controls
T You want to develop a web application based on Web AS 6.20. This is why you T You want to stay consistent with SAP's strategic Web Dynpro approach, and
have chosen Business Server Pages as the means to create your application. you expect that you can extend and modify your application in later releases via Web Dynpro tools. You are aware that BSP is one of the runtimes of Web Dynpro.
'R
V
T Use only BSP HTMLB Extensions (tags) T Use the Model-View-Controller (MVC) programming model offered by BSP T Clearly separate business from visualization logic T Do not use Web AS 6.10 T Do not use native HTML T Do not use scripting - neither client-side, nor server-side T Do not use "old" BSP Page based approach T Do not mix business with visualization logic
'RQW
V
Further Advice
T T T T T T T
Use the CL_BSP_MODEL base class for your models Do not use view attributes (except model references) Bind your tag attributes to the model only Use the <bsp:viewArea> tag to embed views in pages Make sure that your view layouts do not contain <htmlb:content>, <htmlb:form>, <htmlb:page> or <htmlb:document * > tags Do not use the BSP NAVIGATION object Make your application stateful
Summary
T T T T T
BSP: Serverside Scripting Model Free HTML: max flexibility BSP Extensions: predefined UI elements Model View Controller: mighty framework for structuring Web Dynpro: Tools, generators for max. productivity
"