cancel
Showing results for 
Search instead for 
Did you mean: 

Execute a script only on the first screen of a transaction.

johnsonzavier
Explorer
0 Kudos

Hi Persona Experts,

I have to switch to different flavors based on the value(equipment authorizaiton group/Floc Authorization group- got calling a RFC) on the first screen. The session.utils.changeFlavor is working. However I have added the script to event OnBeforeRefresh. It is invoked in each subsequent screen. can I avoid that?. Only call the script once for the transaction on the first screen(for performance and also the element name is different in second screen). onEnter preferably. First enter on the first screen. After that one call, the script should be "inactive'. I am doing this on IE03 and IL03 transactions. We are using personas 3, level(component) 9, Kernel 749 pathlevel 824 webgui patch level 823. Basis 750-0009.

Damean
Active Contributor
0 Kudos

Typically, if I just want to run a script once .. I would use Global Flag (Dummy text field) or Variable (via session.utils.put\get).

HTH

Accepted Solutions (0)

Answers (1)

Answers (1)

tamas_hoznek
Product and Topic Expert
Product and Topic Expert

You could use a flag via the session store (session.utils.put and session.utils.get) to indicate whether you already called the script in the transaction.

johnsonzavier
Explorer
0 Kudos

Thanks Tamas & damean-bf.chen. It is a good suggestion from both of you. However, if user goes back to first screen and enter a different number (Without restarting the transaction), then it will recognize it as already called and will not call again and hence it may be a wrong flavor for the number entered.

One other thing which I thought it may work is to check the element is existing in the screen using session.idExists. Since my field name in first screen is different than second screen, it will call the rest of the script only in first screen(with an if statement), which is what i want. it is working in HTML Gui, but not in SAPGUI for windows.

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

Well, on the first screen, you'd obviously have an onLoad script that clears the flag... or on that screen, rearrange your logic so that the onBeforeRefresh script is not disturbing things.

At any case, this can be resolved with some logic reorganization at appropriate events.

session.idExists should work in the Windows GUI too.