Baanboard.com

Go Back   Baanboard.com > Forum > Baan SIGs > AFS/DDC/OLE: Function servers

Retirement Notice

Baanboard is shutting down on 31-dec-2023. See: http://www.baanboard.com/baanboard/showthread.php?t=76043


User login

Frontpage Sponsor

Main

Poll
What do you expect from your SI Implementation partner for the success of ERP implementation.
Bring best practices - Not to offer more CR's Leveraging standard functions
20%
Need more honesty to work with the Users until their processes are fully mapped & Users are trained
40%
Focus on process automation/ integrations/ Real time data/ BI analytics
13%
Stick to basics
27%
Total votes: 15

Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 16th November 2012, 07:52
beluver_2k beluver_2k is offline
Member
 
Join Date: Jan 2008
Posts: 49
beluver_2k is on a distinguished road
Baan: BaaNIVC4 - DB: Informix - OS: Sun Solaris 8.0
AFS Issue in Auto PO/PO line generation

I am trying to create PO and PO lines using AFS based on details available in one Customized table. and update these PO and PO lines number in that table. The steps I followed is as follows.
1. Open the cust. table in update mode
2. AFS for PO header and localised data
3. PO line insertion using db.inisert(Reason for that is I am unable to insert any record in session tdpur4102s000 if it doesn't have any record in tdpur041, as the control on that session gets lost. this is a crude way but I had to do that, any solution to this is welcome.)
4. Execute find option in AFS for 4102s000
5. Delete the record from tdpur041 which has been inserted in step 3.
6. Insert the actual lines with proper data with PO line AFS.
7. Try to update the record in customized table. (At this point it gives me Record not locked eror.)
8. So as a bypass mode i have opened the customized table in RO mode. Use another customize table having same index as first one and inserted the PO and line details in that table.
9. Once, all the lines are generated. Opened the first customized table in update mode and updated PO and line of each record with the records of second customized table.
10. Delete all the records in second customized table.

Kindly suggest me some remedy for steps 3 to 5 and 8 to 10.
Reply With Quote
  #2  
Old 16th November 2012, 09:57
bdittmar's Avatar
bdittmar bdittmar is offline
Guru
 
Join Date: Apr 2002
Posts: 1,982
bdittmar will become famous soon enough
Baan: 2.2/3.1/4c4/LN6.1 FP6/FP9/HiDox Tools 10.7/D.3 - DB: tbase, ms-sql7, oracle10gV1, 11g, 12c, 19c - OS: HP-UX, W2K3, SLES, RHLE
Wrong forum !

Quote:
Originally Posted by beluver_2k View Post
I am trying to create PO and PO lines using AFS based on details available in one Customized table. and update these PO and PO lines number in that table. The steps I followed is as follows.
1. Open the cust. table in update mode
2. AFS for PO header and localised data
3. PO line insertion using db.inisert(Reason for that is I am unable to insert any record in session tdpur4102s000 if it doesn't have any record in tdpur041, as the control on that session gets lost. this is a crude way but I had to do that, any solution to this is welcome.)
4. Execute find option in AFS for 4102s000
5. Delete the record from tdpur041 which has been inserted in step 3.
6. Insert the actual lines with proper data with PO line AFS.
7. Try to update the record in customized table. (At this point it gives me Record not locked eror.)
8. So as a bypass mode i have opened the customized table in RO mode. Use another customize table having same index as first one and inserted the PO and line details in that table.
9. Once, all the lines are generated. Opened the first customized table in update mode and updated PO and line of each record with the records of second customized table.
10. Delete all the records in second customized table.

Kindly suggest me some remedy for steps 3 to 5 and 8 to 10.
Hello,

use the right forum, please.
There's a special forum for AFS !

Maybe a admin is able to move this thread.

Regards
__________________
//Bernd
Reply With Quote
  #3  
Old 16th November 2012, 17:52
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,819
mark_h will become famous soon enoughmark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Well your system is different from my but I use tdpur4101m000 to create PO's, which calls session 4107s000 to add lines. I have no problem adding lines, creating lines, modifying lines, etc. I would recommend searching on the sessions in question in this forum. I do not see a reason why you can't add thru tdpur4102s000 - does not mean it will work. Sometimes you just have to play with them, tweak them and do some not standard things to get them to work. My code is probably in here somewhere, but we use A&D and it requires handling the pegging session which is really not pretty.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #4  
Old 17th November 2012, 06:01
beluver_2k beluver_2k is offline
Member
 
Join Date: Jan 2008
Posts: 49
beluver_2k is on a distinguished road
Baan: BaaNIVC4 - DB: Informix - OS: Sun Solaris 8.0
Sorry

bdittmar: I am sorry, I shall take acre of the same.

Mark: Will it be convenient for you to move this thread to proper forum? Also, I have checked your posts and code and tried here, but of no avail. tdpur4107s000 gets activated from tdpur4101m000, if you have Project implemented in your company else it will open tdpur4102s000.
Reply With Quote
  #5  
Old 17th November 2012, 20:13
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,819
mark_h will become famous soon enoughmark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Can you post your code from entering header information to launching the lines? Also have you checked with infor on updates for stpapi code or the session - sometimes those do make a difference. Even better would be if you owned source code.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #6  
Old 19th November 2012, 08:40
beluver_2k beluver_2k is offline
Member
 
Join Date: Jan 2008
Posts: 49
beluver_2k is on a distinguished road
Baan: BaaNIVC4 - DB: Informix - OS: Sun Solaris 8.0
Code Attached.

Mark,
Thank you for transferring the thread to proper forum. Code is attached.
Attached Files
File Type: cln pogen.cln (14.0 KB, 90 views)
Reply With Quote
  #7  
Old 19th November 2012, 16:03
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,819
mark_h will become famous soon enoughmark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Here is a thread with code that works.

Code:
function extern	domain tcpono insert.po.line(domain tcorno orno, domain tcpono pono, domain tccprj cprj, domain tcitem item, domain tccwar cwar, domain tccuni cupp, domain tcqrd1 oqua, domain tcpric pric, domain tcdate ddta, domain tfgld.leac pacn, domain tfgld.dimx dim1, domain tfgld.dimx dim2, domain tfgld.dimx dim3, domain tfgld.dimx dim4, domain tfgld.dimx dim5, domain tcdate odat)
{
	domain 	tcsuno	suno
	domain 	tcpono	pono1, ret.pono
        tdpur4101m000f.put.Purchase_Order(orno)
        ret = stpapi.find("tdpur4101m000",error)
        if ret = 0 then
		message(error)
		message("Failed in finding PO Header.")
		stpapi.recover("tdpur4101m000", error )
		ret.pono = 0
	endif
        if ret = 1 then
        	found = 0
		stpapi.handle.subproc( "tdpur4101m000", "tdpur4102s000", "add" )
		stpapi.continue.process( "tdpur4101m000", error )
		if(strip$(error)<>"") then
			message("Error: %s",error)
			stpapi.end.session( "tdpur4101m000 - failed activating tdpur4102s000" )
			return
		endif
| Answer questions for tdpur4102
		stpapi.enum.answer("tdpur4102s000", "tdpur4101.01", tcyesno.yes)
| Handle sub processes to tdpur4102s000
                tdpur4102s000f.handle.sub.process("lhpur1542s000", "kill")
        	tdpur4102s000f.put.Project(cprj)
        	tdpur4102s000f.put.Item(item)
		tdpur4102s000f.put.Purchase_Unit(cupp)			|R.R.Patni.13.12.07.n
        	tdpur4102s000f.put.Ordered_Quantity(oqua)
	        tdpur4102s000f.handle.sub.process("tdind0271s000", "kill")
        	ret = stpapi.insert("tdpur4102s000", 1, error )
        	if ret = 0 then
			message(error)
			message("Insert Fail in lines , Session tdpur4102s000")
			stpapi.recover("tdpur4102s000", error )
			ret.pono = 0
        	endif
        	ret.pono = tdpur4102s000f.get.Position_Number.tdpur041.pono()
        	tdpur4102s000f.end()
        	tdpur4101m000f.end()
	endif        	
	return(ret.pono)
}
Not sure exacting what is lhpur1542s000 - so not sure if that kill is necessary. In my code I just ignore tdpur4503s000. The above code was were I was winging it based off my code and kind of what I would expect to happen. Take a look at both and maybe you can solve the issue for steps 3 thru 5.

Steps 8 thru 10 I would expect just a simple select for update, with a call the AFS code in the selectdo. Below is how we do inventory adjustments
Code:
function process.records()
{
| First process all the records.
	db.retry.point()
	select	tdudi020.*
	from	tdudi020 for update
	where	tdudi020._index1 = {:tdudi020.logn, :tdudi020.seqn}
	selectdo
		msg = ""
		proc.status = sprintf$("Processing line %d", tdudi020.line)
		display("proc.status")
		if strip$(tdudi020.errm) = "Processed" then
			continue
		endif
|		msg = process.file.checks()
		
		select	tipgc004.*
		from	tipgc004
		where	tipgc004._index1 = {:tdudi020.cwar}
		as set with 1 rows
		selectdo
		selectempty
			tipgc004.ccot = " "
		endselect
		
		msg = process.file.checks()
		if isspace(msg) then
			rc = adjust_inventory( tipgc004.ccot,
				tdudi020.item,
				tdudi020.quan,
                                tdudi020.cwar,
                                tdudi020.loca,
				tdudi020.clot,
				tdudi020.date,
				tiitm001.cuni,
				tiitm001.stgu,
				tdudi020.cprj,
				tdudi020.butm,
				tdudi020.sbtm,
				tdudi020.prog,
				tdudi020.eser,
				tdudi020.eseq,
				tdudi020.cspa,
				tdudi020.prea,
				tdudi020.irea,
				tdudi020.frea,
				tdudi020.cref,
				tdudi020.ival,
				msg)
		endif

		if not isspace(msg) then
                                      |Write error msg for record
			tdudi020.errm = msg
			db.update(ttdudi020,db.retry)
		else
                                       | Archive processed records.
			import("exp.orno",exp.orno)
			import("exp.sern",exp.sern)
			archive.processed.records()
			db.insert(ttdudi025,db.retry)
			db.delete(ttdudi020,db.retry)
			|tdudi020.errm = "Processed"
		endif
		|db.update(ttdudi020,db.retry)
		commit.transaction()
	endselect
| Move all processed records to history	
	archive.processed.records()
	proc.status = ""
	display.all()
}
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #8  
Old 20th November 2012, 07:08
beluver_2k beluver_2k is offline
Member
 
Join Date: Jan 2008
Posts: 49
beluver_2k is on a distinguished road
Baan: BaaNIVC4 - DB: Informix - OS: Sun Solaris 8.0
Thank You, Mark!!!
I shall check and get back.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Question mr_suleyman Tools Development 37 11th November 2016 09:14
AFS Problem while assigning SO Line Position ashishjain AFS/DDC/OLE: Function servers 3 4th August 2011 15:19
AFS Issue king1980 AFS/DDC/OLE: Function servers 4 12th March 2010 15:48
Report with output with more than 255 char. Jaap Roos Tools Development 5 9th February 2007 22:37
Issue with sales order line with cost item Renegade AFS/DDC/OLE: Function servers 4 26th June 2003 19:11


All times are GMT +2. The time now is 00:54.


©2001-2023 - Baanboard.com - Baanforums.com