Technology

6729135 bsp-2

Description
1. Programming ModelThe following documentation describes the BSP programming model:BSP ApplicationsBSPsBSP DirectivesCentral Classes and InterfacesImportant Global…
Categories
Published
of 52
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  • 1. Programming ModelThe following documentation describes the BSP programming model:BSP ApplicationsBSPsBSP DirectivesCentral Classes and InterfacesImportant Global ObjectsBSP ExtensionsModel View Controller (MVC)Stateful and StatelessControl Flow and LifetimeCachingPage DesignAccessibilityFor SAP Web AS 6.20, the BSP programming model was enhanced with the MVC design patternas well as the paradigm of the BSP extensions.What is a BSP Application?OverviewA Business Server Page (BSP) application is a complete functional application, like aclassic SAP transaction. However, this application is executed in a Web browser ratherthan in the SAPGUI. HTTP or HTTPS is the protocol used to access the applicationacross the network, thus allowing the use of standard products like firewalls and proxyservers.The Business Server Pages programming model is similar to the server page technology.The focus of the BSP programming model are points that ensure optimum structure ininterfaces and business logic.For more information about BSP applications, see:● The components of a BSP application and how they interact, see Structure of a BSPApplication.● How to call an existing BSP application from a Web browser, see Accessing a BSPApplication.● How to open and close a BSP application, see Starting and Ending a BSP Application.● How a BSP application is processed, see Processing a BSP Application● How to create a BSP application, see Creating a BSP Application.● The URL parameters you can use to access the BSP runtime environment and BSPapplications, see System-Specific URL Parameters.● The concept of an application class for encapsulating the business logic of a BSPapplication, see Application Class of a BSP Application
  • 2. Structure of a BSP ApplicationA Business Server Page (BSP) application is an independent development project that iscreated and edited in the SAP development environment (transaction SE80). Externaldesign tools, such as Adobe GoLive, Dreamweaver, or Microsoft FrontPage 2000 can beused to design the BSP application, as well as BSP extensions.Analog to a classic transaction, a BSP application consists of a user interface andbusiness logic that is assigned to a logical unit, in this case the BSP application.The user interface of a BSP applications includes:• Static Web sites• Dynamically generated Web sites, which are BSPs or templates that contain server-sidescripting that is executed dynamically at runtime to generate a static Web site BSPs caneither be pages with flow logic or views.There can also be controllers if the MVC design pattern is used• Various MIME objects, such as pictures, icons, sound files, style sheets, and so on, thatare parts of a typical Web application
  • 3. All of these objects are integrated in the Change and Transport Organizer as parts of theBSP application and are handled as a logical unit. This allows all objects that are part of aBSP application to be fully and consistently transported between all the systems in anSAP system landscape.The business logic can be accessed from the BSP application using the typical methods,such as BAPIs, function modules, or class libraries. In addition, the BSP programmingmodel provides a structuring tool, the BSP-Application class , that can be used toencapsulate the business logic functionality in the BSP application.A BSP application consists of the following components:• ControllerControllers contain business logic and application data. Controllers assess the dataof an incoming request based on a model and then select a suitable view forrendering the response to the user, see also Model View Controller (MVC).• Business Server Pages (BSPs)BSPs are the Web sites that are displayed in the browser when the application is in use.BSPs can contain static HTML code and dynamic scripting code (ABAP or JavaScript). Thescripting code is interpreted on the server. The exact structure of a BSP is described inBuilding an BSP.A page can have the following versions: Page with flow logicThese are simple pages with event handlers, but without much application logic orvisualization elements. It is possible to build a BSP application exclusively out ofpages with flow logic and event handlers. ViewViews are used to visualize data, see also Model View Controller (MVC). Page fragment
  • 4. These are created in the same way as normal BSPs, but are then marked as pagefragments. Other BSPs can also include these fragments using theincludedirective (see Include Directive).• Navigation structuresThe navigation structure determines which navigation request is used to direct thenavigation process from which page to which subsequent page.• Application classThe business logic of a BSP application is encapsulated in an application class. This classis realized by means of a global ABAP class which implements the access to business datausing BAPI calls, for example. Every page of a BSP application can directly reference thecomponents of this class (attributes, methods, and so on) using the predefined Objectapplication.You can also assign several BSP applications to an application class.For more information, see Applications Class of a BSP Application.• MIME objectsIn the SAP system, all MIMEs, such as graphics, style sheets (used to define formattingproperties of individual HTML tags), audio files, video files, and so on, are stored andadministered in a central repository, the MIME repository.For every new BSP application, a directory of the same name is created in the MIMErepository. This directory is used as a storage location for all application-specific MIMEs.See also:Accessing a BSP ApplicationStarting and Ending a BSP ApplicationBuilding a BSPAccessing a BSP ApplicationAs explained previously, you access BSP applications using the HTTP or HTTPS (SecureHTTP) protocol. The BSP runtime environment uses the HTTP framework of the SAPWeb Application Server (compare Interaction Model). In the Internet CommunicationFramework (ICF), for a BSP application to function smoothly you need a node, that is, aservice in the service tree (see also Creating a BSP Application).Ensure that after a SAP Web AS has been installed, that all services are inactive and thatthey must be activated accordingly. You can find further information about activationunder Activating and Deactivating an ICF Service and in Business Server PagesAdministration.The node is activated in the service tree only with BSP applications that were newlycreated for SAP Web AS 6.20 as part of automatically creating the corresponding node.A BSP application is addressed and executed through HTTP using a Uniform ResourceLocator (URL). The URL of a BSP application has the following structure (defaultconfiguration):<Prot>://<Host>.<domain>.<extension>:<Port>/sap/bc/bsp/<namespace>/<applicationname>Protocol Prot is httpor https (if configured). Host is the name of the applicationserver that should execute the application. The domainwith the extension
  • 5. encompasses several hosts under a common name. These can either be part of anindividual host or a network. The Port number can be omitted if the default port 80(http) or 443 (https) is used.For SAP Web Application Server, the default port number is 1080 (HTTP) or 1443(HTTPS). The namespace is the namespace ID of the BSP application. SAP applicationsare delivered in the sap namespace. If you create your BSP application in a separatenamespace, it must be used in the URL. The application name is the name of the BSPapplication as defined in the development environment.Here is an example of a URL for BSP test application IT00:http://myServer.sap-ag.de:1080/sap/bc/bsp/sap/it00
  • 6. The full name of the server is specified, including the network domain (here: sap-ag.de). If this is not done, the BSP runtime environment returns an error. The fulldomain must be entered, as there may otherwise be problems with HTTP cookies(such as Single Sign On).If the BSP that you start by calling Transaction SE80 contains a shortened URL(excluding the host name), proceed as described in Note 434918.When this URL is started in the Web browser, the BSP application is started, and theinitial page is displayed (by default this is default.htm).To determine the URL of a BSP or BSP application in the SAP developmentenvironment, select the Properties tab to the right of the SAP GUI screen.Example of page default.htm of BSP application IT00:
  • 7. For more information:Starting and Closing a BSP ApplicationCache Key
  • 8. Starting and Ending a BSP ApplicationUseURL parameters can be used to inform the BSP runtime environment to start or end aBSP application (corresponds to the OK code “/n” in SAP GUI) To do this, the QueryString parameter sap-sessioncmd is added to the URL and the HTTP request is sent tothe server.To be compatible with SAP Internet Transaction Server (ITS) and the SAPEnterprise Portal (SAP EP), you can also use ~SAPSessionCmd.For a list of all system-specific URL parameters that have a special use in the BSPapplication environment, see System-Specific URL Parameters.ProcedureThe following commands are supported:• open: Restarts a BSP application that is running. The application is started up if it is notcurrently running.http://myServer.sap.corp:1080/sap/bc/bsp/sap/it00?sap-sessioncmd=open• close: Ends a running BSP application and either tells the system to display a blank pageor go to a specific Web site (exit URL). The exit URL is specified using an additional URLparameter,This parameter is calledsap-exiturl,and must contain a full HTTP URL.To be compatible with SAP Internet Transaction Server (ITS) and the SAPEnterprise Portal (SAP EP), you can also use ~exitURL.Example1. • Restart of BSP test application IT00:http://myServer.sap.corp:1080/sap/bc/bsp/sap/it00?sap­sessioncmd=open1. • Ending the application externally:http://myServer.sap.corp:1080/sap/bc/bsp/sap/it00?sap­sessioncmd=close&sap­exiturl=http%3a%2f%2fwww.sap.comPay attention to the spelling of the URL - all URI parameters, that is everythingfollowing the ?, must be URL-encoded.System-Specific URL ParametersTo control the BSP runtime environment and the BSP application, you can use thefollowing URL query string parameters in a request URL.URLParameterValue Description
  • 9. sap-sessioncmd open: Restarts the BSP application named in the URLclose: Ends the BSP application named in the URL and sends thebrowser, if specified, to the Web site defined by sap-exiturl. If you want the user to be able to end theapplication, this option should be available in a BSPapplication as part of the user interface (as a pushbutton orhyperlink).sap-exiturl * Specifies the URL to which the browser is directed whenthe BSP application ends (for example,http://www.sap.com)sap-theme * Overrides the theme for a BSP application to use otherMIME objects, such as pictures and Stylesheets forvisualization.sap-themeRoot * Used to handle paths to other locations from wherestylesheets are taken.See also:Changing Stylesheets for HTMLB and XHTMLBThis parameter is available from SAP Web AS 6.20Support Package 7.sap-client * Specifies the client for a logon to the SAP Web ApplicationServer; can be used in the URL or in HTML forms tooverride the default client.sap-user * Specifies the user for a logon to the SAP Web ApplicationServer; can be used in the URL or in HTML for forms.sap-password * Specifies the password for logon; can be used in HTMLforms.Do not enter this directly in the URL as Web browserURLs are stored in a History list and the password wouldbe visible in plain text, even after the browser is closed.sap-language * Specifies the language (ISO language ID, such as EN orDE) for a logon to the SAP Web Application Server; can beused in the URL or in HTML forms to override the defaultlogon language.sap-htmlb-design* Dynamic switching of the different default design variants,without using the attribute design of <htmlb: content>.Possible values are CLASSIC, DESIGN2002 andDESIGN2003.For SAP Enterprise Portal 5, DESIGN2002 is supported.
  • 10. For SAP Enterprise Portal 6, both DESIGN2002 andDESIGN2003 are supported.sap-domainRelaxoff |min |maxMaximum domain relaxing, see also Domain Relaxingsap-accessibility X | Specification for the accessibilitySee also Configuration SettingsTo activate this indicator, an activated checkbox is placedon the logon screen for input help.sap-rtl True |FalseDetails of the RTL supportThe family of <HTMLB> libraries supports RTL (right-to-left) rendering for design2003. You can activate RTLrendering using the URL parameter sap-rtl=true (but onlyfor the first call before the BSP URL finds out about theURL mangling). Use attribute rtlAutoSwitch from<htmlb:content> to activate the RTL modeautomatically, depending on the currently active language(SY-LANGU). The decision about activating RTL isdelegated to the function module NLS_RTL_DISPLAY.Parameter names and parameter values are not case sensitive (exception: sap-exiturl is case-sensitive, if the link is to a case-sensitive server). You can combineseveral parameters in one URL.Here is an example of how to restart a BSP application in client 800 with logonlanguage English.http://myServer.sap.com:1080/bc/bsp/sap/it00?sap-sessioncmd=open&sap-language=en&sap-client=800Processing a BSP ApplicationUsesWhen a BSP application is being processed, the individual BSPs and their components are run,and the corresponding processing steps are executed according to the code.ProcessIf an HTTP request is sent to a BSP, that is, if a page (in stateless case: for the first time) iscalled, the page in instantiated in OnCreate. Next, OnRequest is called.The handler is then run that is most appropriate for the request, that is, OnInitialization for URLinput, OnInputProcessing for HTML input, or another individual event handler if controls are used.
  • 11. If it hasn’t already, OnInitialization is run, so that the initialization phase data is assessed. Data inthe SAP system, such as table contents or BAPIs, can be accessed in this phase. Then, thelayout part (the hidden part of the event handler OnLayout) is processed, which determines thedesign and presentation logic of a page. This code consist of static parts (for example, HTML)and scripting code. To ensure clean programming, no business logic or data retrieval is carriedout in the layout part. The manipulation part becomes important if the HTTP data stream shouldbe modified later. The manipulation code should likewise contain no business logic or statementsfor data retrieval functionality. If there are no subsequent changes, the manipulation part is notrequired.On the basis of all this data, the first page is built and sent to the user.Next comes the user interaction phase, in which the user inputs data. The user input is sent backto the BSP. This input triggers an additional HTTP request.You can specify for every page whether stateful or stateless mode is required. This is done in theinput processing part. For example, incorrect input can be checked, data can be read from thedatabase, and the succeeding page can be determined.The subsequent page for the navigation request is determined in the navigation part of theapplication. If no succeeding page is set, the first page is reprocessed.Then, processing of the initialization part continues.For more information, see Control Flow of BSPsCreating a BSP ApplicationYou create your Web application in the form of a BSP application.For information about the procedure for creating BSP applications, see the documentationon Web Application Builder in the sections under Basic Functions..Extending Security Aspects with BSP ApplicationsSo that a BSP application can function correctly, there must be a node that corresponds toeach BSP application in the service tree (Transaction SICF) of the InternetCommunication Framework (ICF).When you create a BSP application in the Web Application Builder in SAP Web AS 6.20and higher, this type of node is created and activated in the appropriate part of the ICFservice tree (see Creating an ICF Service). If necessary, you can define permissions forthis node (see Maintaining Service Data).For BSP applications that were created before SAP Web AS 6.20 and which therefore donot have any nodes in the ICF service tree, this node is generated automatically by thesystem as soon as you branch to the corresponding BSP application in change mode.There may be conflict with old BSP applications with names that are longer than 15characters. Before SAP Web AS 6.20, you could create BSP applications whosenames could exceed the length of the service name in Transaction SICF. In thiscase, we recommend that you copy all of the old BSP application to a new BSPapplication with a shorter name, so that the node is automatically created.
  • 12. Application Class of a BSP ApplicationOverviewA BSP application comprises a number of different development objects. One of theseobjects is the application class of the BSP application.The application class is a regular ABAP Objects class. As such, the application class caninclude any methods, attributes and events that the developers wish to have.The application class is usually used to store data and make it available across BSPpages. This data is stored as attributes. The application class also encapsulates BSPapplication logic in methods. This allows several BSP applications to use the sameapplication class and provide one business application that contains different interfaces,such as for various devices, without having to replicate the business or application logic.This also means the global Object application can be used in the BSP application toaccess the attributes and methods of the application class.You do not have to use an application class in your BSP application. Rather, it is anoptional way for application developers to structure their BSP application.You use the Web Application Builder in transaction SE80to assign an application class toa BSP application.A simple example of where an application class could be useful would be a class forcontrolling dialog logic and maintaining data consistency in a BSP application forshopping. This application class would include a shopping basket (internal table orother object) as an attribute. There would also be methods for changing andprocessing the shopping basket, such as to add, change, or delete articles. Methodsfor determining prices, creating offers, and posting orders would also be helpful.In many cases, the application class is only used to encapsulate existing applicationfunctions, such as from SAP Customer Relationship Management (SAP CRM), andthen access the function through BAPI interfaces. Using an application class to
  • 13. encapsulate the functions ensures that the BSP application functions are stored in acentral location (in the application class) and that both implementation anddistribution are transparent (local method call but remote BAPI call internally). If acustomer or developer wants to change or adapt a BSP application or use theapplication for an additional device, they have the full functions of the original BSPapplication available in the interface of the application class.Runtime BehaviorAny ABAP Objects class can potentially be used as an application class of a BSPapplication. However, the BSP runtime environment must treat the class as a singleton,that is, a class for which there is only one instance per session.The lifetime of an application class depends on the state model of the BSP application. ABSP application can be stateful or stateless.Stateful BSP ApplicationIn Stateful BSP Applications, the only instance of the application class, the applicationobject, is generated at the first request sent to the BSP application. The object is thenavailable for the entire lifetime of the session. The end lifetime of the applicatio
  • We Need Your Support
    Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

    Thanks to everyone for your continued support.

    No, Thanks