Baanboard.com

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

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 19th August 2013, 17:54
sghatge's Avatar
sghatge sghatge is offline
Junior Member
 
Join Date: Apr 2006
Location: Pune
Posts: 17
sghatge is on a distinguished road
Baan: LN 6.1 FP2 - DB: TBASE - OS: SOLARIS 2.5
AFS for Insert record in tirou101

Dear Friends,

I am trying to insert record through AFS in items - routing (tirou1101m000) for new routing code "002" (Routing is already exist for code "001") but its inserting default routing withou filling item code. Please help me to resolve this. The code is as below.
Code:
	select 	tcibd001.*
	from 	tcibd001 
	where 	tcibd001.kitm in (1,2)
	and	tcibd001.item inrange {:item.f} and {:item.t} 
 	and not exists (select 1 from tirou101 where tirou101.mitm = tcibd001.item and tirou101.opro = "   002")
	selectdo
		proj = tcibd001.item(1;9)
		item = tcibd001.item(10;38)
		stpapi.put.field("tirou1101m000", "tirou101.mitm.segment.1", proj)
		stpapi.put.field("tirou1101m000", "tirou101.mitm.segment.2", item)
		ret = stpapi.change.view("tirou1101m000", error)
		if ret > 0 then
			ret = stpapi.synchronize.dialog("tirou1101m000", "Add", error)
			if ret then
				stpapi.put.field("tirou1101m000", "tirou101.opro", "   002")
				stpapi.put.field("tirou1101m000", "tirou101.dsca", "AFS - REVISED ROUTING")
				stpapi.put.field("tirou1101m000", "tirou101.stor", str$(etol(tcyesno.no)))
				stpapi.put.field("tirou1101m000", "tirou101.maru", str$(etol(tcyesno.no)))
				ret = stpapi.insert("tirou1101m000", true, error)
				if ret then
					ret = stpapi.save("tirou1101m000", error)
				endif
			endif
		endif
		stpapi.end.session("tirou1101m000", error)
__________________
Regards,

ShashiG

Last edited by mark_h : 20th August 2013 at 14:18.
Reply With Quote
  #2  
Old 19th August 2013, 20:43
vinceco252's Avatar
vinceco252 vinceco252 is online now
Guru
 
Join Date: Mar 2002
Location: Frederick, CO
Posts: 391
vinceco252 is on a distinguished road
Baan: Baan IVc3, IVc4, 5b, 5c, ERP LN 6.1, Infor ERP 10.x - DB: SQL Server, Oracle - OS: Windows, Linux, HPUX, AIX, (a little bit of) Solaris
I am not sure, but after the change view fails, I think you may need to do the puts for the item again.

Vince
__________________
Vincent Murphy
---------------
Senior ERP Consultant
OST
vmurphy@ostusa.com
Reply With Quote
  #3  
Old 19th August 2013, 20:57
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,287
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi,

Your profile says you are on LN. So, you can go with DAL too. That might be a simpler way.

Anyways, I found a similar AFS thread. I hope this helps:-

Thread 1

And as Vince said, you might need to update the item field again.

A sample code snipplet:--

Code:
stpapi.put.field( "ticst0101m100", "ticst001.pdno", pdno)
	ret = stpapi.change.view( "ticst0101m100",  error1 )
	stpapi.put.field( "ticst0101m100", "ticst001.pono", str$(pono) )
	ret =  stpapi.find( "ticst0101m100" , error1  )
	if ret = 1 then
		ret =  stpapi.mark( "ticst0101m100" , error1  )
		ret = stpapi.synchronize.dialog("ticst0101m100", "modify", err.mesg) 
		
		stpapi.enum.answer( "ticst0101m100", "ticst01011",tcyesno.yes )
		stpapi.set.report("ticst0101m100", "rtisfc020701000", spool.device , error1)
		stpapi.form.command( "ticst0101m100", 5, "initiate.inventory", error )
	endif
	
	stpapi.end.session( "ticst0101m100" , error1  )
	stpapi.end.session( "ticst0101m100" , error1  )
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!

Last edited by bhushanchanda : 19th August 2013 at 21:04.
Reply With Quote
  #4  
Old 20th August 2013, 09:07
sghatge's Avatar
sghatge sghatge is offline
Junior Member
 
Join Date: Apr 2006
Location: Pune
Posts: 17
sghatge is on a distinguished road
Baan: LN 6.1 FP2 - DB: TBASE - OS: SOLARIS 2.5
As suggested, i have tried, but not working. Anybody can correct my given code and help me.

Regards,

Shashikant
__________________
Regards,

ShashiG
Reply With Quote
  #5  
Old 20th August 2013, 09:53
sghatge's Avatar
sghatge sghatge is offline
Junior Member
 
Join Date: Apr 2006
Location: Pune
Posts: 17
sghatge is on a distinguished road
Baan: LN 6.1 FP2 - DB: TBASE - OS: SOLARIS 2.5
It is very urgent. Anybody can help me to add the routing with item code. currently item code is taking as blank.
__________________
Regards,

ShashiG
Reply With Quote
  #6  
Old 20th August 2013, 11:34
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,287
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Working Code!

Hi,

Here's the working code. I tried it at my end and works perfectly.

Code:
select tcibd001.*
from   tcibd001
where  tcibd001.item(10;5) = "TESTI"  | I am trying to insert Routing Data for "TESTING". This is not needed, but I have just used a similar loop.
selectdo



stpapi.put.field("tirou1101m000", "tirou101.mitm.segment.1", tcibd001.item(1;9))
stpapi.put.field("tirou1101m000", "tirou101.mitm.segment.2", tcibd001.item(10;38))
error = get.string.arg(1)
ret = stpapi.change.view( "tirou1101m000",  error )
put.string.arg(1, error)
if ret = 0 then
ret = stpapi.synchronize.dialog("tirou1101m000", "add", error)
if ret then
stpapi.put.field("tirou1101m000", "tirou101.opro", "100")
stpapi.put.field("tirou1101m000", "tirou101.dsca", "TESTING ROUTING")
stpapi.put.field("tirou1101m000", "tirou101.stor", str$(etol(tcyesno.no)))
stpapi.put.field("tirou1101m000", "tirou101.maru", str$(etol(tcyesno.no)))
ret = stpapi.insert("tirou1101m000", true, error)
if ret then
ret = stpapi.save("tirou1101m000", error)
endif
endif
endif
stpapi.end.session("tirou1101m000", error)

endselect
Hope this helps.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #7  
Old 20th August 2013, 14:34
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,905
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
I got to ask - what is with the synchronize dialog? If it needs that then why wouldn't you be putting the fields on the synchronized form - then doing the insert on the main form.

The most important thing I would do is check the value for stpapi.changeview - if the return value is anything but 1 then I would definetly put all the fields again to make sure the item was correct. Then again I am on 4c4. I could probably just put all the fields and do an insert without the change.view - not always, but usually.

Code:
stpapi.put.field("dtfsa1501m000", "dtfsa101.seno", str$(i.seno))
ret = stpapi.find("dtfsa1501m000", error.msg)
if ret then		
       ret = stpapi.synchronize.dialog("dtfsa1501m000", "modify", error.msg)
       if ret then
               stpapi.put.field("dtfsa1101s000", "dtfsa101.name", new.name) 
	            ret = stpapi.update("dtfsa1501m000", true, error.msg)
       endif
endif
__________________
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
Sponsored Links
  #8  
Old 20th August 2013, 18:46
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,287
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi Mark,

I am not into AFS much as I use DAL when required. I just did a bit trial and errors and got the result.

Well,in one of the thread (referred your post) I learnt about stpapi.find replacing stpapi.change.view and I have used that too. Which gives solution as well. A bit change to your script will do the job.

In this case, stpapi.find return's 0. So the other working code will be:-

Code:
select tcibd001.*
from   tcibd001
where  tcibd001.item(10;5) = "TESTI"
selectdo


error = tcibd001.item(1;9)
error = tcibd001.item(10;38)
stpapi.put.field("tirou1101m000", "tirou101.mitm.segment.1", tcibd001.item(1;9))
stpapi.put.field("tirou1101m000", "tirou101.mitm.segment.2", tcibd001.item(10;38))

ret = stpapi.find("tirou1101m000", error)
if ret = 0 then
ret = stpapi.synchronize.dialog("tirou1101m000", "add", error)
if ret then
stpapi.put.field("tirou1101m000", "tirou101.opro", "100")
stpapi.put.field("tirou1101m000", "tirou101.dsca", "TESTING ROUTING")
stpapi.put.field("tirou1101m000", "tirou101.stor", str$(etol(tcyesno.no)))
stpapi.put.field("tirou1101m000", "tirou101.maru", str$(etol(tcyesno.no)))
ret = stpapi.insert("tirou1101m000", true, error)
if ret then
ret = stpapi.save("tirou1101m000", error)
endif
endif
else
	message("Record exists!")  | This can be excluded.
endif
stpapi.end.session("tirou1101m000", error)

endselect
So, two solutions now, I hope he will get this If any mistakes, Mark please correct me.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #9  
Old 20th August 2013, 23:36
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,905
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
I think either of the solutions should work. The only think I think they need to be aware of is if it finds a different item or view. Then they might need to re-put the item for the insert. The only other thing that might cause an issue is the session version or stpapi libraries are different. I have seen those cause issues. On a session like this you would think it would be simple, but that is not always the case.
__________________
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
  #10  
Old 21st August 2013, 04:41
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,287
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Agreed Mark. The best way is to write your code, put it under debugger, check return values for evry function and check the results. Accordingly, the changes should be made in the script where required.

Patience is the key to succeess!
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
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
AFS to insert record in tfgld4582m000 session layswan Tools Development 1 3rd October 2012 14:43
AFS waiting timed out (frozen) jp.aalders AFS/DDC/OLE: Function servers 4 20th December 2011 20:48
AFS fail to delete record in Maintain Estimated End Items ppchong AFS/DDC/OLE: Function servers 1 22nd September 2011 14:47
AFS fail to delete record in Maintain Estimated End Items ppchong AFS/DDC/OLE: Function servers 1 21st September 2011 13:16
how to insert record in type3 form via AFS??? alibaba AFS/DDC/OLE: Function servers 5 17th September 2004 04:19


All times are GMT +2. The time now is 23:06.


©2001-2017 - Baanboard.com - Baanforums.com