Hi Albert
Make sure your code is in Page Init.
And in a web app you want to be using sessions. See the following KBA for more details:
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow me on Twitter
Got Enhancement ideas? Use the SAP Idea Place