View Single Post
  #10  
Old 12th February 2016, 09:23
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,310
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,

Here is a sample of creating Adjustment Order using DAL.

Code:
dal.new.object("whinh520")
	dal.set.field("whinh520.orno","5")
	dal.set.field("whinh520.cwar","003")
	dal.set.field("whinh520.adrn","XYZ")
	dal.set.field("whinh520.emno","10")
	dal.set.field("whinh520.mnad",tcyesno.yes)
	ret = dal.save.object("whinh520")
	if ret = 0 then
		
		dal.new.object("whinh521")
		dal.set.field("whinh521.orno",whinh520.orno)
		dal.set.field("whinh521.pono",10)
		dal.set.field("whinh521.cwar","1003")
		dal.set.field("whinh521.item","         123456789                            ")
		dal.set.field("whinh521.loca","21")
		dal.set.field("whinh521.clot","0000000001")
		dal.set.field("whinh521.stun","NR")
		dal.set.field("whinh521.qadr",23)
		dal.set.field("whinh521.qrvr",23)
		dal.set.field("whinh521.adrn","ATZZ")
		ret = dal.save.object("whinh521")
		if ret = 0 then
			commit.transaction()
		else
			abort.transaction()
			dal.get.error.message(err)
		endif
		
	else
		abort.transaction()
		dal.get.error.message(err)
	endif

1. How can I trigger the DAL function from my custom MMT session?
- The DAL validations(if present) will automatically get triggered if you use dal.* functions.
2. If I am inserting an adjustment order and the reason I am using AFS is there maybe validation and triggers that need to happen just using simple db.update commands. Will does trigger any DALs related to entering Adjustment orders ?
- If you use db.* functions, the DAL won't be triggered. You need to use only dal.* functions in order to trigger the standard DAL.

For processing sessions i.e. where form commands are involved, you can go fo AFS and if in case you can find the DLL/DAL Business Method related to that, you can call that.

e.g. To process an adjustment order you can call -

Code:
whinh.dll5221.process.adjustment.orders( domain tcorno i.order.from, domain tcorno i.order.to, domain tccwar i.warehouse.from, domain tccwar i.warehouse.to, domain tcemno i.employee.from, domain tcemno i.employee.to, domain tcdate i.order.date.from, domain tcdate i.order.date.to, domain tcpono i.order.line.from, domain tcpono i.order.line.to, boolean i.report.open, boolean i.with.commit, boolean i.progress.indicator, ref long o.number.of.processed.lines )
Refer ttstpbaandoc for the input and output parameters to this DLL.
e.g.

Code:
ret = whinh.dll5221.process.adjustment.orders(

						whinh521.orno,

						whinh521.orno,

						warehouse.from,

						warehouse.to,

						employee.from,

						employee.to,

						order.date.from,

						order.date.to,

						whinh521.pono,

						whinh521.pono,

						false,

						true,

						false,

						dummy.number.of.lines.processed)
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote