!--a11y-->
Interface IF_BSP_PAGE 
The interface IF_BSP_PAGE gives access to information about a BSP such as the page names, the lifetime, the corresponding BSP application, the URL of the page, and so on.
IF_BSP_PAGE is implemented using the class CL_BSP_PAGE, which is the base class of all BSPs.Consequently, the methods and attributes of this interface are indirectly available by inheritance in all BSPs and can be accessed with the appropriate qualification via the interface name (for example "name = if_bsp_page~get_page_name( ).").
The interface can also be addressed in all BSP event handlers by means of the parameter page and can be extended to lower application levels if required. In particular, the BSP page attributes can be read and set using the methods get_attribute() and set_attribute().
CL_BSP_PAGE
-
-
Attribute Name |
Declaration Type |
Description |
co_format_currency |
Constant |
write() or to_string() method: displayed as currency |
co_format_long |
Constant |
write()- or to_string()method: |
co_format_lower |
Constant |
write() or to_string() method: displayed in lower case |
co_format_none |
Constant |
write() or to_string() method: default format |
co_format_short |
Constant |
write() or to_string()method: short display |
co_format_upper |
Constant |
write() or to_string() method: displayed in upper case |
lifetime_page |
Constant |
Page is valid until explicit navigation away from this page |
lifetime_request |
Constant |
Page is only valid for this HTTP Request |
lifetime_session |
Constant |
Page is valid for the complete session (only for stateful BSP applications) |
messages |
Instance attribute |
Reference to the messages-object of this BSP |
Signature |
method
get_application |
Description |
This method returns the application object for this BSP. If no application class was defined for the BSP application of this page, a zero (0) reference is returned. |
Parameter |
- |
Return Values/Exceptions |
application Name of the BSP application |
Cross References |
Signature |
method
get_application_name |
|
Description |
This method returns the name of the BSP application of this page as defined in the development environment (transaction SE80). |
|
Parameter |
- |
|
Return Values/Exceptions |
name |
Name of the BSP application |
Cross References |
- |
|
Signature |
method
get_application_start_page |
|
Description |
This method returns the start page of the corresponding BSP application as defined in the development environment (transaction SE80). If no page was explicitly specified, the method returns the name default.htm. The start page of a BSP application is called if no specific page is included in the URL when the application is started, in other words, when the URL ends with the application name. |
|
Parameter |
- |
|
Return Values/Exceptions |
start_page |
Start page of the BSP application |
Cross References |
- |
|
Signature |
method
get_application_url |
|
Description |
This method returns a server-specific URL that references the current BSP application, for example /sap/bc/bsp/sap/retailstore. |
|
Parameter |
- |
|
Return Values/Exceptions |
url |
Server-specific URL of current BSP application |
Cross References |
- |
|
Signature |
method
get_attribute |
||
Description |
This method returns the value of the requested attribute. Since attributes can be of any type, the return value can only be untyped and must be integrated type-related when called.
ABAP move logic plays a role in the assignment of the attribute value to the return value to enable the type conversion to take place. The ABAP restrictions regarding type conversion apply so that exceptions may occur in the event of incompatible type assignments. |
||
Parameter |
name |
Name of attribute (case-insensitive) |
|
Return Values/Exceptions |
value |
Attribute value |
|
cx_bsp_inv_attr_name |
Exception: Attribute does not exist |
||
Cross References |
set_attribute() |
||
Signature |
method
get_lifetime |
||
Description |
This method returns the current settings of the lifetime of this BSP page (see lifetime_..-constants of the IF_BSP_PAGE-INTERFACE). This method has no effect on stateless applications and always returns the value lifetime_request. |
||
Parameter |
- |
|
|
Return Values/Exceptions |
lifetime
|
Current
lifetime of the BSP (see lifetime...-constants of the IF_BSP_PAGE): |
|
Cross References |
set_lifetime, lifetime_page, lifetime_request, lifetime_session |
||
Signature |
method
get_page_name |
|
Description |
This method returns the name of this BSP. |
|
Parameter |
- |
|
Return Values/Exceptions |
name |
Name of the BSP |
Cross References |
- |
|
Signature |
method
get_page_url |
|
Description |
This method returns the server-specific URL for this BSP. |
|
Parameter |
- |
|
Return Values/Exceptions |
url |
Server-specific URL of the BSP |
Cross References |
- |
|
Signature |
method
get_request |
|
Description |
This method returns an interface reference to the current HTTP Request Object. |
|
Parameter |
- |
|
Return Values/Exceptions |
request |
Interface reference to the HTTP Request Object |
Cross References |
||
Signature |
method
get_response |
|
Description |
This method returns an interface reference to the current HTTP Response Object. |
|
Parameter |
- |
|
Return Values/Exceptions |
response |
Interface reference to the HTTP Response Object |
Cross References |
||
Signature |
method
get_runtime |
|
Description |
This method returns an interface reference to the current BSP Runtime Object. |
|
Parameter |
- |
|
Return Values/Exceptions |
runtime |
Interface reference to the BSP Runtime Object |
Cross References |
- |
|
Signature |
method
serialize |
|
Description |
This method serializes the content of this page (after processing in the layout event handler) in a string. This method is typically only called in the OnManipulation section of the BSP when the generated output needs to be postprocessed. However, for performance reasons this is not recommended unless absolutely necessary.
The output of a BSP is no longer automatically returned to the client in the HTTP Response when this method is called explicitly. Instead, the developer is responsible for sending it. This can be done with the method if_http_response~set_cdata() and the HTTP Response Object. |
|
Parameter |
- |
|
Return Values/Exceptions |
data |
Serialized response of the BSP after the layout section is processed. |
Cross References |
||
Signature |
method
set_attribute |
|
Description |
This method sets the value of the specified attribute. Since attributes can be of any type, the return value can only be untyped and must be integrated type-related when called.
This method does not let you define new attributes dynamically at runtime. On the contrary, only attributes that were defined in the development environment (SE80) statically for the BSP page can have values assigned. Otherwise, the method will terminate with the exception cx_bsp_inv_attr_name.
ABAP move logic plays a role in the assignment of a value to the attribute to enable the type conversion to take place. The ABAP restrictions regarding type conversion apply so that exceptions may occur in the event of incompatible type assignments. |
|
Parameter |
name |
Name of attribute (case-insensitive) |
value |
Value of attribute (appropriately typed) |
|
Return Values/Exceptions |
cx_bsp_inv_attr_name |
Exception: Attribute does not exist |
Cross References |
get_attribute() |
|
Signature |
method
set_lifetime |
|
Description |
This method returns the current lifetime of this BSP page (see lifetime_..-constants of the IF_BSP_PAGE). This method has no effect on stateless applications. |
|
Parameter |
lifetime |
New lifetime
of the BSP (see lifetime...-constants of the IF_BSP_PAGE): |
Return Values/Exceptions |
- |
|
Cross References |
get_lifetime, lifetime_page, lifetime_request, lifetime_session |
|
Signature |
method
to_string |
|
Description |
This method formats as a string the value of a scalar ABAP variable with any type. There are several optional parameters available to let you control the formatting. The string generated can be easily integrated in the output in a BSP using the output directive <%= .. |
|
Parameter |
value |
Value to be formatted |
format |
Output format (see if_bsp_page~co_format_..-constants) |
|
outputlength |
Maximum output length (in characters) |
|
num_decimals |
Number of decimal places |
|
reference_value |
Reference value (for example, the currency) |
|
Return Values/Exceptions |
output |
Formatted output string |
Cross References |
write() |
|
Signature |
method write
|
|
Description |
This method outputs as a string the value of a scalar ABAP variable with any type. Output is at the current “write position” in the BSP. There are several optional parameters available to let you control the formatting. This method can be used for output in a BSP for example, in script directives <% .. %>. |
|
Parameter |
value |
Value to be formatted |
format |
Output format (see if_bsp_page~co_format_..-constants) |
|
outputlength |
Maximum output length (in characters) |
|
num_decimals |
Number of decimal places |
|
reference_value |
Reference value (for example, the currency) |
|
Return Values/Exceptions |
- |
|
Cross References |
to_string |
|
Signature |
method
otr_trim |
|
Description |
This method returns the language-dependent text for an OTR alias (short text) This method is available from SAP Web AS 6.20 Support Package 7. |
|
Parameter |
alias |
Name of the defined OTR alias |
Return Values/Exceptions |
text |
Text in current language |
Cross References |
||