Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Contributor
matthewb
Posts: 36
Registered: 08-24-2010
0

Setting GL Account Code

Hello all.....

 

I'm on MAS90 4.4 SU5.

 

If I set the GL acount code for a MISC Item before i bring it into a PO it works fine. the issue I am having is trying to set the GL Acct code while creating the line in the P.O.

 

here's what i have:

 

retval = oPurchObj.oLines.nAddline()
retval = oPurchObj.oLines.nSetvalue("Itemcode$", "/101")
retval = oPurchObj.oLines.nSetvalue("QuantityOrdered", 3)
retval = oPurchObj.oLines.nSetvalue("Unitcost", 40.00)
retval = oPurchObj.oLines.nSetvalue("PurchAcctKey$", "475048045100")
'retval = oPurchObj.oLines.nSetvalue("PurchAcctKey$, "47504804J") - When I manually enter the Order in MAS PO_PurchOrderDetail is populated with this account number in PurchaseAcctKey Column.
retval = oPurchObj.oLines.nWrite()

 

I assume i need to "call" it a different way when writting the GL account code.

 

What further confuses me is why the GL Account code is written to MAS like that. when i view the PO in MAS the Gl Account code is written out in its entirety. when look at in the the talble it lops off the "5100" and puts a "J"

 

any help is appreciated!

 

Thanks

 

Matt

Contributor
matthewb
Posts: 36
Registered: 08-24-2010
0

Re: Setting GL Account Code

NM... i was able to figure it out......

 

retval = oPurchObj.oLines.nSetvalue("AccountKey$", "4750-480-451-00")

 

Automatically populates the field with the proper key.

 

Thanks

Contributor
matthewb
Posts: 36
Registered: 08-24-2010
0

Re: Setting GL Account Code

i spoke to soon. i still cannot get the script to write the G/L account when creating the PO Line. The error i get is:

 

"update is not successful: This Purchase Order has no lines and has zero total amounts."

 

Thanks

Sage Employee
jepritch
Posts: 233
Registered: 08-25-2009
0

Re: Setting GL Account Code

Hi matthewb,

 

Where exactly are you using your script?  Is this a button driven script from within Purchase Order Entry?  Or in a totally different applicaiton.  It looks from your script that you are not doing this from within the PO Entry object itself, but outside of it.

 

This error usually occurs if you forgot to do a Write() to the line itself, before updating the header.

 

Hope this helps.

 

E