cancel
Showing results for 
Search instead for 
Did you mean: 

Can you call one script from another in BeanShell and receive a return value?

Former Member
0 Kudos

Hello Experts-

I'm an experienced programmer (mostly C++, C#), but new to SAP Sourcing v 9 scripting...

I have some logic that I need to use in several scripts and, for better maintenance, would like to not repeat the code everywhere.

Is there any way to write a utility function/script which can be shared by many scripts that, ideally, could take parameter(s) and return a result?  Perhaps it could be saved it in an "Explicitly Called Script" or somewhere else?  Or maybe it could throw a chained exception and I could intercept it somehow in the calling script?

Thanks in advance!

Mike

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Micheal,

Beanshell scripts are not available to be triggered from one another in the application. The best approach to this is to write a class for your functions and compile it into a .jar file that is deployed with the application as a custom jar file.

Then you can import the class and use it in your scripts. The drawback to this is the downtime needed to deploy the jar file.

I have weighed this option many times but found it to be too much work vs. just duplicating 15 to 50 lines of code for a few functions.

Alan

Former Member
0 Kudos

Ok. I was afraid that may be the case.

Thanks!

Mike

Answers (0)