Baanboard.com

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

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
17%
200 - 500 GB
17%
500 - 800 GB
6%
800 - 1200 GB
6%
1200 - 1500 GB
17%
1500 - 2000 GB
17%
> 2000 GB
22%
Total votes: 18

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 16th July 2018, 03:23
tracylee tracylee is offline
Member
 
Join Date: Sep 2011
Posts: 66
tracylee is on a distinguished road
Baan: ERP LN 6.1 - DB: MYSQL - OS: ERP LN
AFS for BOM (tibom1110m000)

HI,

I have a problem when using AFS to insert data into tibom1110m000. Until script bom_ret4, it cannot be save it. Prompt message bom_ret4 = 1. Please advise.

Code:
function exec.bom()
{
	long	bom_ret1, bom_ret2, bom_ret3, bom_ret4
	string	find.msg(100), error.msg(100), syn.msg(100), recover.msg(100), sav.msg(100)

	stpapi.put.field("tibom1110m000", "tibom010.mitm", str$(item_with_project_name))

	bom_ret1 = stpapi.find("tibom1110m000", find.msg)

		if bom_ret1 = 1 then
			message("BOM Item Code already Exist!")
			message("Item created Failed!")
		else
			bom_ret2 = stpapi.synchronize.dialog("tibom1110m000", "add", syn.msg)

			if bom_ret2 then

				stpapi.put.field("tibom1110m000", "tibom010.mitm", str$(item_with_project_name))
				stpapi.put.field("tibom1110m000", "tibom010.pono", str$(10))
				stpapi.put.field("tibom1110m000", "tibom010.seqn", str$(1))
				stpapi.put.field("tibom1110m000", "tibom010.sitm", str$(full.bom.item))
				stpapi.put.field("tibom1110m000", "tibom010.qana", str$(bom.qty))
				stpapi.put.field("tibom1110m000", "tibom010.cwar", "FINFB")
				stpapi.put.field("tibom1110m000", "tcibd001.cuni", "pcs")
				stpapi.put.field("tibom1110m000", "tibom010.opno", str$(10))

				bom_ret3 = stpapi.insert("tibom1110m000", 0, error.msg)
message("bom_ret3: %s",bom_ret3)
				bom_ret4 = stpapi.save("tibom1110m000", sav.msg)
message("bom_ret4: %s",bom_ret4)
				if not bom_ret3 or not bom_ret4 then
					stpapi.recover("tibom1110m000", recover.msg)
					message("BOM Item created Failed!")
				else
					create.stat = "Succeed"
				endif		
					stpapi.end.session("tibom1110m000")
			endif
		endif

		stpapi.end.session("tibom1110m000")
}
Reply With Quote
Sponsored Links
  #2  
Old 16th July 2018, 05:26
tmannais's Avatar
tmannais tmannais is offline
Member
 
Join Date: Jul 2017
Posts: 94
tmannais is on a distinguished road
Baan: LN 10.5 - DB: MySQL - OS: Windows
Can you try to message these two variables after the save() to see if they contain any error messages?
- error.msg
- sav.msg
Reply With Quote
  #3  
Old 16th July 2018, 06:41
tracylee tracylee is offline
Member
 
Join Date: Sep 2011
Posts: 66
tracylee is on a distinguished road
Baan: ERP LN 6.1 - DB: MYSQL - OS: ERP LN
Quote:
Originally Posted by tmannais View Post
Can you try to message these two variables after the save() to see if they contain any error messages?
- error.msg
- sav.msg
Hi,

I get the error.msg :
Change the value of the Sequence Number field.
Reason:BOM Line PCS-F-E 100-BHH-710,10,1 is already present.

save.msg: is empty

Why the BOM Line get different item code?
Because my main item code is FC-F-C 200-BH-1300, BOM item code is FC-F-C G6488-634.

I got try to message the "item_with_project_name" and "full.bom.item", it is correct item code for main item code and BOM Item code. Please advise. Thanks.
Reply With Quote
  #4  
Old 16th July 2018, 07:01
tmannais's Avatar
tmannais tmannais is offline
Member
 
Join Date: Jul 2017
Posts: 94
tmannais is on a distinguished road
Baan: LN 10.5 - DB: MySQL - OS: Windows
That is strange. Maybe you just didn't put.field() into the correct field name. You should check all of the field names again.
However, for case like this I recommend using DAL. It is easier and is more likely to get the job done than AFS.
Here is an example for inserting a record.

| ******************** DAL **********************
if dal.new.object(TABLE_NAME) <> 0 then
dal.get.error.message(error.msg)
return(error.msg)
endif
dal.set.field(FIELD_NAME, VALUE)
. . . (you can set multiple fields here)
if dal.save.object(TABLE_NAME) <> 0 then
dal.get.error.message(error.msg)
endif
| ***********************************************

And of course, don't forget to include this line at the top of the file.
#include <bic_dam> |* Mandatory for using DAL

Last edited by tmannais : 16th July 2018 at 10:24. Reason: add #include <bic_dam>
Reply With Quote
  #5  
Old 16th July 2018, 11:34
tracylee tracylee is offline
Member
 
Join Date: Sep 2011
Posts: 66
tracylee is on a distinguished road
Baan: ERP LN 6.1 - DB: MYSQL - OS: ERP LN
Quote:
Originally Posted by tmannais View Post
That is strange. Maybe you just didn't put.field() into the correct field name. You should check all of the field names again.
However, for case like this I recommend using DAL. It is easier and is more likely to get the job done than AFS.
Here is an example for inserting a record.

| ******************** DAL **********************
if dal.new.object(TABLE_NAME) <> 0 then
dal.get.error.message(error.msg)
return(error.msg)
endif
dal.set.field(FIELD_NAME, VALUE)
. . . (you can set multiple fields here)
if dal.save.object(TABLE_NAME) <> 0 then
dal.get.error.message(error.msg)
endif
| ***********************************************

And of course, don't forget to include this line at the top of the file.
#include <bic_dam> |* Mandatory for using DAL
Hi,

Thanks for your advice. Now work well. Thanks a lot. ^^
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 waiting timed out (frozen) jp.aalders AFS/DDC/OLE: Function servers 4 20th December 2011 20:48
synchronize.dialog function in AFS of tibom1110m000 VishalMistry Tools Development 1 3rd January 2011 05:02
AFS for tibom1110m000 baancust AFS/DDC/OLE: Function servers 4 1st November 2007 18:23
afs tibom1110m000 schweizer AFS/DDC/OLE: Function servers 4 1st November 2007 14:35
Calling tibom1110m000 with AFS kmcinc AFS/DDC/OLE: Function servers 1 27th October 2003 21:27


All times are GMT +2. The time now is 13:32.


©2001-2018 - Baanboard.com - Baanforums.com