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 21st September 2005, 10:30
Kingsto88 Kingsto88 is offline
Senior Member
 
Join Date: Oct 2004
Posts: 208
Kingsto88 is an unknown quantity at this point
Baan: Baan 4, Baan 5 - DB: SQL server, Informix - OS: Windows 2000, HP Unix
generate outbound advice with API in Baan 5

Hi experts,

I am trying to run whinh4201m000 to generate using API. (baan5c)

Has anyone done this before?

My code is as below. No error message is appearing when i run stpapi.form.command. Anyone know what is wrong?

Thanks and regards,
Code:
function update.table()
{
	long ret
	message("update")
	string tmp.orno(6)
	stpapi.put.field("whinh4201m000","runnumber","")
	stpapi.put.field("whinh4201m000","overwrite.range",str$(tcyesno.yes))
	stpapi.put.field("whinh4201m000","oorg.f",str$(whinh.oorg.sales))
	stpapi.put.field("whinh4201m000","oorg.t",str$(whinh.oorg.sales))
	stpapi.put.field("whinh4201m000","orno.f","210000009")
	stpapi.put.field("whinh4201m000","orno.t","210000009")
	stpapi.put.field("whinh4201m000","oset.f","0")
	stpapi.put.field("whinh4201m000","oset.t","999")
	stpapi.put.field("whinh4201m000","pono.f","0")
	stpapi.put.field("whinh4201m000","pono.t","9999")
	stpapi.put.field("whinh4201m000","dldt.f",str$(date.num()-100000))
	stpapi.put.field("whinh4201m000","dldt.t",str$(date.num()+100000))
	stpapi.put.field("whinh4201m000","stty.f",str$(whinh.type.warehouse))
	stpapi.put.field("whinh4201m000","stty.t",str$(whinh.type.work.center))

	
	stpapi.put.field("whinh4201m000","stco.f","")
	stpapi.put.field("whinh4201m000","stco.t","ZZZZZZZZZ")
	stpapi.put.field("whinh4201m000","shpt.f","")
	stpapi.put.field("whinh4201m000","shpt.t","ZZZZZZZZZ")
	stpapi.put.field("whinh4201m000","crte.f","")
	stpapi.put.field("whinh4201m000","crte.t","ZZZZZ")
	stpapi.put.field("whinh4201m000","carr.f","")
	stpapi.put.field("whinh4201m000","carr.t","ZZZ")
	stpapi.put.field("whinh4201m000","cwar.f","")
	stpapi.put.field("whinh4201m000","cwar.t","ZZZZZZ")

	
	stpapi.put.field("whinh4201m000","item.f","")
	stpapi.put.field("whinh4201m000","item.t",
	   "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ")
	

| The next 4 lines generate both the advice and shortages, if you want
| just one report then set the flags correctly, but always point the report
| to the advice report - This is the only way to get it to work.
| Advice Report
	stpapi.put.field( "whinh4201m000", "pradvice", str$(tcyesno.no) )
	stpapi.put.field( "whinh4201m000", "prshortage", str$(tcyesno.no) )
	|spool.fileout = "tmp0001"
	|stpapi.set.report( "whinh4201m000","rwhinh420101000","ASCIF", msg )
	stpapi.form.command("whinh4201m000",5,"exec.user.0",msg)
	if not isspace(msg) then
		|stpapi.continue.process("whinh4201m000",msg)
		message("%s",msg)
	endif
	stpapi.end.session("whinh4201m000")

}

Last edited by Paul P : 21st September 2005 at 10:50.
Reply With Quote
  #2  
Old 21st September 2005, 11:02
Paul P's Avatar
Paul P Paul P is offline
Guru
 
Join Date: Jul 2002
Location: Jakarta, Indonesia
Posts: 797
Paul P is on a distinguished road
Baan: BaanIV, BaanERP - DB: SQL Server, Informix, Oracle - OS: Windows, HP-UX
As per API manual, when sending enumerator to BaanERP session under API, always send the string version of the long integer version of the enumerator (e.g. stpapi.put.field("whinh4201m000","oorg.f",str$(etol(whinh.oorg.sales))) ) . I saw you made several syntax errors in this regard. Please correct and let us know the result. I've never done generate outbound advice through API before, but I've implemented WMS-ERP integration through the use of create (not generate) outbound advise via BaanERP API

Rgds,
Paul
__________________
Pambudi

Visit my technology consulting blog
Reply With Quote
  #3  
Old 22nd September 2005, 06:07
Kingsto88 Kingsto88 is offline
Senior Member
 
Join Date: Oct 2004
Posts: 208
Kingsto88 is an unknown quantity at this point
Baan: Baan 4, Baan 5 - DB: SQL server, Informix - OS: Windows 2000, HP Unix
unsuccessful

Dear Paul,

There is no syntax error when i compile my program.

Anyway, I still changed the program to add in the etol function.

But still it is unsuccessful. No Outbound advice is created.

Hope someone has used API in baan 5 before.

I am trying this exercise in baan 5.
In baan 4, i have no problem generating outbound with API.

Can someone tell me how do I know/check the API in baan 5 in my system is actually working.

Thanks and regards,
Reply With Quote
  #4  
Old 22nd September 2005, 09:44
Paul P's Avatar
Paul P Paul P is offline
Guru
 
Join Date: Jul 2002
Location: Jakarta, Indonesia
Posts: 797
Paul P is on a distinguished road
Baan: BaanIV, BaanERP - DB: SQL Server, Informix, Oracle - OS: Windows, HP-UX
One more thing you should get used to when switching to and fro BaanERP is that BaanERP uses UTC (Universal Time Coordinated). So in your case, I'd expect the program to give unexpected result, because you used the date.num() function while calculating value to pass to dldt.f and dldt.t (which are in UTC). Please read the Tools on line help to learn more about UTC.
To cut story short, when passing values to a from/to date/time in BaanERP, I usually send utc.num()-7*24*60*60 (i.e. exactly 7 days before the current date & time) to the from field and send utc.num()+7*24*60*60 to the to field. Use this approach and your API program should work better in BaanERP (provided the planned delivery date is +/- 1 week from current date & time)

Rgds,
Paul
__________________
Pambudi

Visit my technology consulting blog
Reply With Quote
  #5  
Old 23rd September 2005, 11:08
Kingsto88 Kingsto88 is offline
Senior Member
 
Join Date: Oct 2004
Posts: 208
Kingsto88 is an unknown quantity at this point
Baan: Baan 4, Baan 5 - DB: SQL server, Informix - OS: Windows 2000, HP Unix
Thank you

Dear Paul,

I have changed it to utc.num()
and it works fine.

Thank you very much, appreciate your help.

Very exciting when it works.

Regards,
Reply With Quote
  #6  
Old 21st March 2014, 21:57
eric.dizon's Avatar
eric.dizon eric.dizon is offline
Senior Member
 
Join Date: Feb 2012
Posts: 151
eric.dizon is on a distinguished road
Baan: ERP LN - DB: MS SQL - OS: 2003
I am trying to create an AFS for this in ERP LN FP7. I am trying to follow the same code you have but I am having no luck, with my code below it generates a Run Number in whinh4500m000 but no outbound advise can any body review and let me know what possible issues i might have. We do need to print the outbound advise and outbound shortages.


res = utc.add(utc.num(),0,0,100,0,0,0,ddta.t)

stpapi.put.field("whinh4201m000", "runnumber", trim$(runnumber))
stpapi.put.field("whinh4201m000", "overwrite.range", str$(ltoe(1)))

stpapi.put.field("whinh4201m000", "dldt.t", str$(ddta.t) )
stpapi.put.field("whinh4201m000", "cwar.f", " " )
stpapi.put.field("whinh4201m000", "cwar.t", "ZZZZZZ" )
stpapi.put.field("whinh4201m000", "stty.f", str$(ltoe(1)) ) |Warehouse
stpapi.put.field("whinh4201m000", "stty.t", str$(ltoe(4)) ) |Work Center
stpapi.put.field("whinh4201m000", "stco.f", " " )
stpapi.put.field("whinh4201m000", "stco.t", "ZZZZZZZZZ" )
stpapi.put.field("whinh4201m000", "shpt.f", " " )
stpapi.put.field("whinh4201m000", "shpt.t", "ZZZZZZZZZ" )
stpapi.put.field("whinh4201m000", "crte.f", " " )
stpapi.put.field("whinh4201m000", "crte.t", "ZZZZZ" )
stpapi.put.field("whinh4201m000", "carr.f", " " )
stpapi.put.field("whinh4201m000", "carr.t", "ZZZ" )

stpapi.put.field("whinh4201m000", "oorg.f", str$(ltoe(1)) )
stpapi.put.field("whinh4201m000", "oorg.t", str$(ltoe(90)) )
stpapi.put.field("whinh4201m000", "grid.f", " " )
stpapi.put.field("whinh4201m000", "grid.t", " " )
stpapi.put.field("whinh4201m000", "orno.f", cxcsb005.orno )
stpapi.put.field("whinh4201m000", "orno.t", cxcsb005.orno )
stpapi.put.field("whinh4201m000", "oset.f", "0" )
stpapi.put.field("whinh4201m000", "oset.t", "999999" )
stpapi.put.field("whinh4201m000", "pono.f", "0" )
stpapi.put.field("whinh4201m000", "pono.t", "9999" )

stpapi.put.field("whinh4201m000","item.f","")
stpapi.put.field("whinh4201m000","item.t", "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ")


stpapi.put.field("whinh4201m000", "pradvise", str$(ltoe(1)) )
stpapi.put.field("whinh4201m000", "prshortage", str$(ltoe(1)) )

stpapi.put.field("whinh4201m000", "include.returns", str$(ltoe(2)) )
stpapi.put.field("whinh4201m000", "rush.orders.only", str$(ltoe(2)) )

stpapi.form.command( "whinh4201m000", 5, "advise", err.cmd )
if not isspace(err.cmd) then
message("%s",err.cmd)
endif
stpapi.end.session("whinh4201m000")
Reply With Quote
  #7  
Old 23rd March 2014, 17:58
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,906
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Not sure this is it since we do not use the session, but the first thing that jumped out to me is the grid.f and grid.t have both set to blank.

If it is not that then the next thing I would try is commenting out all ranges that you are setting to the default. They do not have to be set - unless the user id you are testing with has some defaults saved on the session that you do not what to test with. Just put the bare minimum you would need to run it to test with. Then if you get that working you can add the fields back in - one at a time until you locate which one is causing the issue.
__________________
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 24th March 2014, 17:30
eric.dizon's Avatar
eric.dizon eric.dizon is offline
Senior Member
 
Join Date: Feb 2012
Posts: 151
eric.dizon is on a distinguished road
Baan: ERP LN - DB: MS SQL - OS: 2003
Hi mark, I've populated grid.f and grid.t as well but still no luck. Run number is being generated by the AFS code but not the outbound advise. I can't see any error either being returned. I am currently stuck on what else to try...
Reply With Quote
  #9  
Old 24th March 2014, 20:24
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,906
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Try using stpapi.get.mess.code right after the stpapi.form.command( "whinh4201m000", 5, "advise", err.cmd ). See if your getting "no data found" or any error message. I suspect the put fields for now. For example - I notice cxcsb005.orno is used directly. Is this a string value? If not make it str$(cscsb005.orno). Next I would pull out every range in the code that is wide open. I would also open the date range up with like -1000 and +1000 like the original code. Also is the item segmented?

I also noticed the original program uses stpapi.form.command("whinh4201m000",5,"exec.user.0",msg) and you use stpapi.form.command( "whinh4201m000", 5, "advise", err.cmd ). I am not sure which is correct.
__________________
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
  #10  
Old 26th March 2014, 17:17
eric.dizon's Avatar
eric.dizon eric.dizon is offline
Senior Member
 
Join Date: Feb 2012
Posts: 151
eric.dizon is on a distinguished road
Baan: ERP LN - DB: MS SQL - OS: 2003
Thanks for all the good pointers Mark, I think the item being segmented is the one that resolved my issue.
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
Invitation to SSA Global's BaaN User Group Meeting in Bangkok nopadon ไทยฟอรัม 0 12th January 2005 19:25
Generate outbound for a specific location only GaryEd Distribution, Transportation & Warehousing 3 25th March 2004 15:14
Baan World Users conference in Orlando chadwickh General Discussion & Chat 7 3rd November 2001 21:55
Availability of Web-Based DEM (Baan Press Release) Pierre B. General Discussion & Chat 0 5th September 2001 05:59
BSP-US (LLC) added as a Baan Education Alliance svandenh General Discussion & Chat 1 20th August 2001 19:44


All times are GMT +2. The time now is 02:16.


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