Baanboard.com

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

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 25th November 2014, 14:33
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
user Exit dll 401ue
Baan: ERP LN 6.1 FP7
C/S: Client

I want to restrict user from decreasing the price from Sales Order Price field which by default get the prices from Price Book; any how I want to give them the authority to increase the price when needed. So, I created a User Exit dll as below which is not working.
PHP Code:
function extern long ue.before.before.save.object(long mode) {
        
on case mode
        
case DAL_NEW:
        
domain tcsess calling.session
         import
("prog.name$"calling.session)
         if (
calling.session "tdsls4100m900"then
                 select tdpcg031
.*
                    
from  tdpcg031
                 where tdpcg031
._index1 = {:1,"10000006",:tdsls401.item}
             
order by tdpcg031.exdt desc
              
as set with 1 rows
                   selectdo
                           
if tdsls401.pric tdpcg031.bapr then
                            
else
                               
dal.set.error.message("tigenstring","Updating processed records not allowed")
                               return(
DALHOOKERROR)
                            endif
            endif
                    
endselect
                
break
            return(
0)
        case 
DAL_UPDATE:
        break
        
endcase
        
return(0)

Reply With Quote
  #2  
Old 25th November 2014, 15:06
soumya093's Avatar
soumya093 soumya093 is offline
Member
 
Join Date: Apr 2014
Posts: 31
soumya093 is on a distinguished road
Baan: BAAN IV - DB: Oracle - OS: Windows 7
Hi
You have to write the same in DAL_UPDATE
__________________
In love with DAL
Reply With Quote
  #3  
Old 25th November 2014, 16:23
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
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,

As said, you need a DAL_UPDATE section to capture modifications after saving.

Also, if you want to give the error if price is below the price book price then the following will go wrong.

Code:
if tdsls401.pric < tdpcg031.bapr then 
                            else 
                               dal.set.error.message("tigenstring","Updating processed records not allowed") 
                               return(DALHOOKERROR) 
                            endif

You can use this

Code:
if tdsls401.pric < tdpcg031.bapr then  | or if double.cmp( tdsls401.pric, tdpcg031.bapr, 0.0001 ) = 1 then
                               dal.set.error.message("tigenstring","Updating processed records not allowed") 
                               return(DALHOOKERROR) 
                            endif
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #4  
Old 25th November 2014, 17:26
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
Should I make this in Customised VRC or standard VRC
as tdsls401ue
Reply With Quote
  #5  
Old 25th November 2014, 17:27
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
Is my logic right?
Reply With Quote
  #6  
Old 25th November 2014, 20:13
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
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,

As suggested write the same in DAL_UPDATE section as well and also try making the change I suggested.

Do it in your customized VRC.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #7  
Old 26th November 2014, 07:12
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
What should be the Script Type."General" , "DAL" or other.
Reply With Quote
Sponsored Links
  #8  
Old 26th November 2014, 07:32
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
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,

Just create a new script with name tdsls401ue and the type will be set by default.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #9  
Old 26th November 2014, 08:16
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
Created. but the above script is not able to select anything from
Quote:
select tdpcg031.*
from tdpcg031
where tdpcg031._index1 = {1,"10000006",:tdsls401.item}
and tdpcg031.efdt <=:tdsls401.odat
order by tdpcg031.efdt desc
as set with 1 rows
Reply With Quote
  #10  
Old 26th November 2014, 08:59
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
Its working fine with the below code.
Quote:
|******************************************************************************
|* tdsls401ue 0 VRC B61U a sfc
|* Sales Price Increase Authorization
|* baan
|* 14-11-25 [14:28]
|******************************************************************************
|* Script Type: Library
|******************************************************************************
|declaration:

table ttdsls401
table ttdpcg031

#include <bic_dal>


function extern long ue.before.before.save.object(long mode)
{
on case mode
case DAL_NEW:
domain tcsess calling.session
import("prog.name$",calling.session)
if (calling.session = "tdsls4100m900") then
|read.tdsls401()
select tdpcg031.*
from tdpcg031
where tdpcg031._index1 = {1,"100000006",:tdsls401.item}
and tdpcg031.efdt<=:tdsls401.odat
and tdpcg031.exdt>=:tdsls401.odat
order by tdpcg031.exdt desc
as set with 1 rows
selectdo
if logname$ <> "baan" or logname$ <> "yousri_d" then
else
if tdpcg031.bapr >= tdsls401.pric then
dal.set.error.message("@You are not authorised to decrease the Sales Order Price")
return(DALHOOKERROR)
else
endif

endif
endselect
endif

break
case DAL_UPDATE:
|read.tdsls401()
select tdpcg031.*
from tdpcg031
where tdpcg031._index1 = {1,"100000006",:tdsls401.item}
and tdpcg031.efdt<=:tdsls401.odat
and tdpcg031.exdt>=:tdsls401.odat
order by tdpcg031.exdt desc
as set with 1 rows
selectdo
if logname$ <> "baan" or logname$ <> "yousri_d" then
else
if tdpcg031.bapr >= tdsls401.pric then

dal.set.error.message("@You are not authorised to decrease the Sales Order Price")
return(DALHOOKERROR)
else
endif

endif
endselect
break
endcase
return(0)


}

function extern long ue.after.before.save.object(long mode)
{
on case mode
case DAL_NEW:
break
case DAL_UPDATE:
break
endcase
return(0)
}

function extern long ue.before.after.save.object(long mode)
{
on case mode
case DAL_NEW:
break
case DAL_UPDATE:
break
endcase
return(0)
}

function extern long ue.after.after.save.object(long mode)
{
on case mode
case DAL_NEW:


break
case DAL_UPDATE:
break
endcase
return(0)
}

function extern long ue.before.before.destroy.object()
{
return(0)
}

function extern long ue.after.before.destroy.object()
{
return(0)
}

function extern long ue.before.after.destroy.object()
{
return(0)
}

function extern long ue.after.after.destroy.object()
{
return(0)
}
Reply With Quote
  #11  
Old 26th November 2014, 09:01
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
I want to show the Fianance user the MAUC price when they want to decrease the price.

I have written select whina137.* statement
but how can I popup a message for finance user if they want to decrese the price.

HTML Code:
dal.set.message("MAUC Price %d", mauc.pri) is showing error.

Last edited by smusba : 26th November 2014 at 09:19. Reason: Personal
Reply With Quote
  #12  
Old 26th November 2014, 09:59
sachinbaan's Avatar
sachinbaan sachinbaan is offline
Senior Member
 
Join Date: Oct 2013
Posts: 166
sachinbaan is on a distinguished road
Baan: ERP LN - DB: MS SQL - OS: Microsoft Server
hi,

dal.set.message() will push your message to buffer, to pop up message box use dal.set.error.message() and return(DALHOOKERROR), and strat your message with "@".
__________________
Regards,
Sachin

TO DREAM THE PERSON U WOULD LIKE 2 B, IS 2 WASTE THE PERSON U R.
Reply With Quote
  #13  
Old 26th November 2014, 10:10
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
If I use dal.set.error.message and return(DALHOOKERROR) the message is displayed but Im not able to change the required price.
Reply With Quote
  #14  
Old 26th November 2014, 12:51
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
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,

Use,
Code:
dal.set.info.message("@your_message")
show.dal.messages(MSG.INFO)


Related Thread
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #15  
Old 26th November 2014, 13:53
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
Thanks a lot Mr. Bhushan,

The problem with this message is it appears but minimize at the same time.
Any other dal.message where it will appear on top of the screen.
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
User Exit DLL and text.rewrite. metropoj Tools Development 10 17th January 2013 09:41
Can you easily change field to 'read only' status ? metropoj Tools Development 7 8th September 2012 18:01
UE Script pur615 Tools Development 14 10th February 2011 20:30
Help regarding tools session rahul.kolhe22 Tools Development 4 22nd January 2010 13:31
Problem with Convert SSA ERP User to Database User instant000 Operating Systems & Databases 1 17th March 2009 17:29


All times are GMT +2. The time now is 00:33.


©2001-2017 - Baanboard.com - Baanforums.com