Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Contributor
jryals
Posts: 37
Registered: 11-23-2008
0
Accepted Solution

GL Budget lookup

I'm trying to retrieve the Budget Amounts from the GL_PeriodBudgetDetail file.  It is not finding the record.  Below is my code. What is the problem?

Thanks

 

'***** GL BUDGET TEST *******

oGlAccount = 0
TmpGL =""
TmpBudgetAcct=""
TmpAcct=""
TmpBudgetCode="BUDGET 3."
TmpFiscalYear="2010"
TmpFiscalPeriod="01"
TmpDebit=0
TmpCredit=0
Budget=0

'
retVal = oBusObj.GetValue("PurchasesAcctKey$",TmpAcct) 'Get Purchase Account Key

Set oGLAccount = oSession.AsObject(oSession.GetObject("GL_PeriodBudgetDetail_svc"))

'

TmpBudgetAcct = TmpAcct+TmpBudgetCOde+TmpFiscalYear+TmpFiscalPeriod   
MsgBox(TmpBudgetAcct)
retVal = oGLAccount.Find(TmpBudgetAcct)   'Find GL Budget Account

if retVal<>0 then

retVal = oGLAccount.GetValue("CreditAmount", TmpCredit)  'Get Account number
retVal = oGLAccount.GetValue("DebitAmount", TmpDebit)  'Get Account number

MsgBox(TmpCredit)

MsgBox(TmpDebit)

end if

Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: GL Budget lookup

My guess is that the key fields are not padded correctly with null.  Try setting them individually.

 

retVal = oGLAccount.SetKeyValue("AccountKey$", TmpAcct)

retVal = oGLAccount.SetKeyValue("BudgetCode$", TmpBudgetCode)

retVal = oGLAccount.SetKeyValue("FiscalYear$", TmpFiscalYear)

retVal = oGLAccount.SetKeyValue("FiscalPeriod$", TmpFiscalPeriod)

retVal = oGLAccount.Find()

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP
Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: GL Budget lookup

Also, you probably don't have a period at the end of "BUDGET 3." in  your data.  The period you see in the key field in Data File Display and Maintenance isn't really a period.  It represents nulls.

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP
Contributor
jryals
Posts: 37
Registered: 11-23-2008
0

Re: GL Budget lookup

Both of you were correct.

Thank you.