beas_binbooking

beas_binbooking [parameter]

 

Booking-Transaction BIN-WAREHOUSE

 

set new Quantity, Weight and Volume in the bin (beas_whsbin) and item-Entry (beas_whsbinitem)

and write in the archive-table beas_whsbinjournal

 

Parameter

transaction-number

(oivk.transnum or oinm.transnum). if you work with sap8.8 or higher, work with oivk!

instance-number

(oivk.instance or oinm.instance)

batchnumber

(oitm.manbtchnum=Y: the batchnumer, oitm.mansernum='Y': the sri1.sysserial otherwise empty!

bincode

code of bin: beas_whsbin.bincode

rfid

rfid-number (only, if you work with it, otherwise empty

quantity

quantity

pers_id

the personal-number (beas_pers.pers_id) or empty.

station_id

the current station-name (or empty)

version

the program-name and -version from your program

 

 

 

Return:

Message

ok or the error-message in english

Errorcode

0 = do nothing, 1=ok, < 0 an Error

 

Error-Code

1

ok

0

no action. More Info see Message

Example:

Transaction-Quantity is zero ...

Item xxxx has been booked ...

No bin-entry found for transaction ...

wrong booking-quantity for transaction ... Your quantity is (0 or < 0)

-997

Error Check Transaction-Table for Transaction (error in sql-statement on oinm or oivk/oivl)

-998

Wrong Quantity (..) item xxx, Warehouse yyy. Open Qty is only ..., Your quantity is higher

-1000

item xxxx not found (in oitm)

-1001

error select information from table oitm

-2001

error select batch-information from table ibt1 or sri1

-2002

batch number (or serial number) not found in ibt1 or sri1

-2003

error booking batch number (or serial number) xxxx. Total Qty: ..., booked Qty: ..., booking Qty too high

-2005

serial number xxx wrong. ou must set the field sri1.sysserial. This is a integer-field! (this check, if the field is numeric...)

-2006

Wrong Quantity Item xxx. this is a serialnumber-item. Only Quantity 1 is allowed! Your Quantity: ...

-2008

error select booked-information (beas_whsbinjournal)

-1002

bin... not found in warehouse ...

-1003

error seek for bin... not found in warehouse (error in sql-statement)

-1010

error update new quantity in bin (beas_whsbin)

-1010

error get bin-Warehouse-Information beas_whsbinitem

-9001

quantity in Warehouse.., Bin ... for item .. not enough! Current stock: ...

-1004

error update beas_whsbinitem. Can not set new quantity (SQL-Error)

-1005

error write protocoll in beas_whsbinjournal (SQL-Error)

-1006

error write new quantity in beas_oinm

 

 

Example

@doctype = your document-type (String)
@docentry = your document-entry (String)
@linenum = your document-line (String)
@batchnum = your batchnumber or serial-intrserial as string or empty
@bincode = the bincode
@rfid is empty
@quantity = the quantity for this bincode 
@pers_id = the current beas_pers.pers_id-User (or empty)
@station = the current station-id (from client, not server)
@version = the current Name and Version from your program
 
// get Transaction and Instance from this document-line
 
select @transnum=oivk.transnum,@instance=oivk.instance
 from oivl  inner join oivk on oivk.transseq=oivl.transseq and layerid=0 
 inner join oitm on oitm.itemcode=oivl.itemcode
 where  oivl.transtype=@doctype and oivl.createdby=@docentry and oivl.doclinenum=@linenum
 
// Call the BinBooking
dbo.beas_binbooking @transnum,@instance,@batchnum,@bincode,@rfid,@quantity,@pers_id,@station,@version

 

if the return = 1, then all is ok, otherwise display the error

 

 

STORNO

you can create a Storno for a bin-transaction. For Storno set the Quantity  < 0

 

BIN-BIN-Transaction

BIN-BIN-Transaction have no SAP-Document

Obj-Type is 99

 

for a BIN-BIN-Transaction insert into beas_oinm 2 records

with a instance-Number bigger then 99000

select @transnum=isnull(max(transnum),0)  from beas_oinm;
select @instance=isnull(max(instance),0) +1 from beas_oinm where transnum=@transnum
if @instance < 99000
   set instance=990000

 

then insert 2 lines in beas_oinm for the issue and receipt

insert into beas_oinm (transnum,instance,transtype,beas_ref,itemcode,doclinenum,docdate,in0out1,quantity,openqty,warehouse) 
  values (@transnum,@instance,99,'',@itemcode,0,getdate(),1,@quantity,@quantity,@whscode)
insert into beas_oinm (transnum,instance+1,transtype,beas_ref,itemcode,doclinenum,docdate,in0out1,quantity,openqty,warehouse) 
  values (@transnum,@instance,99,'',@itemcode,0,getdate(),0,@quantity,@quantity,@whscode)

 

if Batchnum-Item, then insert the batchnumber in beas_oinm_batchnum (only for Information about this Transaction)

insert into beas_oinm_batchnum(transnum,instance,linenum,batchnum) values (@transnum,@instance,0,@batchnum)
insert into beas_oinm_batchnum(transnum,instance,linenum,batchnum) values (@transnum,@instance+1,1,@batchnum)

 

call the Booking-Procedure

dbo.beas_binbooking @transnum,@instance,@batchnum,@from-bincode,@from-rfid,@quantity,@pers_id,@station,@version
dbo.beas_binbooking @transnum,@instance +1,@batchnum,@to-bincode,@to-rfid,@quantity,@pers_id,@station,@version