Archive for the ‘How to’ Category

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()”


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

This returns information of the specified label.


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.


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

How To #5 – What makes you forget me ? #baanhowto

November 23, 2011 Leave a comment

What makes you forget me ?

These are not my words, its “api.mode” whose trying to remind everyone, that the predefined variable exists and is really of use most of the times in BaaN customisations.

Being a tools consultant worked on multiple sites, Baan flavours and clients across the globe, one thing I have noticed is, “api.mode” is totally been forgotten at 5/10 clients I have visited.

Developers duplicate the entire session just to avoid a popping error message, when a session is running in a job or when AFS is used, despite of the fact that they know about “api.mode”, but missed to use it.

below is just a reminder and usage of “api.mode”

	if not api.mode then
	// Popup the message
        // Log the error message to error log 

Its that simple, If the value of the variable is 0, that means the application is not running at the background and has the UI.

Another programming feature highly missed out are the application locks, despite of the fact that people know that it exists. Will discuss more about the locks in future posts.

Quick Submit

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

How To #4 – Open a text editor in read only mode #baanhowto

November 21, 2011 3 comments

How to open a text editor in read only mode?

Lot many times, we forget minor things which may be of real importance in a customization , specially when you are at the client location. Lets consider a simple example of not allowing the user to edit text conditionally.

How will you achieve this ? Not really a big thing,  you just need to inform the text manager to open the editor in read only mode, so that even if the user opens the editor he/she can’t edit the text.

The  code snippet below will make the explanation more clear.

if (attr.textfield$ = "tcxxx001.txta" ) then
attr.textmode = 1
attr.textmode = 3

The if statement checks, if the Text Manager is using the text field assigned to the variable  “attr.textfield$“. Now if the condition is true, a value “1” is assigned to the variable “attr.textmode & “3” otherwise.

The variable “attr.textmode” informs the text manager how to react on, when a user tries to open the text editor (whether it should be opened in Read Only mode or Read/Write mode). The value “1”, makes the mode Read Only & “3” makes it Read/Write.

Both the variables can only be used in 4GL scritping.

Quick Submit

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

How To #3 – highlight (bold/underline) fields in Baan reports programmatically ? #baanhowto

November 4, 2011 Leave a comment

How to highlight fields in Baan reports programmatically?

Lot of times, there is a requirement to conditionally underline / bold / bold&underline  a specific report field. This can be achieved very easily in BaaN using the function cf$()

string cf$( long attribute_code ) 

This pre-defined function is used to send a control code to the current window or printer. All characters after the command are printed or displayed in the font associated with the control code. To reset the font to normal, call cf$(0).

Some of the commonly used  codes are

Code Screen Printer
0 normal normal
1 bold bold
8 underlined underlined
9 bold & underlined bold & underlined

Lets take an example which will make the usage more clear
eg. Make the project bold & underlined if the project is not active.

In the code snippet below, note that domain “tccprj” not used, instead “tcmcs.str8” is used.Assuming the environment is BaaN IV, the domain length for project is 6, unlike 9 in LN.The domain used for the variable is of length 8. This is to accomodate 2 more characters for making the project appear bold & underlined in the report and to avoid truncation of characters.

domain tcmcs.str8 r.cprj

|* Assuming the field will be printed in detail layout

         if not PROJECT.ACTIVE then

                   r.cprj = cf$(9) & PROJECT & cf$(0)


                   r.cprj = PROJECT


Quick Submit

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

How To #2 – display a colour indicator on Baan forms #baanhowto

October 14, 2011 Leave a comment

How to display a colour indicator on the Baan forms?

Many a times, customer asks for visual indicators displaying red/green colours on the baan sessions. These colour indicators may become so very useful sometimes for the user working on the shopfloor, because they don’t have to worry about the messages or reports popping up, on error. A “green” colour may indicate that the task is successful and “red” may indicate its failed. Many a time a person working on the shopfloor may not be literate enough to read the messages & reports popped up, and these colour indicators save them a lot of time.

function create.frame(){
   = create.object(DsCgwindow, current.mwindow(),
                                     DsNx, 410, DsNy, 55,
                                     DsNwidth, 20, DsNheight, 18,
                                     DsNbackground, color )

The code snippet, above is self explanatory, it creates a frame of  specified dimension and axis on above the parent main window with the color specified in the parameter. You can change the color based on certain conditions as per your requirement.

Lets dig more into the parameters used in the create.object()

The first parameter used in the type of the object created, here I have used “DsCgwindow” , This represents a window in which applications can draw graphical parts such as lines, rectangles, polygons, and so on.

The second parameter is the parent object,  current.mwindow(), This will provide the id of the current main window to which we need to attach the subobject.

Other optional parameters used are the  X & Y co-ordinates , width , height & Colour.

Quick Submit

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

How To #1 – Call a Report Layout Programmatically #baanhowto

October 8, 2011 Leave a comment

Tweeted a month back, to start a howto section for Baan ERP on my blog.Well starting it from today.I Would like to make this section totally interactive, you can submit your #howtos using the quick submit form below in the post or from submit howto page, and you can also correct me, or add your inputs to the howtos answered by me, in the comment section below. Howtos are mainly for those who are new to Baan, bringing more awareness of wide capabilities, Baan Tools can provide. Love the way Baan Tools is designed. While tweeting any howto post, please use #baanhowto, to make the information available under a single hash tag. Starting with the first howto.

Quick Submit

How to call a Report Layout Programmatically ?

Many a times, there is a requirement to call a particular report layout, conditionally after another layout. For example, you need After.Field layout to get printed, after every 5 records in Detail layout are printed. How will you do that ? In normal scenario, After.Field will get executed after all the records in Detail layout are printed.But in this scenario, we need to call the After.Field layout before all the records are printed and execution of Details layout is complete.

This can be achieved simply as shown in code snippet below

cnt = cnt + 1
if cnt > 5 then
cnt = 0

You can notice the function r.5.s.after.tdXXXXXX.YYYY() called in the before.layout of Detail.1. This function is a auto-generated function. When you compile your Report, Report Generator internally generates a script, defining the Report structure and Report flow based on the what you have maintained in the UI (Layouts maintained, Fields maintained in the Report Editor etc.). If you have two detail layouts say “detail.1” & “detail.2”, the auto-generated script will have the two layouts defined in functions “r.1.s.detail()” & “r.2.s.detail()” respectively. Similarly every layout maintained by you will have a respective function defined in the auto-generated script, which you can call in your Report script.

The image below provides the visual representation of the function’s naming convention.

stay tuned for more howtos, submit your howtos

Categories: BaaN, ERP, How to, Infor Tags: , , ,
%d bloggers like this: