Page Attribute

Use

Page attributes are parameters that are declared explicitly for a page. You can access the page attributes in the layout and in all event handlers. You use page attributes to store data that is determined in the event handler OnInitialization, and you can use the page attributes to make the data accessible to layout processing and the remaining event handlers. On the other hand, access to the content of the page attributes is not automatic at all times. If, for example, you fill an internal table in OnIntialization that you have defined as a page attribute, although this definition is known in OnInputProcessing, the table contents is not known if you are working in stateless mode. For more information, see below.

There are two types of page attributes:

  • Automatic page attributes

  • Non-automatic page attributes

Automatic page attributes

If you mark a page attribute as 'automatic' (auto in the system), the attribute automatically gets its values via the calling URL or via the navigation process from other pages. This kind of attribute only has to be declared for one page. It is identified by its name equivalence. If another page uses a parameter of the same name then this one gets assigned the same value at runtime.

Possible types for auto-page attributes

Before SAP Web Application Server 6.10, auto page attributes could only have the type STRING.

Further types are now possible:

  • Elementary types except for XSTRING

  • Structure

  • Tables

Non-automatic page attributes

If you flag a page attribute as non-automatic, the attribute is provided with values using class attributes.

Parameter transfer between pages: Visibility of page attributes

The visibility of page attributes when parameters are transferred between BSP pages depends on whether the navigation is explicit or implicit.

  • Explicit navigation:

    For example, if navigation>goto_page(page.htm) is called, this is explicit navigation. It is not important if it is navigated to the same page where you are coming from.

    The page object must be reinstantiated for explicit navigation. When the page object is being reinstantiated, in both stateful and stateless mode, the attributes with navigation>set_parameter must be transferred to auto page attributes of the same name, so that the values that were set are not lost.

  • Implicit navigation:

    User input triggers the sending of a request. As no explicit navigation is specified, the same page is executed again.

    With implicit navigation, the page attributes are transferred automatically from OnInputProcessing to OnInitialization, both in stateful and stateless mode.

    The auto page attributes are refilled by the request, both in stateful and stateless mode.

    The difference is that, in stateful mode, any non-auto page attributes that may have changed retain the changed value, whereas in stateless mode, the values are reset to the original values. This is because the page instance is retained in a stateful case and the object is reinstantiated for a stateless case.

Lifetime of page attributes

There are the two following cases of different lifetimes of automatic and non-automatic page sttributes when navigating between pages:

  • Lifetime of attributes when remaining on the same page

  • Lifetime of attributes when navigating on the same page

  • Lifetime of attributes when navigating to another page

Lifetime of attributes when remaining on the same page

No navigation takes place.

Attribute Type

Value in Request (Example Value)

Value in OnInputProcessing

Explicit Transfer

Value in OnInitialization

Automatically

SAP

SAP

No

SAP

Automatically

SAP

SAP

Yes

SAP

Non-automatic

SAP

No

SAP

Non-automatic

SAP

Yes

SAP

Lifetime of attributes when navigating on the same page

The navigation object is used (navigation>goto_page(samepage.htm)) to navigate to the same page.

Attribute Type

Value in Request (Example Value)

Value in OnInputProcessing

Explicit Transfer

Value in OnInitialization

Automatically

SAP

SAP

No

Automatically

SAP

SAP

Yes

SAP

Non-automatic

SAP

No

Non-automatic

SAP

Yes

Lifetime of attributes when navigating to another page

The navigation object is used (navigation>goto_page(otherpage.htm)) to navigate to a different page.

Attribute Type

Value in Request (Example Value)

Value in OnInputProcessing

Explicit Transfer

Value in OnInitialization

Automatically

SAP

SAP

No

Automatically

SAP

SAP

Yes

SAP

Non-automatic

SAP

No

Non-automatic

SAP

Yes