srinivas
3rd January 2002, 11:52
Hi,

I am trying to generate a receipt using STPAPI. In the child process I am getting error message as 1. What does it mean?
Finally I am getting error "Command cancelled". That means the receipt number is not generated and hence update is not possible. How to generate this number? In manual process as you close tdpur4224s000 receipt number would be generated. but this is not happening here with API. Pls tell me where the problem is lying.

Thanks & Regards,
Srinivas


stpapi.put.field("tdpur4120m000", "tdpur045.reno", reno)
stpapi.put.field("tdpur4120m000", "form.dino", dino)
stpapi.put.field("tdpur4120m000", "tdpur045.orno", orno)
stpapi.put.field("tdpur4120m000", "tdpur045.pono", pono)

stpapi.handle.subproc( "tdpur4120m000", "tdpur4224s000", "add")
stpapi.put.field("tdpur4224s000", "form.orno", orno)
stpapi.continue.process("tdpur4224s000", error.msg)

Message("Child process error = %s",error.msg)

stpapi.end.session("tdpur4224s000")


chview=stpapi.change.view("tdpur4120m000")

stpapi.end.session("tdpur4224s000")


stpapi.put.field("tdpur4120m000", "tdpur045.orno", orno)
stpapi.put.field("tdpur4120m000", "tdpur045.pono", pono)


stpapi.save("tdpur4120m000",err)

ret.code = stpapi.find("tdpur4120m000")




stpapi.put.field("tdpur4120m000", "tdpur045.diqu", diqu)
stpapi.put.field("tdpur4120m000", "tdpur045.date", str$(work.date))
stpapi.put.field("tdpur4120m000", "tdpur045.dqua", dqua)


stpapi.update("tdpur4120m000", 1, err)

Message(err)

stpapi.save("tdpur4120m000",err)

stpapi.end.session("tdpur4120m000")

mark_h
4th January 2002, 18:42
Hi srinivas,

I am not sure I understand - are you creating or updating a receipt? From your questions it appears you are trying to create a receipt. Below is some sample code that creates a receipt on our system(too lazy to format it):

string err(50),reno(20)
long ret

stpapi.put.field("tdpur4120m000", "form.dino", "1")
stpapi.handle.subproc( "tdpur4120m000", "tdpur4224s000", "add")
| This activates the tdpur4224s000 session.
ret = stpapi.change.view("tdpur4120m000")
stpapi.put.field("tdpur4224s000", "form.orno", "411310")
stpapi.continue.process("tdpur4224s000", err)
if(strip$(err)<>"" and strip$(err)<>"Process is gone") then
Message("Child process error = %s",err)
endif
| No matter what kill the session.
stpapi.end.session("tdpur4224s000")
| Now get the receipt number just created.
stpapi.get.field("tdpur4120m000","tdpur045.reno",reno)
| At this point you could update receipt fields.
stpapi.end.session("tdpur4120m000")

The above code creates a receipt on our system. I did this as a test and I hope this helps you. Notice how I ignore the process is gone error. I have run into this before and even though I get an error it appears to have worked. That may not always be true and I always check it out.

I warned you that this was a tough one to start on. :)

Good Luck!

Mark

srinivas
7th January 2002, 06:35
Hi Mark,

I already successfully finished the update receipt part and I have posted it already as my reply in an earlier thread. I generated a receipt number manually and the updated the receipt quantity using STPAPI calls. Now I am creating a new receipt and for this I am stuckup during generating the receipt number.

I successfully tried making an Inventory adjustment also .

Let me try your suggestion and revert.

Thanks and Regards,
Srinivas

srinivas
7th January 2002, 08:20
Hi Mark,

I used your code. But it is not working. get.field is getting the already existing receipt number but I want to generate a new receipt number and update the other fields like quantity, date etc.

Using my earlier code if I try to insert a record by supplying the First free number for Receipts and Packing Slip number System is not accepting and saying that "Record already exists".

In the Child process I am getting an error message as "1" what does it mean?

If one wants to do a receipt manually then he would give a first free number, then pack slip number then order number in the session which pops up. When he presses continue a Receipt number is generated. How to achieve this ? I am getting a message "Record already exists" with my code. But that record is for serial number Zero. This serial number has to generated by the system it self.

Thanks and Regards,
Srinivas

Vignesh T
24th September 2016, 10:09
Hi Srinivas

I am doing the receipt update in Baan Daily. I am searching for some code that can be used to copy the receipt Number or Issue number from the excel sheet and update the same in the Baan. Can you please send me the file to my mail vignesh.thana@gmail.com.

Thanks in advance
T. Vignesh