on 01-04-2006 6:53 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
9 | |
8 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.