LittleJohn
2nd August 2002, 03:13
Hi,

I'm trying to Maintain Outbound Data(tdilc4101m000) using the Function Server API calls. The data is in a ASCII file.

I'm on Baan IVc2 (No Source Codes).

The manual process would be to run the tdilc4101m000 session, input the values of Run Number, Order Type & Ord #... and futher on hit the "Lines" Button. This would start the sub-session tdilc4102s000.
(The 'Lines' button on the tdilc4101m000, is the Continue button)

In the tdilc4102s000 subsession, I would just enter the Position Number. The Seqn (serb) defaults automatically. I would just insert the Qty and save the record.

I'm trying to use the Function Server to work this out.

After I do the required "put" func calls, I do a "get" just to check the values.... The problem I'm facing is, the other fields like Item, Warehouse, Date, Unit, etc never get populated at all and this results in the record not being saved.

It comes up with a error "Command Cancelled" when I do the f4102s000.update(1, err.msg)

The other strange thing is, When I look up the various process started in the background (Option Dialog, "ps"), apart from the processes tdilc4101m000 and tdilc4102s000, there is a third process that comes up... it is tdilc4513s000.
(No idea why this comes up, and does not get killed when I try to kill it through the API call handle.sub.process().... quite a tough customer ;) )

I'm attaching the script, Can someone please help me working out this solution. Thanks a lot.

Adios
Minhaaj

f4101m000.put.Run(hold.runn)
f4101m000.put.k.o.order(hold.type)
f4101m000.put.ordernr(hold.pdno)
f4101m000.handle.sub.process("tdilc4102s000", "add")
f4101m000.continue(err.msg)
f4102s000.handle.sub.process("tdilc4513s000", "kill")
if isspace(err.msg) then
f4102s000.put.Order_Type(hold.type)
f4102s000.put.Order_Number(hold.pdno)
if item.exists = 1 and hold.pono <> 0 then
f4102s000.put.Position_Number(hold.pono)
endif
f4102s000.put.Sequence_No.serb(temp.serb)
f4102s000.put.tdilc401.qstr(hold.qty)
f4102s000.save(err.msg)
f4102s000.update(1, err.msg)
f4102s000.end()
endif
f4101m000.end()

mark_h
2nd August 2002, 15:26
You should be able to ignore that subsession - until you start ending the sessions. We are on 4c3 (also without source). You may want to make sure you have the current API tools patch and maybe even newest version of these sessions. Here is a quick test I did to update the quantity on a specific order.


stpapi.put.field("tdilc4101m000","runnumber","aaaa")
stpapi.put.field("tdilc4101m000","k.o.order",str$(tdilc.koob.act.sfc))
stpapi.put.field("tdilc4101m000","ordernr","312013")
stpapi.handle.subproc("tdilc4101m000","tdilc4102s000", "add")
stpapi.continue.process("tdilc4101m000",msg)
stpapi.put.field("tdilc4102s000","tdilc401.qstr","1")
stpapi.update("tdilc4102s000",1,msg)
stpapi.end.session("tdilc4513s000")
stpapi.end.session("tdilc4102s000")
stpapi.end.session("tdilc4101m000"


My ttstpcreatdll does not work right now. Sigh.

Mark

LittleJohn
2nd August 2002, 20:05
Hi Mark,

Thanks for the good lead. I'll try and install the latest versions available for Baan IVc2.

In case you might know it, Can you please let me know what the latest API version for BaanIV might be, I mean, If its a common one across BaanIV ?

Btw, Were you able to duplicate this process successfully at your end ?
I still am facing the same problem. I hope it gets resolved with the new patch installation.

Cheers
Minhaaj

mark_h
2nd August 2002, 20:50
In the previous example I only updated a line. In this example I inserted the line.


stpapi.put.field("tdilc4101m000","runnumber","aaaa")
stpapi.put.field("tdilc4101m000","k.o.order",str$(tdilc.koob.act.sfc))
stpapi.put.field("tdilc4101m000","ordernr","312013")
stpapi.handle.subproc("tdilc4101m000","tdilc4102s000", "add")
stpapi.continue.process("tdilc4101m000",msg)
stpapi.put.field("tdilc4102s000","tdilc401.pono","10")
stpapi.put.field("tdilc4102s000","tdilc401.loca","CB0509D")
stpapi.put.field("tdilc4102s000","tdilc401.qstr","3")
| stpapi.update("tdilc4102s000",1,msg)
stpapi.insert("tdilc4102s000",1,msg)
stpapi.end.session("tdilc4513s000")
stpapi.end.session("tdilc4102s000")
stpapi.end.session("tdilc4101m000")


Notice I used the stpapi.insert command. I ran it in debug mode to check the msg and it was empty after the insert. You might want to try the insert first. Evidently I did not read the original message - I saw the update and just assumed you wanted to update a record not insert a new record. I took a screen print of the outbound, then deleted it, then ran the above insert. The printout matched what this insert did. You may not have to put the same fields, for this part I had to change the location to something that was valid. Actually if the location was valid all I would have add to put was the position number, the location and quantity default - at least they did manually.

In all honesty I do not know if it is the same across versions. I always hesitate to post solution numbers since it may not be the same. I would hate to recommend something that may not work on another system or worse broke something different. I would prefer that people contact Baan and get the latest versions of the tools or sessions for their system. We are on 4c3 with the A&D extension, so patches for our system would probably not be the same as patches for the commercial system.

Hope this helps!

Mark

LittleJohn
6th August 2002, 18:56
Hi Mark,

I think you were absolutely right in mentioning the "insert" sequence. I thought the "save" might do the job.
This works fine now.
I'm anyway installing the lastest patch objects for the stpapi handlers.

Thanks again for your help Mark. Appreciate it.

Regards
Minhaaj