king1980
17th March 2010, 07:23
Hi ,
I am new to dal.
I want to use DAL in my session for create the Outbound advice .
Now how i can call the session and it's form commands using DAL .
Regards
king1980
ARijke
17th March 2010, 13:11
Hi,
A DAL is 1 tot 1 related to a table. For outbound advice there is already a DAL, whinh225.
Do you have a new table and do you want to build a new DAL for that table? Start with the general info http://www.baanboard.com/programmers_manual_baanerp_help_functions_dal_overview
Or do you have a session/DLL from where you want to create outbound advice records in whinh225 via the DAL of whinh225? Start here:http://www.baanboard.com/programmers_manual_baanerp_help_functions_dal_dam
regards
king1980
17th March 2010, 14:01
Hi ,
I want use std table whinh225, but i want to create the outbound advice as we are generating using AFS.
So how i can write code to ceraete outbound advice and then relese the advice?
Regards
king1980
vahdani
17th March 2010, 14:29
Hi,
to enter outbound advice I use something like:
select whinh220.*, tcibd001.*
from whinh220 for update, tcibd001
where whinh220.oorg = :i.oorg
and whinh220.orno = :i.orno
and whinh220.oset = :i.oset
and whinh220.pono = :i.pono
and whinh220.seqn = :i.seqn
and whinh220.item refers to tcibd001
selectdo
if whinh220.lsta <> whinh.lstb.open then
|Position is done!!
break
endif
select max(sern):last.sern
from whinh225
where oorg = :i.oorg
and orno = :i.orno
and oset = :i.oset
and pono = :i.pono
and seqn = :i.seqn
selectdo
endselect
rep.dqua = i.quan
dal.new.object("whinh225")
dal.set.field("whinh225.oorg", whinh220.oorg)
dal.set.field("whinh225.orno", whinh220.orno)
dal.set.field("whinh225.oset", whinh220.oset)
dal.set.field("whinh225.pono", whinh220.pono)
dal.set.field("whinh225.seqn", whinh220.seqn)
dal.set.field("whinh225.sern", last.sern + 1)
dal.set.field("whinh225.cwar", whinh220.cwar)
dal.set.field("whinh225.locf", i.loca)
dal.set.field("whinh225.item", whinh220.item)
dal.set.field("whinh225.cuni", tcibd001.cuni)
dal.set.field("whinh225.runn", "A1")
dal.set.field("whinh225.time", utc.num())
dal.set.field("whinh225.qadv", i.quan)
dal.set.field("whinh225.qads", whinh225.qadv)
dal.set.field("whinh225.mtim", mtime())
if whinh225.mtim = 0 then
|* try to prevent duplicates
dal.set.field("whinh225.mtim", utc.num())
endif
ret = dal.save.object("whinh225", db.return.dupl)
if ret = 0 then
db.update(twhinh220, db.retry)
e = whinh.dll4000.notify.automatic.outbound.process.run(
"A1",
array.element.added)
else
|show.dal.messages()
dal.get.error.message(o.emsg)
if isspace(o.emsg)then
o.emsg = "Error generating outbound advice!"
endif
err.mess = o.emsg
rprt_send()
endif
endselect
I release generated oiutbound advice using standard function:
whinh.dll4200.process.outbound(...)
ARijke
17th March 2010, 14:41
When using AFS then you need not to worry about DAL. You are executing the session logic. Whether the session is using the DAL is not of importance for you.
Instead of using AFS you could use a function like described by Vahdani.
king1980
17th March 2010, 16:11
Hi vahdani
What value i need to pass for array.element.added in the dll function.
Also where i can get the list of functions which are avilable in dll?
Regards
king1980
vahdani
19th March 2010, 13:10
Hi,
even if you do not have access to source codes, you can always use bic_info6.2 (http://www.baanboard.com/programmers_manual_baanerp_help_dynamic_link_libraries_object_information_tool) (in $BSE/bin) to get further information regarding any external functions and documentations (Information between dllusage and enddllusage if any) of any baan object. Here I used following:
bic_info6.2 -eu /baan/ln1/bse/application/whB61U_a_stnd/owhinh/oinhdll4200 > out.txt
to get this:
---------------------------DLL PROTOTYPES-------------------------------
function extern boolean whinh.dll4200.direct.release.requested(
domain whinh.oorg i.order.origin,
domain tcorno i.order.number,
domain tcsern i.order.set,
domain tcpono i.order.line,
domain tcpono i.order.sequence,
boolean i.back.flush.procedure,
domain whinh.outb i.action,
boolean i.advice.created )
Expl.: This function determines whether the "release" activity must be
executed automatically.
Pre: Line activities are already created
Post:
Input: i.order.origin - Order Origin
i.order.number - Order Number
i.order.set - Order Set
i.order.line - Order Line
i.order.sequence - Order Line Sequence
i.back.flush.procedure - Backflush Procedure Y/N
i.action - Current Activity
i.advice.created - Advice already present. If so, then
line activities are present as well.
Output: n.a.
Return: true if the activity must be executed automatically.
false if the activity must not be executed automatically.
function extern long whinh.dll4200.fill.skip.orders.for.shipping.constraint(
domain whinh.oorg i.order.origin,
domain tcorno i.order,
domain tcsern i.order.set,
domain tcpono i.order.line,
domain tcpono i.order.sequence,
domain tcscon i.shipping.constraint,
domain tcqiv1 i.shortage.quantity,
boolean i.back.flush.procedure,
domain whinh.outb i.action,
ref domain tcmcs.long io.skip.orders.allocated,
ref domain tcorno io.skip.order.array() fixed,
ref domain tcwset io.skip.order.set.array(),
ref domain tcscon io.shipping.constraint.array(),
ref domain tcyesno o.new.order.notified )
Expl.: This function determines whether an order line has a
shortage that blocks the release of the whole order
or the whole order set.
This blocking can be caused by the shipping constraint.
This blocking is only applicable if shipping constraint must be
checked during release advice and the relase advice is executed
automatically.
Pre: Line activities are already created
Post:
Input: i.order.origin - Order Origin
i.order - Order Number
i.order.set - Order Set
i.order.line - Order Line
i.order.sequence - Order Line Sequence
i.shipping.constraint - Shipping Constraint
i.shortage.quantity - Shortage Quantity
i.back.flush.procedure - Backflush Procedure Y/N
i.action - Current Activity
Output: io.skip.orders.allocated- number of orders / sets in array
io.skip.order.array - Array of orders that must be skipped
because of shipping constraint
io.skip.order.set.array - Array of order sets / sales order sets
io.shipping.constraint.array - Array of shipping constraints
o.
Return: 0/DALHOOKERROR
function extern long whinh.dll4200.process.outbound(
domain whinh.outb i.action,
domain tcyesno i.use.default.reports,
domain tcmcs.long i.advice.report,
domain tcmcs.long i.shortage.report,
domain whinh.oorg i.order.origin,
domain tcorno i.order.number,
domain tcwset i.order.set,
domain tcpono i.order.line,
domain tcpono i.order.sequence,
domain tcpono i.advice,
domain tcpono i.bom.line,
domain tcqiv1 i.qty.planned,
domain whinh.btno i.run fixed,
domain whhuid i.handling.unit,
domain tcdate i.shipping.date.from,
domain tcdate i.shipping.date.to,
boolean i.read.for.update,
domain whinh.oalg i.advice.log,
boolean i.mask,
boolean i.xdock,
domain whinh.load i.load,
domain whinh.shpm i.shipment,
domain whloca i.location,
domain tcyesno i.print.ownership,
domain tcyesno i.print.item.storage.conditions,
domain tcyesno i.print.location.storage.conditions,
boolean i.check.manual.process.allowed,
ref domain tcqiv1 o.qty.shortage )
Expl: General function for processing outbound advice. Outbound Advice
can be generated, released or undone, depending on the
input action:
- empty The next action according to the order type
- advise Generate the advise records. The inventory is
allocated on warehouse and location level.
- release Release the advise records for further
processing.
- direct Generate and directly release the advise.
- undo Released advise lines which are not yet
picked and not released advise lines are
removed.
- undo.release Released advise lines which are not yet
picked are put back on not released. The
advise is not removed.
- undo.advise Not released advise lines are removed.
Note: In case the outbound order line is read for update,
no commits are occuring
Only for items with status equal to active
(whwmd210.iwhs = whwmd.iwhs.active) an outbound advice
may be generated.
If the status is equal to tentative, a message must be printed
to the Shortage Report, stating the item is tentative and
cannot be issued.
NOTE: in case the warehouse on the outbound order line is
WMS controlled, this DLL will not do anything.
The 'Max Planned delivery date" is filled with the selection
field dldt.t of whinh420[0,1]m000. If selection field is
not enabled then the maximum time of today is taken.
Pre: db.retry.point must be set
The Outbound Order Line (whinh220) must be current when the
function is called with read for update (i.read.for.update' has
value TRUE).
Post: According to the input action
In case read for update is true, the outbound order line
(whinh220) should be updated after calling this dll and a
commit or abort has to follow.
In case read for update is false, the outbound order line is
updated within this dll, where also the commit and abort takes
place.
For action = create.advice also the commit or abort transaction
must be done by the calling program.
Input: - i.action : input action:
- advice
- advice.only
- direct.outbound
- release
- direct
- undo
- undo.advise
- undo.release
- backflush
- create.advice
- pick
- empty
- i.use.default.reporst : use default reports
- i.advice.report : advice report ID
- i.shortage.report : shortage report ID
- i.origin : order origin
- i.order : order number
- i.order.set : order set
- i.order.line : line number
- i.sequence : sequence number
- i.advice : advice - filled if release is requested for a
specific advice
- i.bom.line : Bom Line - filled if generate advice is
requested for a single BOM Line
- i.qty.planned : planned quantity to advise;
must only be filled when part of the
ordered qty must be advised
- i.run : runnumber
- i.handling.unit: handling unit to process (release or pick)
- i.shipping.date.from: Minimum date to select lines
of fulfillment plan
- i.shipping.date.to: Maximum date to select lines
of fulfillment plan.
- i.read.for.update
: true, the warehousing order line is already
read for update and must be updated
outside this dll.
false, the warehousing order line is not read
for update
- i.advice.log : advice log
- i.mask : true, if procedure must be followed
according the procedure-mask
false, advise/release and picking of inventory
(inclusive shipments) is done
automatically
- i.xdock : create X (cross) dock order for shortage
- i.load : the load to attache to the generated advice
- i.shipment : the shipment to attache to the generated
advice
- i.location : the location attached to the generated advice
- i.print.ownership : Print the ownership records Yes/No/empty
- i.print.item.storage.conditions: Print item storage conditions
yes/no
- i.print.location.storage.conditions: Print location storage
conditions yes/no
If 'empty' is passed for one of the print.fields
then default values are determined.
- i.check.manual.process.allowed :
- must be true when called from UI-scripts
- can be set to true for specific situations
- must be set to false otherwise.
Output: - o.qty.shortage : shortage quantity
Returns:0, Process Outbound OK
DALHOOKERROR, Process Outbound resulted in an error
function extern long whinh.dll4200.search.inventory.structure.for.locations(
boolean i.initialize,
domain tccwar i.warehouse,
domain tcitem i.item,
domain tcclot i.lot,
domain tcibd.sern i.serial,
domain tccuni i.ordered.unit,
domain tcqst1 i.ordered.quantity,
domain whhuid i.handling.unit,
domain tcowns i.ownership,
domain tccom.bpid i.owner,
ref domain whloca o.found.location,
ref domain tcdate o.found.inventory.date,
ref domain whwmd.pkdf o.found.package.def,
ref domain tccuni o.found.unit,
ref domain tcqst1 o.found.quantity )
Expl: This function searches for Locations where inventory is
present for the Item and Warehouse (also based on the other
input arguments). The functionality is similar to the outbound
advice action (see function search.inventory.structure).
Each time a stockpoint is found, the output is returned.
Note that whinh110 already has allocated whwmd250, so
whinr.dll2000 must skip the whwmd250 check.
Pre: -
Post: -
Input: i.initialize true for first call, else false
i.warehouse Warehouse
i.item Item
i.lot Lot Code
i.serial Serial Number
i.ordered.unit The unit of the ordered quantity
i.ordered.quantity Ordered quantity
i.handling.unit Handling Unit
i.ownership Ownership (Customer Owned / Consigned)
i.owner Owner
Output: o.found.location Location
o.found.inventory.date Inventory Date
o.found.package.def Package Definition
o.found.unit Unit
o.found.quantity Quantity
Returns:0 / DALHOOKERROR
function extern boolean whinh.dll4200.skip.line.for.shipping.constraint(
domain whinh.oorg i.order.origin,
domain tcorno i.order,
boolean i.set.order.set,
domain tcwset i.order.set,
domain tcpono i.order.line,
domain tcpono i.sequence,
domain tcmcs.long i.skip.orders.allocated,
const domain tcorno i.skip.order.array() fixed,
const domain tcwset i.skip.order.set.array(),
const domain tcscon i.shipping.constraint.array() )
Expl.: This function checks whether an order line must be skippped
because of shipping constraints.
If Shipping Constraint = Ship Order Complete then check whether
current order is in skip.order array
If Shipping Constraint = Ship Order Set Complete then check
whether order and set are in "skip arrays"
Pre:
Post:
Input: i.order.origin - Order Origin
i.order - Order Number
i.set.order.set - Indication whether order.set is filled
i.order.set - Order Set
i.order.line - Order Line
i.sequence - Order Line Sequence
i.skip.orders.allocated - Number of orders / sets in array
i.skip.order.array - Array of orders that must be skipped
because of shipping constraint
i.skip.order.set.array - Array of order sets
i.shipping.constraint.array - Array of shipping constraints
to be able to check order or
order and set.
Output: NA
Return: 0/DALHOOKERROR