SandraDiehl
9th February 2018, 19:27
I have search several of the post using AFS for outbound and I have outbound working in other aspects but I am getting the error Quantity (Storage Unit) not allowed yet I can do the manual Maintain Outbound and it defaults to the same storage unit LB as my item. Here is my code and while in debug I have verified the storage unit is LB, I last tried to let the system pick up it's own storage unit by comment out my line and it still gives same message. I wonder if problem is with item and not the code since we have convert non location/lot to location and lot. This item is not lot but is location control and I do have inventory in RAWMAT with unit of LB so not sure why? Any suggest would be great this is a high priority project for me.

|Call to the function
if insert.outbound(run.number, order.type, zzsfc015.pdno,
position, " RAWMAT", itm.cuni, need.qty,
"", date.num(), sera, serb, errmsg) then


|function
function domain tcbool insert.outbound(domain tcmcs.str12 runnumber,
domain tdilc.koob order.type,
domain tcpdno order.number,
domain tcpono order.position,
domain tdilc.loca order.location,
domain tccuni order.stun,
domain tcqiv1 order.qty,
domain tdltc.clot order.lot,
domain tcdate order.date,
ref string strsera(),
ref string strserb(),
ref string msg())
{
long ret
msg = ""
| ret = tt.align.according.domain(order.stun, order.stun, "tccuni")
stpapi.handle.subproc("tdilc4101m000","tdilc4102s000","add")
stpapi.put.field("tdilc4101m000","runnumber",runnumber)
stpapi.put.field("tdilc4101m000","k.o.order",str$(order.type))
stpapi.put.field("tdilc4101m000","ordernr",str$(order.number))
stpapi.continue.process("tdilc4101m000",msg)
if not isspace(msg) then
stpapi.end.session("tdilc4101m000")
return(false)
endif
stpapi.enum.answer("tdilc4102s000","tdilc4102.1",tcyesno.no)
stpapi.put.field("tdilc4102s000","tdilc401.pono",str$(order.position))
stpapi.put.field("tdilc4102s000","tdilc401.loca",order.location)
stpapi.put.field("tdilc4102s000","tdilc401.clot",order.lot)
stpapi.put.field("tdilc4102s000","tdilc401.date",str$(order.date))
| stpapi.put.field("tdilc4102s000","tdilc401.stun",order.stun)
stpapi.put.field("tdilc4102s000","tdilc401.qstr",str$(order.qty))
ret = stpapi.insert("tdilc4102s000",1,msg)
if isspace(msg) then
stpapi.get.field( "tdilc4102s000", "tdilc401.sera", strsera )
stpapi.get.field( "tdilc4102s000", "tdilc401.serb", strserb )
endif
stpapi.end.session("tdilc4513s000")
stpapi.end.session("tdilc4102s000")
stpapi.end.session("tdilc4101m000")
return(true)
}

SandraDiehl
9th February 2018, 22:23
I need to stressed that this process works for my items that are lot control when doing outbound, but when I am doing a non lot control item it gives this error.

mark_h
12th February 2018, 00:41
Have your tried one without entering the lot number and date. I have just wondering if putting one of those fields is triggering something in the code. I will check my code when I get to work tomorrow to see if I do anything.

SandraDiehl
12th February 2018, 14:29
Mark,
The logic that I included is without the lot number. I have two processes that does outbound, one is when I am reporting production which uses the lot number and this process is issuing the material that is raw material no lot number. All raw material is just location control and it seems to be happening with all my raw material. I have another developer that is working on another process as well attempting to automatically create the outbound and he too ran into the same error.
Currently my work around is just to write the record directly to tdilc401 and then do the release. I don't like doing this much rather use AFS to do the validations but there was NO true reason to be getting that error since I could use the same items in the session and it would pull up the LB without any issues.

mark_h
12th February 2018, 14:48
Code looks a lot like mine so makes me wonder if it might be data related. Have you tried multiple parts?


|******************************************************************************
|* API Code for Maintaining Outbound.
|******************************************************************************
function extern insert_outbound( domain tcmcs.str12 runnumber,
domain tdilc.kooa order.type,
domain tcorno order.number,
domain tcpono order.position,
domain tdilc.loca order.location,
domain tccuni order.stun,
domain tcqiv1 order.qty,
domain tdltc.clot order.lot,
domain tcdate order.date,
ref string strsera(),
ref string strserb(),
ref string msg())
{
msg = ""
stpapi.handle.subproc("tdilc4101m000","tdilc4102s000","add")
stpapi.put.field("tdilc4101m000","runnumber",runnumber)
stpapi.put.field("tdilc4101m000","k.o.order",str$(order.type))
stpapi.put.field("tdilc4101m000","ordernr",str$(order.number))
stpapi.continue.process("tdilc4101m000",msg)
if not isspace(msg) then
stpapi.end.session("tdilc4101m000")
return
endif
stpapi.enum.answer("tdilc4102s000","tdilc4102.1",tcyesno.no)
stpapi.put.field("tdilc4102s000","tdilc401.pono",str$(order.position))
stpapi.put.field("tdilc4102s000","tdilc401.loca",order.location)
| 092404.st - Add lot and date to insert outbound.
stpapi.put.field("tdilc4102s000","tdilc401.clot",order.lot)
stpapi.put.field("tdilc4102s000","tdilc401.date",str$(order.date))
| 092404.end
stpapi.put.field("tdilc4102s000","tdilc401.stun",order.stun)
stpapi.put.field("tdilc4102s000","tdilc401.qstr",str$(order.qty))
rc = stpapi.insert("tdilc4102s000",1,msg)
if isspace(msg) then
stpapi.get.field( "tdilc4102s000", "tdilc401.sera", strsera )
stpapi.get.field( "tdilc4102s000", "tdilc401.serb", strserb )
endif
stpapi.end.session("tdilc4513s000")
stpapi.end.session("tdilc4102s000")
stpapi.end.session("tdilc4101m000")
}


Is there any possibility that the part you are trying might have some of the flags set that might make it think it is lot controlled?

mark_h
12th February 2018, 14:53
I went and found where I call my routine - in my case the lot and date are empty in that table below.

insert_outbound(tdapi401.runn, tdilc.kooa.act.sfc, tdapi401.orno, tdapi401.pono,
tdapi401.loca, tiitm001.stgu, tdapi401.qsts, tdapi401.clot, tdapi401.date,
strsera, strserb, errmsg)