Home > BaaN, Infor > Baan Wrappers – eXtending the BaaN code without the source code

Baan Wrappers – eXtending the BaaN code without the source code


Most of my clients till date , had the source code with them so never was the need to dig into wrappers. Wrappers are really useful when you don’t have the source code. It gives the power to add the additional functionality before and after the standard 4GL events, just like what the user exit dlls do in Infor LN.

How the wrapper works ?
As already mentioned wrappers provide the execution power of additional functionality before/after the standard functionality even when you don’t have the standard source code. For eg. the object “otdpur4100” exists in standard VRV {B40C_C4_STND} and no source code is available , there is a derived VRC for the customer say {B40C_C4_CUST}, the wrapper will reside in the derived VRC, it will have the program script (tdpur4100)
Below is the sample wrapper code which will give you an idea of how it look likes

Declaration:
   .....................
before.program:
	|Get the Path of the Object to be loaded
	 ret = get.parent.object("td", "pur", "4100", objt.path)
	
	if ret = 0  then
		message("Object Path not found")
		|Parent object not found. Cannot continue in %s.
		|Do not Start the Session
		stop()
	endif	
	
	|Load the Object and get the Object ID
	objc.id = load_dll(objt.path)
	if objc.id  = 0 then
		message("Object not found")
		|Parent object not loaded. Cannot continue in %s.
		|Do not Start the Session
		stop()
	endif	
	func.id = get_function(objc.id, "before.program")
	exec.id = exec_function(objc.id, func.id)
after.update.db.commit:
	func.id = get_function(objc.id, "after.update.db.commit")
	exec.id = exec_function(objc.id, func.id)
|******************************** form section *********************
form.1:
init.form:
	func.id = get_function(objc.id, "init.form.1")
	exec.id = exec_function(objc.id, func.id)
|******************************** choice section *********************
choice.zoom:
before.choice:
	func.id = get_function(objc.id, "before.choice.zoom")
	exec.id = exec_function(objc.id, func.id)
	imported.orno = tdpur040.orno
       	 export("imported.orno",imported.orno)

The first thing to be done is get the path of the object to be read, now this can be very tricky , you have a very big VRC tree, your latest object can be in any branch of the tree. You need to get the path of the latest object available. Once you are successful in reading the latest object , you will have to load the dll object in the memory for further processing.

The two magic functions are get_function(object id, event section) and exec_function(object id, function id). You can call this functions in any 4GL section of the wrapper script. bic_info6.1 will provide the entire details of the object, you can either write a shell script to retreieve the data you want or write a 3gl like RUSH project. Any code written before the execution of exec_function() will be executed before the standard code execution and that written after will get executed after the standard code execution. You can further simplify and enhance your wrapper based on your knowledge of BaaN.

In Infor LN user exit dlls plays somewhat same role.

QKey was one of the most popular Wrapper Utility used, really not sure where it is available.

Check out the Baanboard link for a very nice similar opensource project started by MohanaVamsi Potluru and Praveen Ambekar for simplifying the wrapper process.
BaaNboard

Advertisements
Categories: BaaN, Infor Tags: ,
  1. Ganesh
    January 16, 2014 at 7:02 pm

    Thank You!!! Your Blogs have always been of good help.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: