ahbakhru
12th April 2007, 11:05
In AFS for session tisfc0130m000 (Report Operations Completed) after setting the values for Production Order (using set.view) and Operation, I'm not able to set the record as current, always the last operation gets selected. When the <afs_name>.find() command is executed, the return value is 2.

I don't know if too much about DEM, but the same code is working fine for both Normal and Super users using Menu Browser (not using DEM) :confused: and not for users using DEM.

I've attached a screenshot of the debugger screen where I've shown the values for which I want to set the current record and the values for the which the current record is actually set.

Can anybody please help?

NPRao
13th April 2007, 02:16
Check for the value of err.mesg in synchronize.dialog()

This function is for Baan ERP 5.x and 6.0 only.
The error messages returned can be:
Command disabled; no insert/update is possible in the current state of the session.
Session has no synchronized dialog box.
This function must be used to get the multi-occurrence session synchronized with its connected single-occurrence dialog box. It must be called before an insert or update call. It must also be called before executing a Form command on the single-occurrence session, because the editable and display variants can have different sets of form commands. For retrieving data from the single-occurrence dialog box, the synchronization must also be executed.

ahbakhru
16th April 2007, 08:41
synchronize.dialog() does not give any error message.

Before executing synchronize.dialog(), when the find() gets executed, it gives a return value "2". And when I try to retrive the value of operation no. using get.operation(), I always get the last operation no. in that Production Order.

The thing is that this code works fine with users for whom DEM has not been implemented. Should DEM in any way interfere with the functioning of AFS?

ahbakhru
16th April 2007, 14:00
It finally worked. And all I did was add 2 browse.set() statements... one with "prev.set" and the other with "next.set".

Still don't know what the problem was, but I got it working.

Thanks for the help though.

prabhat@heg
2nd December 2014, 07:37
iam having a problem with my AFS some times it skips to post the material in inventory i.e. it fails to do ROC. Please help.. Iam attaching the code for reference

prabhat@heg
2nd December 2014, 07:44
function long roc.afs()
{
long found,retval,ret_val
string error(100)
found = 0
error=""
stpapi.put.field("tisfc0130m000","tisfc010.pdno",tiheg165.pdno)
stpapi.put.field("tisfc0130m000","tisfc010.opno",str$(10))

retval = stpapi.find("tisfc0130m000",error)
ret_val = stpapi.mark("tisfc0130m000",error)

if retval = 1 then
ret_val =stpapi.synchronize.dialog("tisfc0130m000","modify",error)

stpapi.put.field( "tisfc0130m000","qcmp.form",str$(tiheg165.aqpr))
stpapi.enum.answer("tisfc0130m000", "tisfc01302",tcyesno.yes)
stpapi.put.field( "tisfc0130m000","qrjc.form",str$(tiheg165.rqns))
stpapi.enum.answer("tisfc0130m000", "tisfc01302",tcyesno.yes)

if last.opr then
stpapi.put.field( "tisfc0130m000","lot.code",tiheg165.glot)
endif
stpapi.enum.answer("tisfc0130m000", "tisfc01302",tcyesno.yes)
stpapi.enum.answer("tisfc0130m000", "tisfc01027",tcyesno.yes)
stpapi.enum.answer("tisfc0130m000", "tisfc02029",tcyesno.yes)
stpapi.enum.answer("tisfc0130m000","tisfc02023",tcyesno.yes)

stpapi.set.report("tisfc0130m000", "rwhinh341211100", "D", error)
ret_val = stpapi.update( "tisfc0130m000",true,error )

if not isspace(error) then
found = 0
else
found = 1
endif
stpapi.end.session("tisfc0130m000")
endif
return(found)
}

bhushanchanda
2nd December 2014, 13:16
Hi,

Please refer the following threads :-

Thread 1 (http://www.baanboard.com/baanboard/showthread.php?t=46379)

Thread 2 (http://www.baanboard.com/baanboard/showthread.php?t=23952)

pellus
15th April 2016, 08:55
Hello prabhat@heg & others.
(LN fp7. AIX and Oracle. AFS driven from a dll which is BOD driven from ION or from the BOD test tool),
Did you solve this? I have the same problem with tsfc0130m000. The operation gets updated with quantity but the receipt of main item from the sfc-order into WH is never done (which it should). Later in the stream of AFS commands I do a 'complete' of the operation which also succeeds. And all return codes are fine and all 'messages' from AFS are blank. All questions I can see when I do this manually, have a setting of 'yes' in the AFS (which they should have). The problem is that the receipt to WH is not done.

This happens in maybe 1 % of the cases, in 99 % of the cases everything works. (It is always the same business, a simple order with one operation which is the painting of a produced device.)

bhushanchanda
19th April 2016, 17:41
Hi,

May be you can try using suspend(some_value) e.g. suspend(1000) after your update so that if some background process starts running, it completes before you end the program.

In case if you can try, go ahead with the DAL instead of AFS to check if that works for you.

Ajesh
20th April 2016, 05:58
Also, please post your Code...

pellus
20th April 2016, 10:21
Thankyou. I will try the "suspend". The developer a couple of years ago obviously had the same idea, but used "sleep(500)" instead which normally does nothing in this context. Hahaha. I looked at this code many times but you switched on the light.

pellus
21st April 2016, 04:03
Current AFS-coding is like this:
* We come in with i.pdno (order), i.opno (operation), i.qcmp (quantity).
* The mission is to update the quantity and if that goes well, do a 'operation completed'
* There is only one operation on the order.
* There are no problems with quantities.
* Behaviour: Occasionally (1 % of cases), the receipt into WH of the main Item is not done. Should happen at the 'stpapi.update' step. (No bad return code or message come and the process rolls on and does the "complete.oper.with.commit" successfully.)
* I have here removed some evaluations of return codes and messages (they never reveal any problem anyway)

The code:
*****************************************************************
l.session = "tisfc0130m000"
stpapi.put.field(l.session, "tisfc010.pdno", i.pdno)
stpapi.put.field(l.session, "tisfc010.opno", str$(i.opno))
l.result = stpapi.find(l.session, l.message)
if l.result = 1 then
... l.result = stpapi.synchronize.dialog(l.session, "modify", l.message)
... if l.result then

...... stpapi.put.field(l.session, "qcmp.form", str$(i.qcmp))

...... stpapi.enum.answer(l.session, "tisfc01027", tcyesno.yes) | Immediately post main item to inventory?
...... stpapi.enum.answer(l.session, "tisfc02029", tcyesno.yes) | Process inbound procedure automatically when activating warehouse order receipt line?
...... stpapi.enum.answer(l.session, "tisfc01300", tcyesno.yes) | Note: Quantity in subcontracting is %1$g. Complete Operation anyway?
...... stpapi.enum.answer(l.session, "tisfc01021", tcyesno.yes) | Preceding operations will be updated! Continue anyway?
...... stpapi.enum.answer(l.session, "tisfc01028", tcyesno.yes) | Item is Lot Controlled. Generate Lot Code?

...... l.update = stpapi.update(l.session, true, l.message)

...... if l.update = 1 then
......... stpapi.enum.answer(l.session, "tisfc01027", tcyesno.yes)
......... stpapi.enum.answer(l.session, "tisfc02029", tcyesno.yes)
......... stpapi.enum.answer(l.session, "tisfc01300", tcyesno.yes)
......... stpapi.enum.answer(l.session, "tisfc01021", tcyesno.yes)
......... stpapi.enum.answer(l.session, "tisfc01028", tcyesno.yes)

......... stpapi.put.field(l.session, "tisfc1010.cmdt", str$(utc.num())

......... stpapi.form.command(l.session, 5, "complete.oper.with.commit", l.message)

...... endif
... endif
endif
sleep(400)
stpapi.end.session(l.session)
sleep(100)
stpapi.end.session(l.session)

Ajesh
21st April 2016, 08:37
When you use stpapi.synchronize.dialog to synchronize a single Occ session with its parent Multi Occurence session, the stpapi.put.field should include the child session instead of the parent session.


... l.result = stpapi.synchronize.dialog(l.session, "modify", l.message)
... if l.result then

...... stpapi.put.field(l.session, "qcmp.form", str$(i.qcmp))

...... stpapi.enum.answer(l.session, "tisfc01027", tcyesno.yes) | Immediately post main item to inventory?





The l.session should have the child session name instead of the parent.

pellus
21st April 2016, 16:26
OK but in this case, both the single occ session and the multi occ session are the same session, i.e. tisfc0130m000. It is synch'd with itself.