Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
17%
200 - 500 GB
17%
500 - 800 GB
6%
800 - 1200 GB
6%
1200 - 1500 GB
17%
1500 - 2000 GB
17%
> 2000 GB
22%
Total votes: 18

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 20th December 2017, 14:07
pralash pralash is offline
Senior Member
 
Join Date: Feb 2017
Posts: 225
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
How to create a User Exit DLL for a particular table
Baan: Other/Unknown
C/S: None/Unknown

Hi,

I'm new for LN Programming... I want to know about how to create User exit DLL for a baan table and also how to implement the programming logic for this dll. Can anybody please help me that how to use the User Exit DLL...
Thanks in advance,
Regards,
Pralash
Reply With Quote
  #2  
Old 20th December 2017, 15:01
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,355
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi Pralash,

From programmers guide -

Quote:
Overview
A User Exit DLL (UEDLL) is a DLL that will reside outside the standard software. It will have the same name as a standard DAL with the extension 'ue' (for 'user exit'). E.g. 'whinh200ue' for table whinh200. Customers can implement a UEDLL in order to be able to define extra business logic before and after the standard 'before' and 'after' handling of saves and deletes, by means of specific hooks that will be executed by the 4GL engine and/or DAL Engine. Stand-alone database operations (not triggered by saves and deletes of the 4GL engine or DAL Engine) are also extended to perform the extra business logic before and after performing the actual database operation. In this way it is possible to e.g. conditionally publish data changes to the outside world.

Interaction with 4GL Engine / DAL Engine
When present, the User Exit DLL for a certain table will be loaded by the 4GL engine/DAL Engine by the time the DAL for this particular table will be loaded. In situations where no DAL is present this will be the moment at which a DAL would be loaded if it existed. This means that there is no need to have a DAL in order to make use of the UEDLL.

Interaction with db operations
When one of the following database operations is executed stand-alone (so not as part of the standard save/deletes of the 4GL Engine or DAL Engine):

db.insert()
db.update()
db.delete()
and the User Exit DLL for the related table is present, the UEDLL will be loaded prior the database operation. This means that there is no need to have a DAL or a session in order to make use of the UEDLL.

Preconditions
A DLL becomes a UEDLL when it meets the following conditions:

Its name is consisting of the table code with 'ue' as suffix, like whinh200ue
It includes bic_dal, as follows: #include <bic_dal>
Restrictions
A UEDLL is treated like a regular DAL. This means all kind of DAL related functionality can be used, like:

Function with.old.object.values.do()
Function with.object.set.do()
Pre-defined variable subdal
Note however that the following restrictions apply:

Business methods cannot be implemented in a UEDLL Instead the business logic should be programmed in another (separate) general DLL.
It is strongly discouraged to define other external functions in a UEDLL and link the UEDLL directly to other scripts. Instead, use a normal general DLL. (This also applies to regular DALs).
Also,

Quote:
User Exit Hooks
A UEDLL script can contain the following hooks:

ue.before.before.save.object()
ue.after.before.save.object()
ue.before.after.save.object()
ue.after.after.save.object()
ue.before.before.destroy.object()
ue.after.before.destroy.object()
ue.before.after.destroy.object()
ue.after.after.destroy.object()
disable.ue.dll()
enable.ue.dll()
disable.table.extension()
enable.table.extension()
ue.get.origin()
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
Sponsored Links
  #3  
Old 20th December 2017, 15:03
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,355
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
In my own words -

If you want to write some logic on any kind of database transaction like insert, update or delete on a particular table, you can use a UE dll for that table.

e.g. You want to update table xxyyy001 when a record is inserted in table tdsls400

1. Create a program script
2. Provide the name as tdsls400ue and save it
3. In function after.after.save.object() you can write your code to insert record in table xxyyy001
4. You are done.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #4  
Old 21st December 2017, 06:27
pralash pralash is offline
Senior Member
 
Join Date: Feb 2017
Posts: 225
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Thanks a lot for your information Bhushan........
As you suggested, Can I use after.after.save.object() or ue.after.after.save.object() function for implementing the User Exit DLL operation... Please let me know that these two functions are same or different...

Regards,
Pralash
Reply With Quote
  #5  
Old 21st December 2017, 07:43
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,355
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
The function is a part of ue script which you need to created by following the steps I showed above.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #6  
Old 21st December 2017, 08:13
pralash pralash is offline
Senior Member
 
Join Date: Feb 2017
Posts: 225
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Hello,

As per your guidance, I have created a new table under the new module(emp - employee management system) in the name of tcemp101...
Then I try to create a new program script like "tcemp101ue" but it allows the name as "tcemp101u" instead of "tcemp101ue"... Here the last letter is missing in the program script... So how can I create the program script in the name of "tcemp101ue"... Can you please assist me.

Thanks,
Regards,
Pralash
Reply With Quote
  #7  
Old 21st December 2017, 09:16
pralash pralash is offline
Senior Member
 
Join Date: Feb 2017
Posts: 225
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Hi,

As you suggested, I have created User Exit script as tcemp101ue which contains 8 functions such as ue.after.before.save.object, ue.before.after.save.object etc.

I have the filed name such as tcemp101.code, tcemp101.name, tcemp101.dept etc. I also create a new table tcemp102 with the same fields of tcemp101.
When I insert a new record in tcemp101 by executing the session, I want to store the same record in tcemp102... So how can I perform this task using ue.after.after.save.object... Can you please tell me this sample UE script....

Thanks,
Regards,
Pralash
Reply With Quote
  #8  
Old 21st December 2017, 09:57
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,355
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi Pralash,

Just write the code like this in your UE -

Code:
function extern long ue.after.after.save.object(long mode)
{
        on case mode
        case DAL_NEW:
                |# Write code to insert data in another table  
                tcemp102.code = tcemp101.code
                tcemp102.name = tcemp101.name
                tcemp102.dept = tcemp101.dept
                db.insert(ttcemp102,db.retry,db.skip.dupl)
                break
        case DAL_UPDATE:
                | Update your table here
                break
        endcase
        
        return(0)
}
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #9  
Old 21st December 2017, 11:22
pralash pralash is offline
Senior Member
 
Join Date: Feb 2017
Posts: 225
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Hi bhushanchanda,
It's working fine for me... Thanks so much for your guidance....
Regards,
Pralash
Reply With Quote
  #10  
Old 22nd December 2017, 08:21
pralash pralash is offline
Senior Member
 
Join Date: Feb 2017
Posts: 225
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Hi Bhushan,

As you suggested, I insert a new record by using UE script... But when I update a table tcemp101, the corresponding table tcemp102 is not updated. But I got the error as shown in the attachement... (Record is locked)

My script is as follows...
function extern long ue.after.after.save.object(long mode)
{


on case mode
case DAL_NEW:
tcemp102.code = tcemp101.code
tcemp102.name = tcemp101.name
tcemp102.dept = tcemp101.dept
tcemp102.addr = tcemp101.addr
db.insert(ttcemp102,db.retry,db.skip.dupl)
dal.set.info.message("@%1s", "record is inserted...")
show.dal.messages(MSG.INFO)

break
case DAL_UPDATE:
tcemp102.code = tcemp101.code
tcemp102.name = tcemp101.name
tcemp102.dept = tcemp101.dept
tcemp102.addr = tcemp101.addr
db.update(ttcemp102,db.retry)
dal.set.info.message("@%1s", "record is updated")
show.dal.messages(MSG.INFO)

break
endcase
return(0)
}

Can you please assist me, how to perform the update operation in tcemp102, while update the record in tcemp101....
Thanks in advance,
Regards,
Pralash
Attached Images
File Type: png Capture.PNG (38.3 KB, 10 views)
Reply With Quote
  #11  
Old 2nd January 2018, 14:00
JaapJD's Avatar
JaapJD JaapJD is offline
Guru
 
Join Date: Sep 2002
Location: Netherlands
Posts: 791
JaapJD will become famous soon enoughJaapJD will become famous soon enough
Baan: BaanIV, BaanERP, ERP LN 6.1 - DB: Oracle, SQL Server - OS: Unix, Windows
Two things:
- Why a User Exit if you have a custom table? You can just create a DAL for that table. User Exits are meant to program some additional logic around standard tables.
- Before you can update a record you should read it for update:
Code:
select  tcemp102.*
from    tcemp102 for update
where tcemp102.code = :tcemp101.code
selectdo
        tcemp102.name = tcemp101.name
        tcemp102.dept = tcemp101.dept
        tcemp102.addr = tcemp101.addr
        db.update(ttcemp102,db.retry)
endselect
Reply With Quote
  #12  
Old 3rd January 2018, 06:34
pralash pralash is offline
Senior Member
 
Join Date: Feb 2017
Posts: 225
pralash is on a distinguished road
Baan: 9.0 - DB: SQL Server - OS: Windows 2012R2
Hi,

I'm fresher for LN Programming... In order to get the working ideas about User exit, I developed some sample programs....
Thanks so much for your guidance....
Regards,
Pralash
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use of "background" keyword in Baan kruyoupatel Tools Development 2 27th April 2016 07:03
How to create new user in infor ln fp7? anandpr1989 Tools Administration & Installation 0 30th January 2013 16:01
How to Create a temporary table in BaaN ashishjain Tools Development 5 11th May 2011 18:28
general functions for table field manipulations Hitesh Shah Code & Utilities 8 5th May 2006 06:00
Error 510 when create new user h3nry_99 Tools Administration & Installation 12 24th November 2001 14:25


All times are GMT +2. The time now is 01:05.


©2001-2018 - Baanboard.com - Baanforums.com