khasselm
16th April 2011, 14:36
Hello,
I am trying to create production planning with AFS - basically I want to be able to copy over from BaanIV the operation sequence, tasks.
The return value of AFS function stpapi.change.view to start a "new group" action gives always an 0 which means that it wasn't succesful.
The AFS.LOG gives the output:
>tisfc0110m000(40) put.field:tisfc010.pdno 120000133
>tisfc0110m000 change.view
37dll->serv (start.set40)
tisfc0110m000(40)-RUNNING:start.set
40serv<-4gl (start.setEOF0)
tisfc0110m000(40)-RUNNING:
<tisfc0110m000 0 no view found
>tisfc0110m000 get.field:tisfc010.pdno
<tisfc0110m000(40) get.field:tisfc010.pdno=120000133
See in enclosed file the import script I use via Exchange import.
Has someone ideas what happend here?
Has anyone already succeeded in inserting a sequence of tisfc010 lines automatically?
System is LN6.1 FP3 and any help greatly appreciated...
Many thanks in advance!!
Best regards,
Kees
mark_h
18th April 2011, 16:18
Can't really help with LN. But have you tried a find versus a change view?
darpan
19th April 2011, 11:05
The Below Written code is for Production Order Generation.
retval = stpapi.find("tisfc0101s000", error)
stpapi.form.command("tisfc0101s000", 5, "exec.add.set",error)
stpapi.put.field("tisfc0101s000", "tisfc001.pdno", "750")
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.1","")
stpapi.put.field( "tisfc0101s000", "tisfc001.mitm.segment.2", shiftl$(strip$(tiheg325.item)))
stpapi.put.field("tisfc0101s000", "tisfc001.qrdr", str$(wght))
retval = stpapi.insert( "tisfc0101s000", 1, error )
if not retval then
ret_val = stpapi.recover("tisfc0101s000",error)
endif
stpapi.get.field("tisfc0101s000","tisfc001.pdno",v.pdno)
stpapi.form.command("tisfc0101s000", 5, "release.order",error)
stpapi.end.session("tisfc0101s000", error)
stpapi.end.session("tisfc0101m100", error)
Will try for Production Planning also and revert back
Regards
Darpan
09981190084
khasselm
19th April 2011, 11:37
Can't really help with LN. But have you tried a find versus a change view?
Hi Mark,
Thanks for your feedback! Unfortunately also the find doesn't work.
In the meantime I found the reason why it is not possible to use DAL2 and Exchange for tisfc010... Problem is that the global variable 'gl.calling.context' in script "tisfc010" (DAL for tisfc010) is not set when using exchange as application...
I made a modification in this DAL and now I can use Exchange with DAL settings.
Best regards,
Kees
khasselm
19th April 2011, 11:40
Hi Darpan,
Thanks for your reply! I hope you find a solution for the AFS problem, but I'm afraid it is not possible to use AFS for tisfc010.
See my reply to Mark with a workaround for Exchange in combination with DAL.
But I would like to use AFS for my purpose.
Best Regards,
Kees
iulmer
6th June 2011, 12:29
Hello,
wen use on BaanIV the below, and it works fine.
May be it helps you.
-Immanuel
Public Function MaintainEstimatedMaterials(pdno As String, _
Item As String, _
cwar As String, _
qty As Double) As String
Dim BaanObj As Baan4.Baan4, sErrMsg
Dim sSession, found_pdno As String
Set BaanObj = CreateObject("Baan4.Application.immanuel")
BaanObj.Timeout = 50
Call stpapi_put_field(BaanObj, "tisfc0110m000", "ticst001.pdno", pdno)
sErrMsg = Space(50)
Call stpapi_find(BaanObj, "tisfc0110m000", sErrMsg)
If BaanObj.ReturnValue = 1 Then
'check if the correct production order was found
found_pdno = Space(50)
sSession = "tisfc0110m000"
Call BaanObj.ParseExecFunction("ottstpapihand", "stpapi.get.field(" & Chr(34) & sSession & Chr(34) & ",""ticst001.pdno""," & Chr(34) & found_pdno & Chr(34) & ")")
found_pdno = Mid(BaanObj.FunctionCall, InStr(1, BaanObj.FunctionCall, "ticst001.pdno") + Len("tisfc001.pdno") + 3, 5)
'Call MsgBox("Neuer Prod. Order: " & pdno)
If found_pdno = pdno Then 'if correct production order found insert it
Call stpapi_put_field(BaanObj, "tisfc0110m000", "ticst001.sitm", Item)
Call stpapi_put_field(BaanObj, "tisfc0110m000", "ticst001.cwar", cwar)
Call stpapi_put_field(BaanObj, "tisfc0110m000", "ticst001.qune", CStr(qune))
sSession = "tisfc0110m000"
sErrMsg = Space(50)
rc = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.insert(" & Chr(34) & sSession & Chr(34) & ",1," & Chr(34) & sErrMsg & Chr(34) & ")")
End If
Else
'If BaanObj.Error <> 0 Or BaanObj.ReturnValue <> "" Then
'if find failed show an error message
Call MsgBox(" sErrMsg = " & sErrMsg & Chr(10) & _
"BaanObj.Error = " & BaanObj.Error & Chr(10) & _
"BaanObj.ReturnValue = " & BaanObj.ReturnValue & Chr(10) & _
"BaanObj.FunctionCall = " & BaanObj.FunctionCall)
GoTo exit_function
End If
exit_function:
Call stpapi_end_session(BaanObj, "tisfc0110m000")
BaanObj.Quit
Set BaanObj = Nothing
End Function
Function stpapi_put_field(BaanObj, sSession, sField, sValue)
' filling the Baan field with the value
Dim s
s = "stpapi.put.field(" & Chr(34) & sSession & Chr(34) & ", " & _
Chr(34) & sField & Chr(34) & "," & _
Chr(34) & sValue & Chr(34) & ")"
Call BaanObj.ParseExecFunction("ottstpapihand", s)
If BaanObj.Error <> 0 Or BaanObj.ReturnValue <> "" Then
BaanObj.Quit
End If
End Function
Function stpapi_find(BaanObj, sSession, sErrMsg)
' filling the Baan field with the value
Dim s
s = "stpapi.find(" & Chr(34) & sSession & Chr(34) & ", " & _
Chr(34) & sErrMsg & Chr(34) & ")"
Call BaanObj.ParseExecFunction("ottstpapihand", s)
'If BaanObj.Error <> 0 Or BaanObj.ReturnValue <> "" Then
' BaanObj.Quit
'End If
End Function
Function stpapi_end_session(BaanObj, sSession)
' filling the Baan field with the value
Dim s
s = "stpapi.end.session(" & Chr(34) & sSession & Chr(34) & ")"
Call BaanObj.ParseExecFunction("ottstpapihand", s)
If BaanObj.Error <> 0 Or BaanObj.ReturnValue <> "" Then
BaanObj.Quit
End If
End Function
iulmer
6th June 2011, 13:25
sorry the function header from the previous post needs to be as follows:
Public Function MaintainEstimatedMaterials(pdno As String, _
Item As String, _
cwar As String, _
qune As Double) As String
thieuf
27th June 2011, 13:38
Hello,
The statement that AFS does not work on production order plannign got me worried, so I just did a test on ERP LN FP6 to change the remaning start date of a planned operation and it works fine.
To the original poster: Is there perhaps an alternative way to create the operations first (by creating or copying the production order?) and then "adjust" them using AFS?
regards thieu