Any interaction between a browser and a server via a stateless HTTP protocol can use a unique value passed between the browser and server. This serves as special key to indentify other data maintained on the server that is never passed to the browser and not visible. It is analogous to a key in a database that identifies a row or multiple rows of data and can also server as a foreign key to other tables of data.
WAMs use a similar technique, using a unique identifier which is used as a way to determine the identity of the session and its access session state on the server.
You can use a similar method to share data between a WEBEVENT function and a WAM. All that is required is to pass a special unique identifier key between the browser and the server as the browser interaction progresses from WEBEVENT to a WAM and vice versa. The browser can simply store this value in a hidden field on the form, which is submitted with the form.
It is strongly recommended this identifier value is 32 bytes long and unique, to identify unique server data sets. WAM forms, by default, maintain and submit STDANCHOR field for this purpose. For WEBEVENT forms you should add this field to your DISPLAY/REQUEST commands to ensure it is also placed on your WEBEVENT forms. You should create this Alpha field of length 32 in your repository and use it in both your WAM and WEBEVENT code to retrieve data you wish to share between them. You can then use this field as a key into a database table that maintains shared data, or use operating system files with the key as a filename to maintain shared data.