gilforum
30th September 2002, 13:05
Hi,
I made a script to simulate the session tisfc0202m000.
I used the AFS to generate the dll.
When i ran the script to a range of production orders it appeared the following message:
"Order is being reported by another user"
I think that can be a conflict in the program.

mark_h
30th September 2002, 15:29
Could it be that you are attempting to complete a production order that is already complete? Because if that is the case you could always check the order status before running it through the function server session. I guess I am not sure of your question.

Mark

gilforum
30th September 2002, 19:15
Hi, Thanks for your reply.
There is my source code.
I created a table ttigil001 which contains the production orders that i want to process.
For each record in the table, the system executes the function: contabilizarstock(pdno).
The funtion contabilizarstock(pdno) simulates the session to a specific production order.


declaration:
table ttisfc010
table ttigil001

#pragma used dll ottstpapihand | Baan API Handler


choice.cont.process:
on.choice:


select tigil001.pdno
from tigil001
where tigil001.pdno>0
selectdo
contabilizarstock(tigil001.pdno)
commit.transaction()
selectempty
message("Não há ordens de fabrico a processar")
endselect



functions:


function void ContabilizarStock(domain tcpdno ordem_fabrico)
{
string erro(60)
string cod_erro(20)

message("%s",ordem_fabrico)
gilfm000.put.production_order (ordem_fabrico)
gilfm000.mark()
gilfm000.continue(erro)
message(erro)

cod_erro=gilfm000.get.last.message.code()
message (cod_erro)

gilfm000.define.enum.answer("tisfc02029",tcyesno.yes)
gilfm000.define.enum.answer("tisfc02028",tcyesno.yes)
gilfm000.update(1,erro)
message(erro)
}

mark_h
30th September 2002, 20:46
Some things I noticed - first unless you plan on do a for update on your table the commit.transaction is not needed.

Second in your subroutine you need to do a find on the production order before doing the update. Here is an abbreviated version of what I would expect to see.


long rc

| Define answers before needed.
gilfm000.define.enum.answer("tisfc02029",tcyesno.yes)
gilfm000.define.enum.answer("tisfc02028",tcyesno.yes)
gilfm000.put.production_order (ordem_fabrico)
rc = gilfm000.find()
If rc <> 1 then
Error record not found
stop function server
endif

gilfm000.put.Quantity.to.complete(somevalue)
gilfm000.continue(erro)
if isspace(erro) then
Error code
stop function server
endif


This is just from what I recall about the session. I am not sure you need to mark the record.

Mark

Mark

gilforum
1st October 2002, 16:01
Hi.
Thank you for the help.

manorit
9th September 2010, 00:25
Hello gilforum,
I am also facing the same problem.could you please tell me wht you did to resolve this issue?
i will really appreciate you help.
Thanks
Monica

mark_h
9th September 2010, 15:35
Post your code and we might see something in it that is causing the problem. I think for the above he just needed a find command before the update.

manorit
9th September 2010, 16:53
Hello Mark,

Please check the below code .its same as you posted above..still giving error"Order is being reported by another user" when i truied to continue.

if count1 <= (tisfc001.qrdr - tisfc001.qdlv) then
stpapi.enum.answer("tisfc0202m000","tisfc02029",tcyesno.yes)
stpapi.enum.answer("tisfc0202m000","tisfc02028",tcyesno.yes)

stpapi.put.field("tisfc0202m000", "tisfc001.pdno",str$(awsfc987.pdno))
if stpapi.find("tisfc0202m000", err.msg) = 1 then
stpapi.mark("tisfc0202m000",err.msg)
stpapi.put.field("tisfc0202m000", "tisfc001.qdlv",str$(count1))
stpapi.continue.process("tisfc0202m000",err.msg)
endif
stpapi.end.session("tisfc0202m000",err.msg)
err.msg = ""
endif

mark_h
9th September 2010, 19:45
Try removing the stpapi.mark - should not be needed.

manorit
10th September 2010, 07:22
Ok i will with this..thank you Mark..