raikar_raviraj
13th March 2008, 04:47
Hi,
I am trying to achieve negative outbound functionality via AFS.
When i try to enter negative issue quantity in ticst0101m000 - Enter Material Issue for Production Order it suppresses it to zero hence i am not able to do Maintain Outbound for the same. I checked the AFS log, i see no discrepancy in the log.
here is the AFS code ive written.
function enter.material.issue()
{
msg1 = ""
ret.mesg1 = ""
select ticst001.*
from ticst001
where ticst001._index1 = {:lhnst103.pdno}
order by ticst001._index1 desc
as set with 1 rows
selectdo
run.order = lhnst103.pdno
stpapi.put.field("ticst0101m000","ticst001.pdno",str$(run.order))
rc = stpapi.change.view("ticst0101m000",msg1)
if isspace(msg1) then
run.pono = ticst001.pono + 10
run.item = lhnst103.item
run.qty = -1 * (lhnst103.quan + v_quan)
issu.qty = str$(run.qty)
stpapi.put.field("ticst0101m000","ticst001.pono",str$(run.pono))
stpapi.put.field("ticst0101m000","ticst001.sitm",str$(run.item))
stpapi.put.field("ticst0101m000","ticst001.cwar",str$(lhnst103.cwar))
stpapi.put.field("ticst0101m000","issu.quan",str$(run.qty))
stpapi.put.field("ticst0101m000","ticst001.bfls",str$(tcyesno.no))
stpapi.insert("ticst0101m000",true,msg1)
if isspace(msg1) then
stpapi.end.session("ticst0101m000")
update.issue.qty()
message("Production Order %d and Item %s Inserted on ticst0101m000",run.order,run.item)
else
message(""&msg1)
dsc1 = msg1
stpapi.recover("ticst0101m000",ret.mesg1)
stpapi.end.session("ticst0101m000")
endif
else
stpapi.end.session("ticst0101m000")
message("Production Order could not be inserted on ticst0101m000")
endif
selectempty
select max(ticst001.pono):maxpono
from ticst001 where ticst001.pdno = :lhnst103.pdno
selectdo
endselect
run.order = lhnst103.pdno
stpapi.put.field("ticst0101m000","ticst001.pdno",str$(run.order))
rc = stpapi.change.view("ticst0101m000",msg1)
if isspace(msg1) then
run.pono = maxpono + 10
run.item = lhnst103.item
run.qty = -1 * (lhnst103.quan + v_quan)
stpapi.put.field("ticst0101m000","ticst001.pono",str$(run.pono))
stpapi.put.field("ticst0101m000","ticst001.sitm",str$(run.item))
stpapi.put.field("ticst0101m000","ticst001.cwar",str$(lhnst103.cwar))
stpapi.put.field("ticst0101m000","issu.quan",str$(run.qty))
stpapi.put.field("ticst0101m000","ticst001.bfls",str$(tcyesno.no))
stpapi.insert("ticst0101m000",true,msg1)
if isspace(msg1) then
update.issue.qty()
stpapi.end.session("ticst0101m000")
message("Production Order %d and Item %s Inserted on ticst0101m000",run.order,run.item)
else
message(""&msg1)
dsc1 = msg1
stpapi.recover("ticst0101m000",ret.mesg1)
stpapi.end.session("ticst0101m000")
endif
else
stpapi.end.session("ticst0101m000")
message("Production Order could not be inserted on ticst0101m000")
endif
endselect
}
Is negative value possible through AFS???
I am trying to achieve negative outbound functionality via AFS.
When i try to enter negative issue quantity in ticst0101m000 - Enter Material Issue for Production Order it suppresses it to zero hence i am not able to do Maintain Outbound for the same. I checked the AFS log, i see no discrepancy in the log.
here is the AFS code ive written.
function enter.material.issue()
{
msg1 = ""
ret.mesg1 = ""
select ticst001.*
from ticst001
where ticst001._index1 = {:lhnst103.pdno}
order by ticst001._index1 desc
as set with 1 rows
selectdo
run.order = lhnst103.pdno
stpapi.put.field("ticst0101m000","ticst001.pdno",str$(run.order))
rc = stpapi.change.view("ticst0101m000",msg1)
if isspace(msg1) then
run.pono = ticst001.pono + 10
run.item = lhnst103.item
run.qty = -1 * (lhnst103.quan + v_quan)
issu.qty = str$(run.qty)
stpapi.put.field("ticst0101m000","ticst001.pono",str$(run.pono))
stpapi.put.field("ticst0101m000","ticst001.sitm",str$(run.item))
stpapi.put.field("ticst0101m000","ticst001.cwar",str$(lhnst103.cwar))
stpapi.put.field("ticst0101m000","issu.quan",str$(run.qty))
stpapi.put.field("ticst0101m000","ticst001.bfls",str$(tcyesno.no))
stpapi.insert("ticst0101m000",true,msg1)
if isspace(msg1) then
stpapi.end.session("ticst0101m000")
update.issue.qty()
message("Production Order %d and Item %s Inserted on ticst0101m000",run.order,run.item)
else
message(""&msg1)
dsc1 = msg1
stpapi.recover("ticst0101m000",ret.mesg1)
stpapi.end.session("ticst0101m000")
endif
else
stpapi.end.session("ticst0101m000")
message("Production Order could not be inserted on ticst0101m000")
endif
selectempty
select max(ticst001.pono):maxpono
from ticst001 where ticst001.pdno = :lhnst103.pdno
selectdo
endselect
run.order = lhnst103.pdno
stpapi.put.field("ticst0101m000","ticst001.pdno",str$(run.order))
rc = stpapi.change.view("ticst0101m000",msg1)
if isspace(msg1) then
run.pono = maxpono + 10
run.item = lhnst103.item
run.qty = -1 * (lhnst103.quan + v_quan)
stpapi.put.field("ticst0101m000","ticst001.pono",str$(run.pono))
stpapi.put.field("ticst0101m000","ticst001.sitm",str$(run.item))
stpapi.put.field("ticst0101m000","ticst001.cwar",str$(lhnst103.cwar))
stpapi.put.field("ticst0101m000","issu.quan",str$(run.qty))
stpapi.put.field("ticst0101m000","ticst001.bfls",str$(tcyesno.no))
stpapi.insert("ticst0101m000",true,msg1)
if isspace(msg1) then
update.issue.qty()
stpapi.end.session("ticst0101m000")
message("Production Order %d and Item %s Inserted on ticst0101m000",run.order,run.item)
else
message(""&msg1)
dsc1 = msg1
stpapi.recover("ticst0101m000",ret.mesg1)
stpapi.end.session("ticst0101m000")
endif
else
stpapi.end.session("ticst0101m000")
message("Production Order could not be inserted on ticst0101m000")
endif
endselect
}
Is negative value possible through AFS???