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
37%
Installation Wizard into new VRC
39%
Manual into existing VRC
3%
Manual into new VRC
21%
Total votes: 38

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 2nd February 2012, 06:25
layswan layswan is offline
Member
 
Join Date: Oct 2007
Posts: 55
layswan is on a distinguished road
Baan: BaanIVc - DB: InforMix 2.7 - OS: Sun Unix
Unhappy Insert Data to tcibd001 using AFS

Hi,

I could insert all the neccessary data to tcibd001 table successfully by using AFS but only the data for Weight (tcibd001.wght) could not insert the data that i want. Is it because of the domain type? Please help......!
Below was the AFS code that i wrote to insert data to tcibd001 table, please advice if there is anything wrong with my code.

-------------------------------------------------------------------------------------------
extern domain tcwght weight
extern domain tcmcs.str4 length
extern domain tcwght lgth_cov
string lgth(4)

lgth = length
lgth_cov = val(lgth)

weight = linear * (lgth_cov/1000)

long ret1, ret2, ret3
string find.msg(100), error.msg(100), syn.msg(100), recover.msg(100)

ret1 = stpapi.find("tcibd0501m000", find.msg)

if ret1 = 1 then

ret2 = stpapi.synchronize.dialog("tcibd0501m000", "add", syn.msg)

if ret2 then

stpapi.put.field("tcibd0101s000", "tcibd001.item.segment.1", " ")
stpapi.put.field("tcibd0101s000", "tcibd001.item.segment.2", str$(item))
stpapi.put.field("tcibd0101s000", "tcibd001.dsca", str$(dscb))
stpapi.put.field("tcibd0101s000", "tcibd001.kitm", str$(kitm))
stpapi.put.field("tcibd0101s000", "tcibd001.citg", str$(citg))
stpapi.put.field("tcibd0101s000", "tcibd001.uset", "STD")
stpapi.put.field("tcibd0101s000", "tcibd001.cuni", "pcs")
stpapi.put.field("tcibd0101s000", "tcibd001.cwun", "kgs")
stpapi.put.field("tcibd0101s000", "tcibd001.dscd", str$(linear))
stpapi.put.field("tcibd0101s000", "tcibd001.wght", str$(weight))
stpapi.put.field("tcibd0101s000", "tcibd001.dscc", str$(peri))
stpapi.put.field("tcibd0101s000", "tcibd001.cpcl", str$(hole))
stpapi.put.field("tcibd0101s000", "tcibd001.csel", str$(press))

ret3 = stpapi.insert("tcibd0101s000", 1, error.msg)

if not ret3 then
stpapi.recover("tcibd0101s000", recover.msg)
endif

stpapi.end.session("tcibd0101s000")

endif

endif

stpapi.end.session("tcibd0501m000")
-------------------------------------------------------------------------------------------

Thanks!
Reply With Quote
  #2  
Old 2nd February 2012, 09:41
v_kewl v_kewl is offline
Member
 
Join Date: Dec 2008
Posts: 49
v_kewl is on a distinguished road
Baan: LN 6.1 - DB: MS SQL - OS: Windows 2003
Hi,

Where you have declared "linear" ? (weight = linear * (lgth_cov/1000))

Code looks fine...Just cross-check your declared variables again.

Regards,
Gaurav
Reply With Quote
  #3  
Old 2nd February 2012, 15:41
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,929
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
First this is the correct forum for questions like this. Second if this is truly a sync'ed dialog type session then I would expect the insert to be on the main session, not the subsession. Here is the example from the documentation in the sticky thread at the top of this forum.

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
  #4  
Old 2nd February 2012, 15:47
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,929
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Searching also turned up this http://www.baanboard.com/baanboard/s...=tcibd0101s000. Not sure if that helps or not.

Also you might want to update your profile. It says 4c, but sync dialog is not available for it. Not sure which version you are on.
__________________
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
  #5  
Old 3rd February 2012, 08:43
layswan layswan is offline
Member
 
Join Date: Oct 2007
Posts: 55
layswan is on a distinguished road
Baan: BaanIVc - DB: InforMix 2.7 - OS: Sun Unix
Quote:
Originally Posted by v_kewl View Post
Hi,

Where you have declared "linear" ? (weight = linear * (lgth_cov/1000))

Code looks fine...Just cross-check your declared variables again.

Regards,
Gaurav
Hi,
I declared "linear" as below
extern domain tcwght linear
Reply With Quote
  #6  
Old 3rd February 2012, 08:56
layswan layswan is offline
Member
 
Join Date: Oct 2007
Posts: 55
layswan is on a distinguished road
Baan: BaanIVc - DB: InforMix 2.7 - OS: Sun Unix
Quote:
Originally Posted by mark_h View Post
Searching also turned up this http://www.baanboard.com/baanboard/s...=tcibd0101s000. Not sure if that helps or not.

Also you might want to update your profile. It says 4c, but sync dialog is not available for it. Not sure which version you are on.
Hi,

Thanks for your reply!

Sorry, I m using ERP LN FP5.

I already go through http://www.baanboard.com/baanboard/s...=tcibd0101s000 but it do not have the exact solution for it at the end.
I found out that my tcibd001.wght was revert back to default setting value as 0.000 when save the record through AFS.
Do you have any idea to solve it?

Thanks!
Reply With Quote
  #7  
Old 3rd February 2012, 09:20
v_kewl v_kewl is offline
Member
 
Join Date: Dec 2008
Posts: 49
v_kewl is on a distinguished road
Baan: LN 6.1 - DB: MS SQL - OS: Windows 2003
Hi,

I have attached the session using which you can remove user defaults. Run the attacehd session through RUN Program option or goto "User Management" --> "Miscellaneous" --> "Remove User Defaults"

Regards,
Gaurav
Attached Files
File Type: doc User Default.doc (43.0 KB, 24 views)

Last edited by v_kewl : 3rd February 2012 at 09:26.
Reply With Quote
  #8  
Old 3rd February 2012, 10:24
bdittmar's Avatar
bdittmar bdittmar is offline
Guru
 
Join Date: Apr 2002
Location: Germany, 50.584097,8.544078
Posts: 1,652
bdittmar will become famous soon enough
Baan: 2.2/3.1/4c4/LN6.1 FP6/FP9/HiDox - DB: tbase, ms-sql7, oracle10gV1, 11g - OS: HP-UX, W2K3, SLES
str$(weight) ?

Quote:
Originally Posted by layswan View Post
Hi,

I could insert all the neccessary data to tcibd001 table successfully by using AFS but only the data for Weight (tcibd001.wght) could not insert the data that i want. Is it because of the domain type? Please help......!
Below was the AFS code that i wrote to insert data to tcibd001 table, please advice if there is anything wrong with my code.

-------------------------------------------------------------------------------------------
extern domain tcwght weight
extern domain tcmcs.str4 length
extern domain tcwght lgth_cov
string lgth(4)

lgth = length
lgth_cov = val(lgth)

weight = linear * (lgth_cov/1000)

long ret1, ret2, ret3
string find.msg(100), error.msg(100), syn.msg(100), recover.msg(100)

ret1 = stpapi.find("tcibd0501m000", find.msg)

if ret1 = 1 then

ret2 = stpapi.synchronize.dialog("tcibd0501m000", "add", syn.msg)

if ret2 then

stpapi.put.field("tcibd0101s000", "tcibd001.item.segment.1", " ")
stpapi.put.field("tcibd0101s000", "tcibd001.item.segment.2", str$(item))
stpapi.put.field("tcibd0101s000", "tcibd001.dsca", str$(dscb))
stpapi.put.field("tcibd0101s000", "tcibd001.kitm", str$(kitm))
stpapi.put.field("tcibd0101s000", "tcibd001.citg", str$(citg))
stpapi.put.field("tcibd0101s000", "tcibd001.uset", "STD")
stpapi.put.field("tcibd0101s000", "tcibd001.cuni", "pcs")
stpapi.put.field("tcibd0101s000", "tcibd001.cwun", "kgs")
stpapi.put.field("tcibd0101s000", "tcibd001.dscd", str$(linear))
stpapi.put.field("tcibd0101s000", "tcibd001.wght", str$(weight))
stpapi.put.field("tcibd0101s000", "tcibd001.dscc", str$(peri))
stpapi.put.field("tcibd0101s000", "tcibd001.cpcl", str$(hole))
stpapi.put.field("tcibd0101s000", "tcibd001.csel", str$(press))

ret3 = stpapi.insert("tcibd0101s000", 1, error.msg)

if not ret3 then
stpapi.recover("tcibd0101s000", recover.msg)
endif

stpapi.end.session("tcibd0101s000")

endif

endif

stpapi.end.session("tcibd0501m000")
-------------------------------------------------------------------------------------------

Thanks!
Hello,

with :

stpapi.put.field("tcibd0101s000", "tcibd001.wght", str$(weight))

you convert weight to a string, the domain tcwght is from type double.

Don't convert !

Regards
__________________
//Bernd
Reply With Quote
  #9  
Old 3rd February 2012, 10:54
layswan layswan is offline
Member
 
Join Date: Oct 2007
Posts: 55
layswan is on a distinguished road
Baan: BaanIVc - DB: InforMix 2.7 - OS: Sun Unix
Quote:
Originally Posted by bdittmar View Post
Hello,

with :

stpapi.put.field("tcibd0101s000", "tcibd001.wght", str$(weight))

you convert weight to a string, the domain tcwght is from type double.

Don't convert !

Regards
Hi,

Thanks for your reply!

If i wrote the code as below (which is the weight do not converted to string)
stpapi.put.field("tcibd0101s000", "tcibd001.wght", weight)

I get an error msg as below when i compile the session
ptxswn01000( 423): Error: Argument 3 for function 'stpapi.put.field' has illegal type.
ptxswn01000( 423): Error: Illegal type combination: 'double should be: string'

Is it anything wrong with my code stpapi.put.field("tcibd0101s000", "tcibd001.wght", weight) ?
Reply With Quote
  #10  
Old 3rd February 2012, 11:03
layswan layswan is offline
Member
 
Join Date: Oct 2007
Posts: 55
layswan is on a distinguished road
Baan: BaanIVc - DB: InforMix 2.7 - OS: Sun Unix
Quote:
Originally Posted by v_kewl View Post
Hi,

I have attached the session using which you can remove user defaults. Run the attacehd session through RUN Program option or goto "User Management" --> "Miscellaneous" --> "Remove User Defaults"

Regards,
Gaurav
Hi,

Thanks for your reply!

Mayb i was not explain very well, the default setting that i meant was not the user default setting.

Actually what I mean is when i insert a new record using AFS coding, the weight of the new record was getting the default value of weight from Item-General Default (tcibd0502m000) which is 0.0000 to insert but not insert the new value (weight = linear * (lgth_cov/1000)) as weight in tcibd0101s000.

So, if i delete off the Item-General Defaults setting then the new value (weight = linear * (lgth_cov/1000)) will be inserted as weight in tcibd0101s000.

Do you have any idea on this situation?

Thanks!
Reply With Quote
  #11  
Old 3rd February 2012, 12:17
Juergen's Avatar
Juergen Juergen is offline
Guru
 
Join Date: Aug 2001
Location: Germany
Posts: 573
Juergen is on a distinguished road
Baan: IVc4, ERP LN - DB: Oracle - OS: Linux, Unix
Hi,

just a idea, but why not update the weigth in tcibd001 with a simple select update statement after the item was successfully inserted through AFS?.

Rgds,
Juergen
Reply With Quote
  #12  
Old 3rd February 2012, 17:03
bdittmar's Avatar
bdittmar bdittmar is offline
Guru
 
Join Date: Apr 2002
Location: Germany, 50.584097,8.544078
Posts: 1,652
bdittmar will become famous soon enough
Baan: 2.2/3.1/4c4/LN6.1 FP6/FP9/HiDox - DB: tbase, ms-sql7, oracle10gV1, 11g - OS: HP-UX, W2K3, SLES
Maybe it's the DAL

Quote:
Originally Posted by layswan View Post
Hi,

Thanks for your reply!

Mayb i was not explain very well, the default setting that i meant was not the user default setting.

Actually what I mean is when i insert a new record using AFS coding, the weight of the new record was getting the default value of weight from Item-General Default (tcibd0502m000) which is 0.0000 to insert but not insert the new value (weight = linear * (lgth_cov/1000)) as weight in tcibd0101s000.

So, if i delete off the Item-General Defaults setting then the new value (weight = linear * (lgth_cov/1000)) will be inserted as weight in tcibd0101s000.

Do you have any idea on this situation?

Thanks!
Hello,

maybe the DAL causes this behavior !

Regards
__________________
//Bernd
Reply With Quote
  #13  
Old 3rd February 2012, 17:50
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,929
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Quote:
Originally Posted by bdittmar View Post
Hello,

with :

stpapi.put.field("tcibd0101s000", "tcibd001.wght", str$(weight))

you convert weight to a string, the domain tcwght is from type double.

Don't convert !

Regards
For API code they must all be sent as strings.

Quote:
Originally Posted by Juergen View Post
Hi,

just a idea, but why not update the weigth in tcibd001 with a simple select update statement after the item was successfully inserted through AFS?.

Rgds,
Juergen
I agree and I have used this method several times. I know on the purchase order header right after I create(or insert it) I do a direct update on the table. I am not seeing anything in the code posted. It could be that there is an event or function that does(or does not) get executed that keeps this 0.
__________________
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
  #14  
Old 4th February 2012, 06:52
layswan layswan is offline
Member
 
Join Date: Oct 2007
Posts: 55
layswan is on a distinguished road
Baan: BaanIVc - DB: InforMix 2.7 - OS: Sun Unix
Quote:
Originally Posted by Juergen View Post
Hi,

just a idea, but why not update the weigth in tcibd001 with a simple select update statement after the item was successfully inserted through AFS?.

Rgds,
Juergen
Hi,

Thanks for your suggested idea!

I did think about using simple select update statement to do it but i thought got others way to do it in AFS.
Reply With Quote
  #15  
Old 4th February 2012, 06:56
layswan layswan is offline
Member
 
Join Date: Oct 2007
Posts: 55
layswan is on a distinguished road
Baan: BaanIVc - DB: InforMix 2.7 - OS: Sun Unix
Quote:
Originally Posted by Juergen View Post
Hi,

just a idea, but why not update the weigth in tcibd001 with a simple select update statement after the item was successfully inserted through AFS?.

Rgds,
Juergen
Hi,

Thanks for your idea!

Actually i did think to use a simple select update statement but i thought got others way to do it in AFS.
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
Inserting Item Planning data through AFS VishalMistry Tools Development 4 24th February 2012 23:42
Application data dictionary vs. run-time data dictionary NPRao Tools Development 5 7th July 2009 09:16
ERPJewels Hitesh Shah Third Party Products 10 6th November 2006 06:38
Automation of Release Outbound Data using AFS noorulhaq AFS/DDC/OLE: Function servers 6 22nd December 2005 19:20
how to insert record in type3 form via AFS??? alibaba AFS/DDC/OLE: Function servers 5 17th September 2004 05:19


All times are GMT +2. The time now is 05:39.


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