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 13th March 2015, 14:20
minadursun minadursun is offline
Newbie
 
Join Date: Jul 2014
Posts: 0
minadursun is on a distinguished road
Baan: erpln - DB: oracle - OS: besc
stpapi, inserting lines on tfcmg2500m000 bank transaction session

In Infor ERP-LN 10.4 when I created a patch then bank transaction, I want to import lots of advance payment lines from *.csv file to the Transactions (tfgld1101m000) session.

I started the tfgld1101m000 and added a new batch and new transaction type (bank transaction), then run "Transaction Entry -enter.transactions-" form command. Actually this command is on the menu of the tfgld1101m100 Transaction Types session.

After then Bank Transactions (tfcmg2500m000) session is started via this command. I wanna insert my advance payment lines on this session. On the menu, there is a form command that is Insert -insert.in.details.mode-. Via this command, Bank Transactions session (tfcmg2500m000) is running again with different design -On fp3 from tfgld1101m000, I had got tfcmg2100s000 session screen and that looked like tfcmg2500m000-.

Here is my code below:


Code:
	#pragma used dll ottstpapihand
	#define MAIN.SESSION "tfgld1101m100"
	#define SUB.SESSION "tfcmg2500m000"

function void doit()
{
	boolean tmp.first
	long afs.ret
	
	afs.ret = 0
	error.msg = ""

        stpapi.put.field(MAIN.SESSION, "tfgld101.year", str$(year.f))
	stpapi.put.field(MAIN.SESSION, "tfgld101.btno", str$(btno.f))
	stpapi.put.field(MAIN.SESSION, "tfgld101.ttyp", ttyp.f)
	afs.ret = stpapi.find(MAIN.SESSION,  error.msg)
	if afs.ret <> 1 then
		fp.ret = seq.puts("Error: Could not find the record! ", fp.log)
		stpapi.end.session(MAIN.SESSION, error.msg)
		return
	endif
	afs.ret = stpapi.mark(MAIN.SESSION,  error.msg)
	if afs.ret <> 1 then
		fp.ret = seq.puts("Error: Could not mark the record! ", fp.log)
		stpapi.end.session(MAIN.SESSION, error.msg)
		return
	endif


	stpapi.handle.subproc(MAIN.SESSION, SUB.SESSION, "add", error.msg)

	stpapi.form.command(MAIN.SESSION, 2, "enter.transactions", error.msg)

	stpapi.form.command(SUB.SESSION, 2, "insert.in.details.mode", error.msg) 
	if afs.ret = 0 then
		message(error.msg)
		stpapi.end.session(MAIN.SESSION, error.msg)
		return
	endif

	tmp.first = true
	while seq.gets(buffer, MAX.STR, fp.import) = 0
		if process.records.from.file() = NUMBER.OF.FIELDS then
			create.record(tmp.first)
			tmp.first = false
		else
			fp.ret = seq.puts(buffer & "Data is corrupt " , fp.log)
		endif
	endwhile
	stop.all.processes()
}

function long process.records.from.file() 
{	
	
	fields.scanned = string.scan(buffer, "%s,%s,%s,%f", prm.bpid, prm.bpnm, prm.bpac, prm.amnt)
	return(fields.scanned) 
}


function create.record(boolean first.i)
{
	long afs.ret
	string tmp.str(MAX.STR) mb
	
	stpapi.put.field(SUB.SESSION, "tfcmg204.year", str$(year.f))
	stpapi.put.field(SUB.SESSION, "tfcmg204.btno", str$(btno.f))
	stpapi.put.field(SUB.SESSION, "tfcmg204.ttyp", str$(ttyp.f))
	stpapi.put.field(SUB.SESSION, "tfcmg204.docd", str$(docd.f))
	stpapi.put.field(SUB.SESSION, "tfcmg204.docn", str$(seri.f))
	stpapi.put.field(SUB.SESSION, "tfcmg204.lino", "1")
	stpapi.put.field(SUB.SESSION, "tfcmg204.tran", str$(tfcmg.tran.advance.paym))
	stpapi.put.field(SUB.SESSION, "tfcmg204.bpid", prm.bpid)
	stpapi.put.field(SUB.SESSION, "tfcmg204.ccur", ccur.f)
	stpapi.put.field(SUB.SESSION, "tfcmg204.amnt", str$(prm.amnt))
	prm.bpnm = referance.f & " " & prm.bpnm
	stpapi.put.field(SUB.SESSION, "tfcmg204.refr", prm.bpnm)
	afs.ret = stpapi.insert(SUB.SESSION, true, error.msg)
	if afs.ret = 0 then
		tmp.str = "Error: "  & buffer & " Message: " & mb.cast.to.str$(error.msg)
		fp.ret = seq.puts(tmp.str, fp.log)
		afs.ret = stpapi.recover(SUB.SESSION, error.msg)
	endif

}

function generate.tmp.file.names()
{
	long r_number
	
	r_number = random()
	
	remote.file.name = getenv$("BSE") & "/tmp/import_items_uploaded_" & str$(r_number) & ".txt"
	log.file.name = getenv$("BSE") & "/tmp/import_items_log_" & str$(r_number) & ".txt"
}

function stop.all.processes()
{
	stpapi.end.session(SUB.SESSION, error.msg)
	stpapi.end.session(MAIN.SESSION, error.msg)
}
My *.csv file format is below:

123456,Mark Smith,666666,128.6
654321,Alice Silver,5555555,32.51


First column is Business Partner ID,
Second column is BP name,
Third one is bank account
Fourth one is amount.

My problem is that,
On fp3 my main session was tfgld1101m000 and this program was working very vell. I change it with tfgld1101m100 on 10.4. It works but one line is added, next one is not.
For example if I have 10 lines, the program added only 5 lines and these are 1., 3., 5., 7., 9. ones.

I could not understand why. Please share your experience and thoughts with me.

Thanks in advance.

Mina
Reply With Quote
Sponsored Links
  #2  
Old 15th March 2015, 21:28
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,355
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,

First thing to check will be the data. Check if you are manually able to insert the records.

If the data is OK, you can try using suspend() function after your insert (or after one of the form commands which is taking more time to execute). Something like suspend(500) will be fine.

May be the first record is taking time to save as with 10.4 the number of DAL hooks and dependencies have increased.
__________________
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
Programming Question mr_suleyman Tools Development 37 11th November 2016 08:14
Paramter receipt schedule is activate, so cannot start the session mostrightfuture Finance, Invoicing and Integration 0 23rd January 2006 10:10
Wrong standard cost used in Integration Transaction Lines handyb Finance, Invoicing and Integration 3 25th October 2005 04:38
Problem with inserting several SLS lines lakoon AFS/DDC/OLE: Function servers 4 20th August 2004 16:36
problem in inserting multiple lines in table joshua Tools Development 1 27th November 2003 14:17


All times are GMT +2. The time now is 09:28.


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