nileshsamsonite
26th December 2006, 13:49
Hi,
I need help on AFS .I want to customize a session which will generate Purchase order by reading a text file. The text file contains the information like Supplier code , Item code , and quantity. I have searched most of threads on AFS. As I don't know much about AFS pls guide me how to start.
Thanks.
Nilesh
Kozure Ohashi
27th December 2006, 13:45
Dear nileshsamsonite,
not to difficult:
You need a session or 3 gl script or dll.
You have to register the 2 afs relevant dll's for purchase order in the maintain session of the script.
tdpurf4101m000 (Header)
tdpurf4102s000 (Position)
In short:
You need the proper afs functions calls (if you don't have the source of the afs dll's) you can print the function prototypes (i have no system now, it is somewhere "Print Script"), therefore you are able to find the proper functions without having the source.
Important: Don't wirte on script both for SLS and PUR because the AFS function names are sometimes the same this is not working. I found a solution by writing PUR in a script and SLS in a seperate DLL.
(We needed this because we had to update both SLS and related PUR data).
Then you set the values from your inputfile with the PUT functions (e.g. put.orno // put.suno ...)
Then you make an ...insert. (Sometimes you also need a ...save, so the history and tdpur045 tables are also updated).
(Sorry i am not in the office, i try to send you an sample within the next days).
Regards,
Kozure
mark_h
27th December 2006, 14:36
The best starting point is to ready the sticky note on this forum. This will show you the commands and help you prepare for writing an AFS session. Next start small - just create the header. The concept is simple - do a header manually, track what you have to enter(or what you enter). Next figure out which AFS commands you need - probably just stpapi.put.field and stpapi.insert. I think one you get this down it will help you understand own it works. Then the next step is activating the lines and handling that.
Also search this forum for the session name. You might find an example or two.
Hiba_t
28th December 2006, 15:53
Hi nileshsamsonite,
I hope this example will help you,
stpapi.put.field("dtfsa1101s000", "dtfsa100.seno", str$(i.seno))
stpapi.put.field("dtfsa1101s000", "dtfsa100.key1", i.key1)
stpapi.put.field("dtfsa1101s000", "dtfsa100.name", i.name)
retval = stpapi.insert("dtfsa1101s000", true, o.mess)
if not retval then
retval = stpapi.recover("dtfsa1101s000", dummy.msg)
endif
stpapi.end.session("dtfsa1101s000")
return(isspace(o.mess))
Regards,
Hiba
Kozure Ohashi
29th December 2006, 12:13
Dear nileshsamsonite,
Sample with tdpurf4101m000 and tdpurf4102s000 AFS DLL's.
f4102s000.put.Purchase_Order(tdpur041.orno)
f4102s000.put.Position_Number(tdpur041.pono)
error.code = f4102s000.find()
if error.code <> 1 then
mess ("ccbois0009",1)
|* Record Not Found
set.error = 1
f4102s000.end()
exit()
endif
f4102s000.put.tdpur041.cwar(temp.cwar)
f4102s000.update(1, gapi.error.code)
|* Update tdpur041 und tdpur045 und tdpur051
f4102s000.save(gapi.error.code)
f4102s000.end()
You can use the bwc Option Command: -- - set AFSLOG=1
You will find a file afs.log. With tail -f (on Unix/Linux) you can follow each response from the afs server while debugging your source code with "s".
Regards,
Kozure
nileshsamsonite
1st January 2007, 07:20
Dear all,
Thank you.
I have successfully created the Purchase order by reading a text file with the help of AFS. ( In the same manner what Kozure posted in the thread. )
Wishing you Happy new year..!!:)
Nilesh