Smiffy
21st December 2001, 13:40
Hi
Can anyone help me? I am in the process of developing/testing a session, which lonks a number of processes together using STPAPI functionality. One of the sessions involved is Maintain Shipment Lines tpcin0102s000.
In my script I have performed an STPAPI.find command, (this works successfully checked it in debug). I achieved this by not using the Maintain Shipments session (tpcin0101m000), but by first selecting the field values that I required from table tpcin001 and then using STPAPI.find. However, during the processing of tpcin0102s000, which is again invoked after using STPAPI.insert, I get a fatal error;
Zero pointer: name in set.mem
Cannot continue in session-name
Use of NULL pointer on
Cannot continue in
.
When tpcin0102s000 is in debug I can see that it seems to perform the insert and initialise the fields. Each field is then validated. When this has completed, the error occurrs. Iknow it is not the validation that has caused the problem, as I tested this by temporarily commenting out the validation on the last field.
help !
thanks
mark_h
21st December 2001, 17:24
Smiffy,
Typically when I write one of these Function servers I always make sure I use the main session to call the sub-session. So if I understood you correctly you are doing a stpapi.find on the sub-session(tpcin0102s000) and by skipping the main session(tpcin0101m000) you might be missing some of the pointers the sub-session needs. I would call the main session, do a find in it and then let it launch the sub-session(which ever method it uses - stpapi.zoom, stpapi.handle.subproc). This should keep everthing in sync.
Good Luck!!
Mark
Smiffy
2nd January 2002, 11:16
Thanks for your help. I tried calling the main session first and then using the stpapi.zoom command. However, the whole session just freezes up and nothing happens. I seem to hit problems when calling one session using stpapi and then calling its subsession using stpapi. This whole function server stuff is frustrating and I am not impressed with the lack of help provided by baan on how it all works. I have a copy of the function server document that everyone seems to have, which doesnt go into much detail.
Sorry about the moan, I''l keep trying. I may be back to post my code. I could be missing something.
Thanks
Smiffy
2nd January 2002, 16:12
I have used the stpapi.find command on session tpcin0101m000.
If that is successful, I use stpapi.handle.subproc
Next, I use stpapi.zoom.option to start the subsession
Next, I use stpapi.insert for the subsession
I still get the same null pointer fatal error. If I do not use the stpapi.handle.subproc command, then the processing just seems to freeze, (in debug it just says processing, but never finishes)
thanks
Smiffy
2nd January 2002, 16:14
function create.shipment.line.etc()
{ long def.ship
string err.mesg1(200)
string err.mesg1a(200)
string err.mesg1b(200)
tpcin001.gcid = ""
tpcin001.ship = "ZZZZZZZZ"
def.ship = stpapi.find("tpcin0101m000")
if def.ship <> 1 then
tppss996.mess = "Default shipment record not found"
tppss996.type = "E"
stpapi.end.session("tpcin0101m000")
else
stpapi.handle.subproc("tpcin0101m000", "tpcin0102s000", "send")
stpapi.zoom.option("tpcin0101m000", 1, "tpcin0102s000", err.mesg1)
stpapi.insert("tpcin0102s000", 1, err.mesg1a)
import("shipqty.error2", wotsinit)
if strip$(wotsinit) = "ship qty error" then
tppss996.mess = "Delivery quantity exceeds completed quantity"
tppss996.type = "E"
else
stpapi.update("tpcin0102s000", 1, err.mesg1b)
|********generate outbound processing*********
generate.outbound.advice()
endif
endif
}
The fatal error occurs on the stpapi.insert command
Smiffy
2nd January 2002, 16:46
The last parameter of stpapi.handle.subproc should read 'add' not 'send' (i forgot to change it back, after trying other options).
- The above is not the solution - it still doesnt work
help !
mark_h
2nd January 2002, 21:49
I briefly glanced at the script for this session- luckily we have it. Under the choice.cont section it launches tpcin0102s000. So I am thinking this:
Do the find, then if the record is found do the handle.suproc, then do a continue on tpcin0101m000. This should launch tpcin0102s000 under your control. Then you could put what fields are needed on tpcin0102s000, and then do the insert on the tpcin0102s000 session.
From checking some of my other function servers I do not use the stpapi.handle.subproc when I use the stpapi.zoom.option. I am not sure if you removed that code that it might work. So there are a couple of things to try.
Also is this all of the code? I notice that before the insert on tpcin0102s000 that you do not put any data to fields? Granted I am not familiar with these two sessions, but usually you put something before doing an insert.
Mark
Smiffy
3rd January 2002, 11:17
After reading your last posting, I am questioning if I am going about this the right way. I will explain what I am trying to do.
Currently, when using tpcin0101m000 (on-line). I wish to select a record with Contract ID of empty ("") and Shipment number of "ZZZZZZZZ". Then I select 'Shipment Lines'. This activates tpcin0102s000 and displays the last shipment position.
At this stage, if the user selects the insert icon, the next available shipment position is displayed and the user can then enter data into some fields. When finished the user would save the record.
I am trying to handle this by stpapi functionality. If I have to alter the code of tpcin0102s000 to cater for when called by my new session and control the required processing, then I have no problem with that.
Am I wrong to use stpapi.insert ?
Thanks
Smiffy
3rd January 2002, 11:56
Thanks for your help Mark.
I feel a bit silly, now when I read the info on STPAPI.insert. This command allows you to insert a record into a table. This does not provide the same processing as the on-line clicking of the 'insert' icon.
I had previously tried changing the code, within tpcin0102s000 to perform a choice.add.set if called from my new controlling session. I was unsuccessful, but I think this was because I hadn't used stpapi.handle.subproc at that stage.
I will give an update I am succesful
thanks
Smiffy
4th January 2002, 17:02
I solved my problem as follows.
stpapi.handle.subproc("tpcin0101m000", "tpcin0102s000", "add")
stpapi.continue.process("tpcin0101m000", err.mesg1)
I used 'execute(add.set)' in the zoom.from.all section of the called sub session, (only if controlled/called originally by my new session - Also had to temporarily set api.mode to false).
thanks
mark_h
4th January 2002, 17:09
Thanks for the update. I am glad you found a solution.
Mark