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: Long output |
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: Display 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 |
End of the source code. |
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. |
Parameters |
- |
Return Values/Exceptions |
application Name of the BSP application |
Cross References |
Signature |
End of the source code. |
|
Description |
This method returns the name of the BSP application of this page as defined in the development environment (transaction SE80). |
|
Parameters |
- |
|
Return Values/Exceptions |
name |
Name of the BSP application |
Cross References |
- |
|
Signature |
End of the source code. |
|
Description |
This method returns the start page of the corresponding BSP application as defined in the development environment (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. |
|
Parameters |
- |
|
Return Values/Exceptions |
start_page |
Start page of BSP application |
Cross References |
- |
|
Signature |
End of the source code. |
|
Description |
This method returns a server-specific URL that references the current BSP application, for example /sap/bc/bsp/sap/retailstore. |
|
Parameters |
- |
|
Return Values/Exceptions |
url |
Server-specific URL of current BSP application. |
Cross References |
- |
|
Signature |
End of the source code. |
|
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. End of the caution. |
|
Parameters |
name |
Name of attribute (case-insensitive) |
Return Values/Exceptions |
value |
Attribute value |
cx_bsp_inv_attr_name |
Exception: Attribute does not exist |
|
Cross References |
Refer also to: set_attribute() |
|
Signature |
End of the source code. |
|
Description |
This method returns the current settings of the lifetime of this BSP page (see lifetime_ constants of the IF_BSP_PAGE). This method has no effect on stateless applications and always returns the value lifetime_request. |
|
Parameters |
- |
|
Return Values/Exceptions |
lifetime |
Current lifetime of the BSP (see lifetime_ constants of the IF_BSP_PAGE): lifetime_page | lifetime_request | lifetime_session |
Cross References |
See also: set_lifetime, lifetime_page, lifetime_request, lifetime_session |
|
Signature |
End of the source code. |
|
Description |
This method returns the name of this BSP. |
|
Parameters |
- |
|
Return Values/Exceptions |
name |
Name of BSP |
Cross References |
- |
|
Signature |
End of the source code. |
|
Description |
This method returns the server-specific URL for this BSP. |
|
Parameters |
- |
|
Return Values/Exceptions |
url |
Server-specific URL of the BSP |
Cross References |
- |
|
Signature |
End of the source code. |
|
Description |
This method returns an interface reference to the current HTTP request object. |
|
Parameters |
- |
|
Return Values/Exceptions |
request |
Interface reference to the HTTP request object |
Cross References |
See also: |
|
Signature |
End of the source code. |
|
Description |
This method returns an interface reference to the current HTTP response object. |
|
Parameters |
- |
|
Return Values/Exceptions |
response |
Interface reference to the HTTP response object |
Cross References |
See also: |
|
Signature |
End of the source code. |
|
Description |
This method returns an interface reference to the current BSP runtime object. |
|
Parameters |
- |
|
Return Values/Exceptions |
runtime |
Interface reference to the BSP runtime object |
Cross References |
- |
|
Signature |
End of the source code. |
|
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. End of the caution. |
|
Parameters |
- |
|
Return Values/Exceptions |
data |
Serialized response of the BSP after the layout section is processed. |
Cross References |
See also: |
|
Signature |
End of the source code. |
|
Description |
This method sets the value of the specified attribute. Since attributes can be of any type, the parameter 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. End of the caution.
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. End of the caution. |
|
Parameters |
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 |
See also: get_attribute() |
|
Signature |
End of the source code. |
|
Description |
This method sets the current settings of the lifetime of this BSP page (see lifetime_ constants of the IF_BSP_PAGE). This method has no effect on stateless applications. |
|
Parameters |
lifetime |
New lifetime of the BSP (see lifetime_ constants of the IF_BSP_PAGE): lifetime_page | lifetime_request | lifetime_session |
Return Values/Exceptions |
- |
|
Cross References |
See also: get_lifetime, lifetime_page, lifetime_request, lifetime_session |
|
Signature |
End of the source code. |
|
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 <%= .. %>. |
|
Parameters |
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 |
See also: write() |
|
Signature |
End of the source code. |
|
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 <% .. %>. |
|
Parameters |
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 |
See also: to_string |
|
Signature |
End of the source code. |
|
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. |
|
Parameters |
alias |
Name of the defined OTR alias |
Return Values/Exceptions |
text |
Text in current language |
Cross References |
See also: Internationalization and Translation |
|