Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

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 3rd March 2009, 11:49
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
Arrow update session
Baan: Baan IVc4
C/S: Client

Dear,

With this script I’m able to update the item master for any date. I am also able to insert the new date(ticpr300.indt)and new amount(ticpr300.amnt)

Problem:
I’m unable to update the new amount in ticpr300.amnt for same date but able to update tiitm001 table smoothly.
For ex:
If I update tiitm001.copr = 36 tiitm001.ltcp = 03/03/09 the record get updated in tiitm001 and inserted in ticpr300 respective tables.
If I update again tiitm001.copr = 40 tiitm001.ltcp = 03/03/09 the records get updated in tiitm001 table but the record is not updated in ticpr300 table.
My script:
Code:
form.1:
init.form:
            get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:

on.choice:
            
                        read.main.table1()
                        
                        
|****************************** field section *********************************

|****************************** function section ******************************
functions:


function read.main.table1()
{                       
                        
                        item = ""
                        itemc = ""
                        db.retry.point()
                        select ticpr300.*
                        from ticpr300 for update
                        where ticpr300.item = :item.f 
                        |and ticpr300.amnt <> 0.0
                        order by ticpr300.item, ticpr300.indt desc
                        as set with  1 rows
                        selectdo
                                    

                                    if item = ticpr300.item then
                                    else
                                                itemf = ""
                                                itemnf = ""
                                    endif
                        
                                    
                                    if ticpr300.indt = date.num()  then
                                    itemf = ticpr300.item
                                    
                                    db.retry.point()
                                    select tiitm001.*
                                    from tiitm001 for update
                                    where tiitm001.item  = :itemf
                                    
                                    selectdo
                        
                                                |tiitm001.copr = ticpr300.amnt
                                    |tiitm001.ltcp = ticpr300.indt       
                                                |tiitm001.matc = ticpr300.amnt
                                                tiitm001.kitm =tckitm.purchase
                                                tiitm001.copr = copr.f
                                                tiitm001.matc = copr.f
                                                tiitm001.ltcp = date.num()
                                                                  
                                                db.update(ttiitm001,db.retry)      
                                                commit.transaction()
                                                
                                    endselect          
                                    endif

                                    if ticpr300.indt <> date.num()  and  isspace(itemf)  then
                                                itemnf = ticpr300.item
                                    
                                    db.retry.point()
                                    select tiitm001.*
                                    from tiitm001 for update
                                    where tiitm001.item = :itemnf
                                    and tiitm001.stoc = 0.0
                                    selectdo
                                                
                                                tiitm001.kitm =tckitm.purchase
                                                tiitm001.copr = copr.f
                                                tiitm001.matc = copr.f
                                                tiitm001.ltcp = date.num()          
                                                
                                                db.update(ttiitm001,db.retry)              
                                                commit.transaction()
                                                
                                                ticpr300.item = item.f
                                                ticpr300.cntr = tiitm001.cntr
                                                ticpr300.indt = tiitm001.ltcp
                                                ticpr300.cpcp = "001"
                                                ticpr300.nuni = 1.00
                                                ticpr300.actf = 1.00
                                                ticpr300.amnt = tiitm001.copr
                                                if ticpr300.indt=date.num() then
                                                            
                                                            db.update(tticpr300,db.retry)
                                                else
                                                            db.insert(tticpr300,db.retry)
                                                endif
                                                commit.transaction()

                                    endselect
                                    endif
                                    
                                    

                                    
                        item = ticpr300.item
                        
                        endselect
                        |message ("Item is updated now")
            }

Last edited by george7a : 3rd March 2009 at 13:22. Reason: adding baan code tags
Reply With Quote
  #2  
Old 3rd March 2009, 13:26
george7a's Avatar
george7a george7a is offline
Guru
 
Join Date: May 2004
Location: Nazareth
Posts: 1,490
george7a is on a distinguished road
Baan: IVc, 5.0 b, 5.0 c, LN 6.1 - DB: MS SQL, Oracle - OS: Windows 2000, 2003 & UNIX
Hi,

Did you try to debug the code and see if it gets into the selectdo or not (in both SQL)?

- George
__________________
_
George Abdo
NAZDAQ - Your Documents, Your Way.
Reply With Quote
Sponsored Links
  #3  
Old 4th March 2009, 07:03
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
Arrow update

Dear,
I have tried to debug the above script and have changed the script.
Now,Just help me in updating Ticpr300 table when the tiitm001.copr changes in same date.
I get the above error(attached file) when I execute the items for same date and works smoothly for different dates
My form inputs are item.f (item)and copr.f(cost price)

HTML Code:
|******************************* form section *********************************
form.1:
init.form:
            get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:

on.choice:
            
                        read.main.table1()
                        
                        
|****************************** field section *********************************

|****************************** function section ******************************
functions:
function read.main.table1()
{                       
                        
  	item = ""
  	itemc = ""
  	db.retry.point()
        select ticpr300.*
        from ticpr300 for update
        where ticpr300.item = :item.f 
       	order by ticpr300.item, ticpr300.indt desc
       	as set with  1 rows
        selectdo
           	
		
         	if ticpr300.indt = date.num()  then
         		itemf = ticpr300.item
         		db.retry.point()
         		select tiitm001.*
         		from tiitm001 for update
        		where tiitm001.item  = :item.f
         	selectdo
                	tiitm001.kitm =tckitm.purchase
                	tiitm001.copr = copr.f
              		tiitm001.matc = copr.f
        		tiitm001.ltcp = date.num()
       			db.update(ttiitm001,db.retry)      
    			commit.transaction()
		|selectempty
			ticpr300.item = item.f
              		ticpr300.cntr = tiitm001.cntr
             		ticpr300.indt = tiitm001.ltcp
             		ticpr300.cpcp = "001"
              		ticpr300.nuni = 1.00
             		ticpr300.actf = 1.00
              		ticpr300.amnt = tiitm001.copr
              		db.update(tticpr300,db.retry)
			commit.transaction()
           	endselect
                	           
        	endif
		
		if ticpr300.indt <> date.num()   then
        		itemnf = ticpr300.item
      			db.retry.point()
       			select tiitm001.*
       			from tiitm001 for update
       			where tiitm001.item = :item.f
      			and tiitm001.stoc = 0.0
       		selectdo
               		tiitm001.kitm =tckitm.purchase
               		tiitm001.copr = copr.f
               		tiitm001.matc = copr.f
               		tiitm001.ltcp = date.num()          
               		db.update(ttiitm001,db.retry)              
             		commit.transaction()
             
			ticpr300.item = item.f
              		ticpr300.cntr = tiitm001.cntr
             		ticpr300.indt = tiitm001.ltcp
             		ticpr300.cpcp = "001"
              		ticpr300.nuni = 1.00
             		ticpr300.actf = 1.00
              		ticpr300.amnt = tiitm001.copr
              		db.insert(tticpr300,db.retry)
			commit.transaction()
		
           	endselect
          	endif
               			item = ticpr300.item
      		endselect
                       
            }
Attached Images
File Type: jpg coprerr.JPG (18.6 KB, 16 views)

Last edited by smusba : 4th March 2009 at 12:14. Reason: adding baan code tags
Reply With Quote
  #4  
Old 5th March 2009, 21:37
blanchap's Avatar
blanchap blanchap is offline
Senior Member
 
Join Date: Feb 2005
Location: Montreal, Qc, Canada
Posts: 113
blanchap is on a distinguished road
Baan: BaanIV c4 - DB: Oracle 10g - OS: HP-UX 11.23
Hi,

i do not understand your script. you're doing 2 db.update and 2 commit.transaction() in the same selectdo.

Also, you have 1 db.update and 1 db.insert in the same selectdo.

If you fix your script, it's going to work.

PB.
Reply With Quote
  #5  
Old 7th March 2009, 06:17
smusba smusba is offline
Senior Member
 
Join Date: Apr 2008
Posts: 173
smusba is on a distinguished road
Baan: Baan 1V - DB: Oracle 9i - OS: Windows xp
update item and cost price

Dear,

Thank You for your help. The script worked succesfully.
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
Behaviour main display session as synchronised dialog en@frrom Tools Development 3 3rd April 2010 13:08
Excute a form command of AFS session en@frrom AFS/DDC/OLE: Function servers 4 30th May 2005 14:54
Start a customized session from a standard session ltannous Tools Development 15 26th May 2005 14:08
tfacp9450m000 FIBU Brush Up Kai's Forum Users Deutsches Forum 1 16th November 1999 00:00


All times are GMT +2. The time now is 11:00.


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