Archive

Archive for the ‘BaaN’ Category

How To #8 – Can I bypass DAL in my program ? #baanhowto #LNHowto

February 17, 2017 Leave a comment

Please be careful when you are doing this, I assume you already know what you are doing.

But yes off course, you can bypass DAL in your program. The below piece of code will do it all for you, this will prevent all the DAL checks on the main table for the session.

before.program:
disable.dal()

I wouldn’t recommend bypassing DAL at all, its good to have it on. But if you have some customization where you can’t avoid it, you can’t avoid it.

Quick Submit

Categories: BaaN, ERP, HowTo, Infor Tags: , ,

How To #7 – How to retrieve the description of the label ? #baanhowto

September 26, 2013 Leave a comment

It is always a good practice to maintain labels instead of simply typing the descriptions on the static forms/report layouts. You can understand the importance of the labels when you are working in multilingual environment.

Many a times there is need to retrieve the description maintained for a label code. You can easily achieve this with a predefined function “tt.label.desc()”

Syntax

void tt.label.desc( string label_code(19), long label_context, ref string desc() mb )

Description
This returns information of the specified label.

Arguments

label_code : The label code, including the package code.

label_context : The label’s context.
The possible values are:
•1 General Use (for labels on forms and reports)
•2 Session, Table or Report Descriptions
•3 Enumerate descriptions
•4 Index descriptions
•5 Chart descriptions
•6 Menu and menu field descriptions
•7 Chart Application Option descriptions
•8 Business Object descriptions
•9 Subfunction descriptions
•10 Form Command descriptions
•11 Descriptions for External Use
•12 Cascading item on button descriptions

desc : This returns the longest description (in the user’s current language) of the specified label.

Categories: BaaN, How to, HowTo, Infor Tags: , , ,

How To #6 – How to find a domain of a variable ? #baanhowto

September 25, 2013 2 comments

In many cases, we require to know the domain of the variable or table field. This can be achieved very easily using
domainof() function.

Syntax

string domainof( variable )

The domainof() function is a compile time function which returns the name of the domain of the supplied variable. Make sure that the variable passed as an argument must be a domain type, otherwise it will result in a compile time error. You can also pass the table fields to the function as an argument.

Quick Submit

Categories: BaaN, How to, HowTo, Infor

Error Logging DLL (Baan / Infor LN)

September 24, 2013 Leave a comment

Baan handles error logging very well, you must be using ttstperrlog session frequently to verify the logged errors. In many scenarios, we need additional error logging for write/process programs. It is really time consuming to create create traditional baan reports for error logging. So most of the times we prefer writing to a log file. Many of you must have already written the dlls to write your errors to the log file.

While going through the archives, I found one of my very first program for error logging, you may use it without any restrictions & enhance the same based on your needs. I will definately like to know the changes you have done, so request you to share the modifications & enhancements done.

This is no different, the DLL uses report name as an argument and passes the error string to the report. This gives you the flexibility to save the reports in any format you want based on the availibility of the devices in your environment.

The DLL lifecycle have three stages init, log & end.

The details are as below

init.log()

The function init.log will initialise the “error log report”, The user can provide the report code or pass a empty string as a parameter to the function,  In case of empty string the default report “rXXXXXXXXXXX” will open. The user can optionally pass the Report Title in the second argument under DSNtitle.

As a first step the developer will need to change the DEFAULT_REPORT & DEFAULT_TITLE values to the desired ones. There should be one report with the field error_desc with string datatype.

The init function will initialize & open the report. The init function will return the report id which is of type long.

log.error()

The log.error() function takes two parameters report id & error details. This can be called inside a loop multiple times provided the log is initiated.
The log.error() function will pass the error details to the report. The report id, which is the first parameter for the function is the id returned by init.log() function.

end.log()

This function will end the log by closing the report.

|******************************************************************************
|* Title                : Error Logging
|* Description:         : This DLL is used for logging errors
|* Original Author      : Niraj N. S. Kakodkar
|* Date                 : 16/02/2007
|******************************************************************************
|* Category             : Utility
|* Platform             : Independent
|*
|* License for Error Logging DLL
|*
|* Copyright 2007 - 2011 by Niraj N S kakodkar
|*
|* All Rights Reserved
|*
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation.
|*
|* NIRAJ KAKODKAR , Baanboard or Techbuzz (nirajsk.wordpress.com) DISCLAIM ALL
|* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NIRAJ KAKODKAR nor Baanboard
|* BE LIABLE FOR ANYSPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|******************************************************************************
|******************************************************************************

extern	domain 	tcmcs.s999m	error.desc
extern	domain 	tcmcs.str50	rep.name

|* Change the default report code & Title
#define DEFAULT_REPORT	"rxxxxxxxxxxx"
#define DEFAULT_TITLE	"ERROR REPORT"

function extern long init.log(	domain tcmcs.str15 _report, ...)
{
	DllUsage
		Input: 		Report Code or empty string as first argument
				DsNtitle -> Report Title
		Output:		Report Id
		Description:	The function init.log will initialise the "error log report", The user can
				provide the report code or pass a empty string, in case of empty string
				the default report "rxxxxxxxxxxxx" will open. The user can optionally pass the
				Report Title.
	EndDllUsage

	long    brp_id
	long	arg_count
	long	i
	long	long_value
	string	string_value(200)

	arg_count = get.argc()

	if arg_count > 1 then
		for i = 3 to arg_count step 2
			on case get.long.arg(i-1)
			case DsNtitle:
				string_value = get.string.arg(i)
				rep.name = shiftl$(strip$(string_value))
				break
			default:
				break
			endcase
		endfor
	else
		rep.name = DEFAULT_TITLE
	endif

	if(isspace(_report)) then
		_report = DEFAULT_REPORT
	endif

	brp_id = brp.open(strip$(_report)," ",1)

	if	(brp_id  2 then
		for i = 3 to arg_count step 1
			error_desc = " --------> " & get.string.arg(i)
			break
		endfor
	endif

	error.desc = ""
	if(rep.id > 0) then
		error.desc = record & error_desc
		brp.ready(rep.id)
	endif
}

function extern end.log(long rep.id)
{
	DllUsage
		Input: 		Report Id
		Output:		Void
		Description:	The function closes the report of which id is provided.
	EndDllUsage

	if(rep.id > 0) then
		brp.close(rep.id)
	endif
}

You can also find the code posted on baanboard at Error Log

 

Try http://meamapa.com , a google maps V3 application with added features. Use it, its free & developed by me. Waiting for your valuable comments & feedback to improve it.

Categories: BaaN, Infor Tags: ,

Check User Authorization for Package VRC – #Baan #undocumented #in

January 19, 2012 1 comment

What will you do to check the authorization of a user for particular package VRC, PROGRAMMATICALLY?

Don’t need to scratch your head, there is a dll available in ERP LN for the same. Here it goes

DLL

ttcmt.dll0005

DLL Function

long ttcmt.dll0005.authorization.for.packages   ( ref domain ttadv.cpac i.cpac() fixed,   
                                                      domain ttadv.vers i.vers, 
                                                      domain ttadv.rele i.rele, 
                                                      domain ttadv.cust i.cust, 
                                                  ref domain ttadv.cpac error.cpac )

This Function to check whether user is authorized for packages of a given vrc. It takes an array with packages, version, release, customer as input parameters and returns “true” is user is authorized.

Categories: BaaN, Infor Tags: ,

What’s your choice, while upgrading your ERP System ?

January 17, 2012 Leave a comment

Categories: BaaN, ERP, Infor Tags: , ,

Bringing colors to #Baan #Reports in Display browser #in

January 16, 2012 2 comments

“Can I get a color indicator on my Baan reports, its difficult for me to analyse huge data ?”, well that was one of my user at client site, very eager to know whether its possible. He had complaints about Baan Consultants, always turning off when it comes to colors in Baan.

Genuine!! his requirement was very much genuine. When there is so much hype in analytics, with tons of BI products coming up with beautiful visual reports, why is Baan lagging so behind and can’t even get some colors in its display browser ?

Well thats not true, Baan can show colorful reports. Haa!! I agree that the display browser is not so funky like genx reporting tools, but its not limited to black & white.

Surprised!! not many have used fg$

Here is what help says:

string fg$( long color )
Use this to set the foreground color of text, starting at the current cursor position.

The color argument can have the following values:
CW.BLACK CW.BLUE CW.GREEN CW.CYAN
CW.RED CW.MAGENTA CW.YELLOW CW.WHITE

It worked for me, my user was happy to see colors in their black & white reports

All you need to do is, add a variable of type string with length 2 in the report layout and assign the desired color conditionally. Whatever part you wanna display in desired color, simply enclose the part within this variable.

declaration:
	extern	domain	tcmcs.str2	color.strip

before.program:
	color.strip = fg$(CW.WHITE)

detail.1:
before.layout:
color.strip = " "
color.strip = fg$(CW.WHITE)
if VALID_PUR_PRICE then
	color.strip = fg$(CW.RED)
else
	color.strip = fg$(CW.GREEN)
endif

If there not a need for a color indicator conditionally, then there is even more simpler solution.

Here’s the report screenshot

Now my clients have intelligent demands :-), instead of colored text now they want highlights, well that simple too. Tick the reverse option.

Alternatively you can use bg$() for highlights
Lets see what help says about bg$()

string bg$( long color )

Use this to set the background color of the current window. The color argument can have the following values:

CW.BLACK CW.BLUE CW.GREEN CW.CYAN
CW.RED CW.MAGENTA CW.YELLOW CW.WHITE

Categories: BaaN, Infor Tags: ,
%d bloggers like this: