cancel
Showing results for 
Search instead for 
Did you mean: 

Error in .NET Compiler when Adding BudgetDistribution

Former Member
0 Kudos

Hi,

I am using SAP 2004 and trying to add budgetdistribution through DI APIs. However, I got the error "Property, indexer, or event 'BudgetAmount' is not supported by the language; try directly calling accessor methods 'SAPbobsCOM.IBudgetDistribution.get_BudgetAmount()' or 'SAPbobsCOM.IBudgetDistribution.set_BudgetAmount(string)'" on assigning BudgetAmount.

Below is my code in C#:

SAPbobsCOM.BudgetDistribution vBGD = (SAPbobsCOM.BudgetDistribution)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBudgetDistribution);

vBGD.Description = "Equal";

vBGD.BudgetAmount = 12;

vBGD.January= 1;

vBGD.February = 1;

vBGD.March =1;

...

int retVal = vBGD.Add();

int errCode;

string errMsg;

if (0 != retVal){

conn.InternalConnection.GetLastError(out errCode, out errMsg);

Console.WriteLine(string.Format("Error code: {0} /r/n Error Message: ",errCode, errMsg));

}else {

Console.WriteLine("Successfully add budget distribution");

}

I would appreciate if anyone can help me with this problem.

Sunny

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184566
Active Contributor
0 Kudos

Hi Sansanee

I tried adding one and it works fine, i did it in VB.net. Also in SBO 2004. Make sure you budgets are on, Administration->System Initialisation->General settings and then the budget tab. Also i thought your description "equal" would clash with the default ones the system comes with but it doesnt as the "method" number on the Budget Distribution window seems to be the primary key. I tried the following and it worked fine

Dim oBudgetDist As SAPbobsCOM.BudgetDistribution

oBudgetDist = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBudgetDistribution)

oBudgetDist.Description = "SDK"

oBudgetDist.BudgetAmount = 12 'value

oBudgetDist.January = 1

oBudgetDist.February = 1

oBudgetDist.March = 1

oBudgetDist.April = 1

oBudgetDist.May = 1

oBudgetDist.June = 1

oBudgetDist.July = 1

oBudgetDist.August = 1

oBudgetDist.September = 1

oBudgetDist.October = 1

oBudgetDist.November = 1

oBudgetDist.December = 1

lRetCode = oBudgetDist.Add()

If lRetCode <> 0 Then

oCompany.GetLastError(lRetCode, sErrMsg)

MsgBox(sErrMsg)

End If

I'm on 2004, patch 31

Hope this helps

Former Member
0 Kudos

Louis,

I can add budget from SBO UI directly, but my code doesn't even build because of the error. I am not sure if I need patch to make it work.

Sunny