cancel
Showing results for 
Search instead for 
Did you mean: 

Personas 3.0 SP02: How to call a lib function defined in another script of other screen?

Former Member
0 Kudos
113

Hi,

There is a function, myLib(), defined in a script A in screen A, and I want to call this function from script B in screen B.

I experienced that sometimes personas works, but sometimes it reported that the lib function is undefined. Why?

When I use the script id, do I have to add screen number or tcode as well?

I also experienced that some other event was triggered in such way.

Thanks in advance.

Dong

Accepted Solutions (1)

Accepted Solutions (1)

clemens_gantert
Active Participant
0 Kudos

Hi,

please take a look at the following KBA Scripting: Including Global Javascript Libraries - SAP Imagineering - SCN Wiki

for the "official" way of using scripting libraries.

If you just need your flavor to work in the WebGui, then you can can just attach your library to the browser's window object. You can do this in an onLoad script. The library should then live until you refresh the browser. You can create window objects explicitly by "window.mylib = ..." or by omitting the "var" keyword when defining a variable e.g. "mylib=...".  The key is that you have to define/initialize your library at a central location that you are sure will be called first by all users.

Cheers,

Clemens

Answers (0)