patwanirav
11th September 2013, 11:20
I am unable to press "OK" button of the attached session "tfacp1210m000" through AFS.
When i use the "stpapi.continue.process" or "stpapi.save", it gives me error "Command Disable".
When i use stpapi.end.session, the data is not populated into the parent session. My code is as bolow.
stpapi.form.command("tfgld1101m100", 5, "enter.transactions", error)
ret = stpapi.synchronize.dialog("tfacp1110s000", "add", error)
stpapi.form.command("tfacp1110s000", 5, "copy.from.preregistration", error)
if isspace(error) then
stpapi.put.field("tfacp1210m000","tfacp100.ninv",str$(lpbpm501.ninv))
ret = stpapi.find("tfacp1210m000",error)
if isspace(error) then
ret_1 =stpapi.mark("tfacp1210m000", error)
stpapi.enum.answer("tfacp1210m000", "tfacps1110.3", tcyesno.yes)
stpapi.end.session("tfacp1210m000")
endif
endif
Now if the above code is perfect then why it is not populating data to the parent session "tfacp1110s000" through AFS. Because after writing the above code when i write code
ret = stpapi.insert("tfacp1110s000", 1, error )
it gives me error "Cash Flow reason must be filled."
Please help...
Thanks in advance...:)
mark_h
14th September 2013, 21:32
Typically the okay button is the same as the continue button. At least in 4c4 that is what it usually is - and I just use the continue command. So try just using the stpapi.form.command for continue - that might work. Having said that sometimes there is code in a standard session that might prevent AFS code from working. I am not familiar enough with LN to know how these sessions work or what would work with these sessions.
bhushanchanda
15th September 2013, 07:06
Hi,
As Mark said, LN works the same way. You need to use continue command to press the OK button.
Try this:-
stpapi.form.command( "tfacp1110s000", 5, "exec.cont.process", error )
vaishrii
7th March 2014, 07:11
This is in regard with the same case stated above..
I am facing the issue in AFS of Purchase Invoice Entry (tfacp2600m000) on ERP LN FP9 version.
From this session i want to zoom to subsession tfacp1210m000 to copy the Received Invoice...
The standard script of (tfacp2600m00) calls the function copy.from.preregistration()
and in this function the command to get the zoom.ninv value is ;
zoom.ninv = lval(start.session(MODAL,"tfacp1210m000", prog.name$,"tfacp100.ninv"))
and based on value returned from the zoom session the copy record function is executed i.e record from Received invoice(tfacp1210m000) is copied to main session tfacp2600m000
(table tfacp100 record is copied to tfacp200 and status is updated in tfacp100 to copied.)
The afs works fine for main session i.e Batch creation (tfgld1101m000) / transaction type entry. (tfgld1101m100)
but once tfacp2600m000 starts, it fails for copy.preregistration fucntion()
no value returned from zoom sesssion and i get the afs error 'Record not found' and hence unable to save the invoice in tfacp2600m000 session.
please refer the afs code below:
stpapi.put.field("tfgld1101m000", "tfgld100.year", str$(year))
stpapi.put.field("tfgld1101m000", "tfgld100.btno", str$(btno))
ret = stpapi.find("tfgld1101m000", error)
if ret then
stpapi.handle.subproc("tfgld1101m000","tfgld1101m100","add")
stpapi.put.field("tfgld1101m100", "tfgld101.year", str$(year))
stpapi.put.field("tfgld1101m100", "tfgld101.btno", str$(btno))
stpapi.put.field("tfgld1101m100", "tfgld101.ttyp", str$(ttyp)) ret_1 = stpapi.find("tfgld1101m100", error)
if ret_1 = 1 then
ret_1 = stpapi.mark("tfgld1101m100",error)
stpapi.form.command("tfgld1101m100", 5, "enter.transactions", error)
if ret_1 = 1 then
ret = stpapi.insert("tfacp2600m000", 1, error) stpapi.put.field("tfacp2600m000","tfacp200.ttyp",str$(ttyp))
stpapi.form.command("tfacp2600m000", 5, "copy.from.preregistration", error)
if isspace(error) then
stpapi.put.field("tfacp1210m000","tfacp100.ninv",str$(ninv))
ret = stpapi.find("tfacp1210m000", error)
if ret then
ret = stpapi.mark("tfacp1210m000",error)
if ret then
stpapi.form.command("tfacp1210m000", 5, "exec.end.program", error)
(tried to end the session with above command ) and even stpapi.form.command("tfacp1210m000", 5, "exec.cont.process", error) does not work
stpapi.end.session("tfacp1210m000", error) - with this sesion ends once we come out of session tfacp1210m000 , system gives the message (tfacp1210.02) , just press ok and invoice is copied , but this message is also not seen in backend when afs is executed. infact error messcode says "Record not found"
err = stpapi.get.mess.code("tfacp2600m000", error)
I dont understand where the afs goes wrong.
Please guide / suggest !
v.v.urgent....
Regards,
Vaishali
mark_h
7th March 2014, 20:36
Do you have source code where you can debug what happens? That would be best in determining where it is failing.
I am not an LN person - so this is just best guess. I would make sure this command stpapi.form.command("tfacp2600m000", 5, "copy.from.preregistration", error) really starts the tfacp1210m000 session. In your session you should be able to watch and see what processes are starting - and see the parent process id. What I am not sure about since this launches another session if you need a stpapi.handle.subproc before you issue the form command to launch copy.from.preregistration. So I might even try what is below - please keep in mind I am basing this off my 4c4 experience and it might be completely wrong. I removed the mark record commands because a find makes the record current.
if ret_1 = 1 then
stpapi.handle.subproc("tfgld1101m100", "tfacp2600m000", "add")
stpapi.form.command("tfgld1101m100", 5, "enter.transactions", error)
if ret_1 = 1 then
stpapi.put.field("tfacp2600m000","tfacp200.ttyp",str$(ttyp))
ret = stpapi.insert("tfacp2600m000", 1, error)
stpapi.handle.subproc("tfacp2600m000", "tfacp1210m000", "add")
stpapi.form.command("tfacp2600m000", 5, "copy.from.preregistration", error)
if isspace(error) then
stpapi.put.field("tfacp1210m000","tfacp100.ninv",str$(ninv))
ret = stpapi.find("tfacp1210m000", error)
if ret then
stpapi.form.command("tfacp1210m000", 5, "exec.cont.process", error)
Now for the returned message it will probably not be in the error, but you might be get it with stpapi.get.mess.code to get the last message from the session.
vaishrii
8th March 2014, 05:45
unfortunately, I cannot the debugg the source script ....
I tried the steps listed above, but same error code m getting.
Earlier I had tried with handle subproc, but i got same result so ignored..
mark_h
9th March 2014, 12:44
In debug mode does this stpapi.form.command("tfacp2600m000", 5, "copy.from.preregistration", error) actually launch the tfacp1210m000 session?
vaishrii
10th March 2014, 04:29
Yes, I could see tfacp1210m000 opening as a subsession to tfacp2600m000.
Also after find command the required invoice was captured, but as i end the subsession, data is lost...
mark_h
10th March 2014, 13:41
I am not sure what else to try.
bhushanchanda
10th March 2014, 17:08
Hi,
When you copy the record, a message tfacp1210.02 pops up. Verify if you are handling those messages in your AFS. Else, the session tfacp1210m000 wont end.
bhushanchanda
11th March 2014, 08:16
And yes its an MMT session which could cause possible issues.
Check this thread! (http://www.baanboard.com/baanboard/showthread.php?t=54428)
mark_h
11th March 2014, 14:23
Good catch Bhushan. I forgot all about MMT sessions having issues. That was actually one of the reasons I have a mantra that recommends exploring DAL2 functionality.
bhushanchanda
11th March 2014, 15:56
Exactly Mark. This session will need some manual table updations wherever required. Its not a big deal though. Sometimes, you really have to find other ways as its also a "solution" in urgent situations.
vaishrii
12th March 2014, 08:05
The script to handle the message is already written. But I am not getting the above message code, infact the message code which i get is of 'Record not found' error after end of session tcap1210m000 and before end if i try to check message code its blank.
currently I have written afs to manually insert record in tfacp2600m000 and update the record of tfacp1210m000 (tfacp100) session through dal.
no dal2 found for tfacp200 table in LN FP9.
bhushanchanda
12th March 2014, 08:49
Yes, its a way to do it. AFS has always faced issues with handling MMT session.
One more hint, can you try assigning the values to tfacp200.ifbp, tfacp200.isup before opening session tfacp1210m000?
dhruv_x0
12th March 2014, 11:33
Once i was also stucked in the same situation(to press ok through AFS), I used "End.program" that standard command and it worked for me.
Might it help you too.
Thanks
mroset
12th September 2014, 15:18
Hi guys, I stumbled upon this thread and thought it would be good to comment just in case it helps someone out there having been assigned the same task:
(Background: Since 2002, we sell, develop, implement and support the offical Basware Invoice Processing (IP) and Infor-Baan IV/BaanERP/ErpLN realtime integration solution on a worldwide basis.)
Recently, FP9 support was built into the standard solution (and thoroughly and successfully tested afterwards), which included the need to switch from using tfacp1110s000 for registering purchase invoices to MMT-session tfacp2600m000. First of all: I typically steer clear of handling MMT through good-ol' AFS, although ES8.7 should support it (haven't actually tried, will only do that once I really have to and find a bit of free time).
Now what we simply do to be able to maintain costs / match receipts / approve invoices interactively from Basware IP (or any other Purchase Invoice Processing 3rd party application using/connecting through our API and our generic communication platform to InforBaan for that matter), is go through tfacp2107m000 (Match/Approve Purchase Invoices) . That works like a charm, runs successfully in production at some FP9 customers already, and provides a workaround for having to handle this through the (obviously more risky and tricky) MMT/AFS handling mechanism.
Santosh_mali
4th August 2017, 14:31
Hi,
I am using AFS for this session but in script for session tfcmg2114s000, choice.cont.process is commented and used choice.end.program and all code is written in before.choice.
because of this stpapi.continue.process() is not working. so how to process this choice.end.program in baan 4.
i tried using only stpapi.end.session() but it is also not working.
Thanks in advance.
mark_h
6th August 2017, 00:29
If you own source code put it in debug. Other than that the only thing I can think of is to try some of the other commands like save, update just to see if they do anything. You might even want to run ttstpcreatdll on the session to see what it includes - might see something you can try.