Show TOC

Pass by Reference for AttributesLocate this document in the navigation structure

Procedure

Passing by reference is always appropriate if the BSP element is to have access to larger data quantities in the BSP page and passing "by value" would be too costly. This is the case if you have access to internal tables.

In addition, the pass by reference is used whenever the BSP element is to change the content of a variable defined in the BSP page.

Caution

Note that in this case you must also select the typing kind TYPE REF TO for the corresponding attribute.

Example

The BSP element is to increase the content of a passed variable by 1. The attribute value is required for passing the value. Calling this increment element into the BSP page could then take place as follows:

<xyz:increment value = "<%=my_var%>"/>

The variable my_var is declared in the BSP application as a page attribute of the type I.

For the value attribute, the indicator Dynamic Value Allowed was activated and TYPE REF TO was selected as Typing Kind in the attribute display.

To execute this pass by reference at the beginning of the element call, you need to overwrite the method DO_AT_BEGINNING:

        
method IF_BSP_ELEMENT~DO_AT_BEGINNING . add 1 to value->*. rc = CO_ELEMENT_DONE. endmethod.
         
Note

Note that there is a reference to data in this example within a BSP element. To access data, the reference operator ->* must be used in ABAP in this case.