|
|
Creating a BSP Application class to help store and pass data betwenn your BSP pages
Adding an application class to your BSP allows you to store and process data outside of your individual BSP pages. This means that
data is accessible across all pages and is not lost whether BSP is statefull or not. One disadvantage of using this method of
storing data rather than passing values between each page is that it might not be possible to link directly into the second or
3rd page of the application as processing maybe be required from page 1 inorder to make data available to other pages.
An advantage though is that you can pass data contained within tables between pages which cannot be done via
the navigation->set_parameter command (within OnInputProcessing).
Step 1 - Create basic BSP Application
Using Se80 to create a basic BSP Application (I.e. ZTESTBSP). Also ensure that it has been set to sateful within the 'Properties' tab.
Step 2 - Goto properties of BSP application
Double click on the BSP application name and then select the properties tab
Step 3 - Define and create application class
Within the application Class field enter a name such as Z_CL_TESTBSP and double click on it.
Select yes to the popup asking if you want to create class and the one asking if you want to save your BSP.
Step 4 - Application class type
You will be presented with another popup asking for class type and properties, leave default selections as below and press save.
Step 5 - All done
Right thats it, your application class is created, you can now define Attributes and Methods here and access them within
your BSP application using the 'application' instance name (not sure what the correct name of this is but see examples below).
Step 6 - Define Attributes
If you define an attribute (i.e. test) within your application class you can then access this attrinute within your
BSP application using the below syntax.
data: ld_test type string.
ld_test = application->test.
Step 7 - Define Method
If you define a method (i.e. GET_DETAILS) within your application class you can then access this method within your
BSP application using the below syntax.
CALL METHOD application->GET_DETAILS.
|