Skip to Content
Author's profile photo Bogdan Toma

Alternative approach to custom JARs

Today we’ll try to provide a (better) alternative to one cumbersome SAP standard process – deploying custom jars to SAP Sourcing.

I’ve always wondered who would go to such pain just to add one .jar to the classpath, when even standard Java has better options. And why?!


For example, my code breaks about 100 times before it’s ready to be fully tested. That means I would need about 1 year of BASIS time just to do 100 repacks and redeploys to test a piece of code.


So, let’s keep it simple:

STEP 1 – You’ll obviously need a jar 🙂 . Nothing better than a Hello World

/wp-content/uploads/2016/03/1_900783.png


STEP 2 – Copy jar file anywhere on the Sourcing server

/wp-content/uploads/2016/03/2_900784.png

STEP 3 – That’s ALL there is. We just need to use it now, like this:


// load jar before imports - this is where BeanShell beauty comes in
this.interpreter.getClassManager().addClassPath(new File("/usr/sap/xfer/CLM/btoma/Import/Path/HelloWorld.jar").toURI().toURL());
// @bogdan.toma
import com.tnd.eso.addons.playground.HelloWorld;
HelloWorld helloWorld = new HelloWorld();
throw new ApplicationException(session, helloWorld.getWorldStatus());

>>>>> result from testing STEP 3 on a toolbar script:

/wp-content/uploads/2016/03/3_900899.png

Indeed the world is doomed if we have to follow that ‘custom jar deployment’ process.

Regards,

Bogdan Toma

Check out some other cool topics below.

———————————-——————

SAP Sourcing scripts – editing and source control maintenance

[ANN] ScriptsRepo – Deploy Tool for SAP Sourcing Scripts

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Bogdan,

      Really cool.. wish I had come across your idea last year.. i actually wasted months of basis time (and mine) getting them to deploy/redeploy custom jars!!

      - Gayathri

      Author's profile photo Former Member
      Former Member

      Hello Bogdan,

      this solution is nice and it isn't time-wasting compared with the deployment of NWDI. I've got a question according to get access rights:

      Is the sourcing server identical with the operating system server?

      It would be nice if you will respond to my question 🙂

      Thank you in advance,

      Heiko