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 14th October 2005, 16:39
Trisli Trisli is offline
Unconfirmed User
 
Join Date: Nov 2004
Location: Denmark
Posts: 10
Trisli is on a distinguished road
Baan: IV and V - ERP LN being installed - DB: * - OS: *
Question Manipulating Sales Orders in LN6 ?

Hi all,

In LN6 I have been trying to make a rather simple script to update a sales order using AFS.

Despite a lot of efforts I have still not reached any working result. Does anybody have positive experiences with this or similar sessions in LN6 (or maybe in BaanERP - the method may be the same...)

I have attached my sample function. If I run the first version (the basic attempt) the system hangs when the "stpapi.synchronize.dialog" is issued. I suppose the problem is that tdsls4100m900 is not a multi-occ session.

If I Try to go the normal "user dialog" way through (the "Alternative try"), I open tdsls4100m000, synchronize it (starting tdsls4100m900) and activate form option: "open.sales.order" (starting tdsls4100m000 in single.occ mode) I receive an error message: "Editable synchronized dialog not started". I suppose this is due to the reason that tdsls4100m000 is started twice, and AFS tries to access the wrong instance.

Finally I have tried to start tdsls4100m900 directly and from there activate the above form option without synchronizing. When updating is this scenario, I receive a: "...use the synchronized dialog".

Does any of you folks know how to break this problem?


Thanks!


Code:
  table ttdsls400       | Sales Orders

  domain tcmcs.long  afs.ret
  domain tcmcs.long  afs.ret.rec
  domain tcmcs.str16 afs.value

  domain tcmcs.str80  recover.mess

  #pragma used dll ottstpapihand

  #pragma used session tdsls4100m900
  #pragma used session tdsls4100m000


function update.sales.order(     domain tcncmp      i.ncmp,  |* Company
                                 domain tcorno      i.orno,

                                 domain tcdate      i.ddat,  |* Pln. Delv Date
                                 domain tcrefa      i.refa,  |* Your ref
                                 domain tcrefb      i.refb,  |* Our ref
                                 domain tcemno      i.crep,  |* Internal Sales rep
                                 domain tccpay      i.cpay,  |* Terms of Payment

                             ref domain tcmcs.str80 o.mess)
{
  o.mess = ""

  stpapi.put.field("tdsls4100m900","tdsls400.orno", strip$(shiftl$(i.orno)) )
  afs.ret = stpapi.find("tdsls4100m900", o.mess)

  if afs.ret <> 1 then
    o.mess = sprintf$("Cannot find sales order: %s in session tdsls4100m900", i.orno)
   else

    afs.ret = stpapi.synchronize.dialog("tdsls4100m900", "modify", o.mess)   |* Causes the program to hang
    if afs.ret = 1 then

    stpapi.form.command("tdsls4100m900", 5, "open.sales.order", o.mess)
    |* *** starts synchronized session session tdsls4100m000 as a child process ***

|   |* *** as sessions are not synchronized in AFS, ...
|   stpapi.put.field("tdsls4100m000","tdsls400.orno", strip$(shiftl$(i.orno)) )
|   afs.ret = stpapi.find("tdsls4100m000", o.mess)
|
|   if afs.ret <> 1 then
|     o.mess = sprintf$("Cannot find sales order: %s in session tdsls4100m000", i.orno)
|    else
      stpapi.put.field("tdsls4100m000","tdsls400.ddat", str$(i.ddat))

      stpapi.put.field("tdsls4100m000","tdsls400.refa", strip$(shiftl$(i.refa)))
      stpapi.put.field("tdsls4100m000","tdsls400.refb", strip$(shiftl$(i.refb)))

      stpapi.put.field("tdsls4100m000","tdsls400.crep", strip$(shiftl$(i.crep)))
      stpapi.put.field("tdsls4100m000","tdsls400.cpay", strip$(shiftl$(i.cpay)))

      afs.ret = stpapi.update("tdsls4100m900", true, o.mess)

      if afs.ret <> 1 then
        afs.ret.rec = stpapi.recover("tdsls4100m000", recover.mess)

        if isspace(o.mess) then
          o.mess = sprintf$("Error during update of sales order: %s", i.orno)
        endif
      endif
|   endif
  endif

  stpapi.end.session("tdsls4100m000")

  return(afs.ret = 1)
}
Alternative try:
Code:
    stpapi.put.field("tdsls4100m000","tdsls400.orno", strip$(shiftl$(i.orno)) )
    afs.ret = stpapi.find("tdsls4100m000", o.mess)

    if afs.ret <> 1 then
      o.mess = sprintf$("Cannot find sales order: %s in session tdsls4100m900", i.orno)
     else
      afs.ret = stpapi.synchronize.dialog("tdsls4100m000", "modify", o.mess)   |* Causes the program to hang
      if afs.ret = 1 then

        stpapi.form.command("tdsls4100m900", 5, "open.sales.order", o.mess)
        |* *** starts synchronized session session tdsls4100m000 as a child process ***

        stpapi.put.field("tdsls4100m000","tdsls400.orno", strip$(shiftl$(i.orno)) )
        afs.ret = stpapi.find("tdsls4100m000", o.mess)

        if afs.ret <> 1 then
          o.mess = sprintf$("Cannot find sales order: %s in session tdsls4100m000", i.orno)
         else
          stpapi.put.field("tdsls4100m000","tdsls400.ddat", str$(i.ddat))

          stpapi.put.field("tdsls4100m000","tdsls400.refa", strip$(shiftl$(i.refa)))
          stpapi.put.field("tdsls4100m000","tdsls400.refb", strip$(shiftl$(i.refb)))

          stpapi.put.field("tdsls4100m000","tdsls400.crep", strip$(shiftl$(i.crep)))
          stpapi.put.field("tdsls4100m000","tdsls400.cpay", strip$(shiftl$(i.cpay)))

          afs.ret = stpapi.update("tdsls4100m900", true, o.mess)

          if afs.ret <> 1 then
            afs.ret.rec = stpapi.recover("tdsls4100m000", recover.mess)

            if isspace(o.mess) then
              o.mess = sprintf$("Error during update of sales order: %s", i.orno)
            endif
          endif
        endif
      endif
    endif
|* **** end of source ****

Last edited by patvdv : 15th October 2005 at 16:13.
Reply With Quote
  #2  
Old 15th October 2005, 16:13
patvdv's Avatar
patvdv patvdv is offline
Board Master
 
Join Date: Aug 2001
Location: Belgium
Posts: 2,167
patvdv is on a distinguished road
Baan: n/a - DB: n/a - OS: AIX, HP-UX, Linux
Thread opened and *bumped*
__________________
Regards,

Patrick Van der Veken - Admin & Founder - (c) 2001-2017 baanboard.com/baanforums.com
Reply With Quote
  #3  
Old 18th October 2005, 15:18
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
Just a wild guess while I was reading this - what happens in the first case if you delete the afs.ret = stpapi.synchronize.dialog("tdsls4100m900", "modify", o.mess) line? Just wondering if tdsls4101m000 would launch okay.
__________________
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 22nd October 2005, 14:12
csecgn's Avatar
csecgn csecgn is offline
Guru
 
Join Date: Aug 2004
Location: Cologne/Germany
Posts: 300
csecgn is on a distinguished road
Baan: IVc4 SP14 (Tools SP 21) ; LN 6.1 (Testing) - DB: Oracle - OS: Solaris
Maybe give tdslsdlll1234 a look. AFAIK this dll is the way SSA adds Sales orders. Maybe there is also a way to manipulate them with the dll.

Regards
csecgn
Reply With Quote
Sponsored Links
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
How to protect create sales orders over credit limits ? rini pudjiastut Distribution, Transportation & Warehousing 2 1st December 2004 03:38
VAT handling in sales orders Kaibou Finance, Invoicing and Integration 6 1st September 2004 15:36
Calling Maintain Sales Orders for Inserting .. (No source Code) baanlegend Tools Development 1 28th April 2003 16:58
Block Sales orders if invoices are overdue amarpreet Distribution, Transportation & Warehousing 3 12th December 2002 11:57
Performance issue while running EDI-DNC to create Sales Orders. How I resolve? mraguthu Tools Development 0 28th March 2002 19:08


All times are GMT +2. The time now is 18:42.


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