cancel
Showing results for 
Search instead for 
Did you mean: 

Screen Personas 3 - Passing values through different scripts

0 Kudos

Hello,

I would like to know if it's possible to pass values from fields that are in a screen, to another fields that are in another screen ?

My need is that i have to save the values from the fields in the screen 1, then press Enter key to enter the second screen, and then, apply the saved values to the new fields.

The problem is that i can save the values in a script, using variables, in the first screen, but then, when i press the Enter key, to enter the next screen, i have to create another script for this new screen, and retrieve the values of my variables in this new script.

But doing this way seems not work.

The only possible way would be to create a custom button, affect a script that contain :

- Variables with the value of the fields of my first screen

- Press Enter key

- Affect variables to my new fields for the second screen.

All in the same script.

I can do that, but if the user press the Enter key, this script is not executed, so the user access the second screen without the needed values in the fields.

I tried to find a way to apply  a script to the Enter key (or the standard SAP button associated) but didn't find it.

Do you know how i can do to fill the fields from a screen, with the values of fields in another one, without doing it in the same script ?

I don't know if my explanations are understandable. Let me know if not.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you restrict yourself only to Personas running in the browser then you can create objects in the global "Window" object that will persist until the browser page is refreshed. In particular you can access them from any flavour in any subsequent transaction.

This works in both Personas 2 and Personas 3.

Be aware, though, that this trick does not work in Personas 3 when run in the Windows or Java GUIs since they do not have a global Window object in their scripting environment.

Steve.

0 Kudos

hi steve,

I would discourage to use windows object for reasons you have put.

I would recommend to use

session.utils.put("key","value")

session.utils.get("key")

This way, the "key" value is saved for entire session irrespective of which screen you are in.

Check here:

Scripting Utility Methods - SAP Imagineering - SCN Wiki

@Olivier..There are some screen events which you can use to execute a script when user press ENTER rather than clicking on the button.

You can find more about it over here:

Available Events for Scripting - SAP Imagineering - SCN Wiki

Let me know if you need example for this.

Regards,

Sushant

Former Member
0 Kudos

Thanks Sushant. I hadn't registered that the put and get utilities had been finalised. If all you need to store are string objects then those are certainly the preferred method as they'll work in all GUIs.

Steve.

0 Kudos

Hi Sushant,

Many Thanks for your solution.

I didn't noticed that it was possible to use these kind of events.

that will solve my problem

By the way also thanks you Steve for your solution, even if it's not recommended, i will keep in mind there's solutions like this.

Former Member
0 Kudos

The get and put methods only work for strings. Occasionally I find it useful to store other things, objects for instance, and then there's no other way. But that does limit you to web only. That's a big restriction. Use with care...

Steve.

Answers (0)