cancel
Showing results for 
Search instead for 
Did you mean: 

SAP B1 - How to get expenses G/L Account for Item using SDK

n_piccone
Explorer
0 Kudos

Hi all,

i need a method to get the default G/L accounts when selecting an Item.

Is there an SDK method to get this information?

I'm Trying to use the GetAdvancedGLAccount method from CompanyService using the following code

Dim objCompanyService As CompanyService
        Dim objGLAccountParameters As AdvancedGLAccountParams
        Dim objGLAccountReturnParams As AdvancedGLAccountReturnParams
        Dim strCardCode As String = ""
        Dim strAccount As String = ""
        Dim oItem As SAPbobsCOM.Items
        Try
            objCompanyService = oSapB1Addon.oCompany.GetCompanyService()
            objGLAccountParameters = oSapB1Addon.oCompany.GetCompanyService.GetDataInterface(CompanyServiceDataInterfaces.csdiAdvancedGLAccountParams)
            strCardCode = Trim(oForm.DataSources.UserDataSources.Item("uCardCode").ValueEx)
            objGLAccountParameters.AccountType = InventoryAccountTypeEnum.iatExpenses
            objGLAccountParameters.BPCode = strCardCode
            objGLAccountReturnParams = oSapB1Addon.oCompany.GetCompanyService.GetDataInterface(CompanyServiceDataInterfaces.csdiAdvancedGLAccountReturnParams)
            objGLAccountReturnParams = objCompanyService.GetAdvancedGLAccount(objGLAccountParameters)
            strAccount = objGLAccountReturnParams.AccountCode
           Return True
        Catch ex As Exception
            Return False
        End Try

but when i call

objGLAccountReturnParams = objCompanyService.GetAdvancedGLAccount(objGLAccountParameters)

i got an error saying "Requested action not supported by this object. What could be the problem? COuld it be that it isn't activated the advanced G/L Account managent in the company? What alternative method I could use in this case?

Thanks in advance.

Accepted Solutions (0)

Answers (0)