Skip to Content
0
Sep 24, 2012 at 12:13 PM

Update UDO through DI API

1399 Views

Hi there,

I was wondering if anyone could help me to update Intrastat values through SAPs DI API.

Through the scn I find several topics about Intrastat and the conversion of being a UDT to a UDO.

And how intrastat has its own way of codes. However I want to add and update data from the table: @BNITMDV

I came across the following code however I receive the following error -1002 Service Not Found.

Does anyone know what I'm doing wrong...?

'this service provides access to UDOs

Dim oGeneralService As SAPbobsCOM.GeneralService

'Represents a single record of a UDO

Dim oGeneralData As SAPbobsCOM.GeneralData

Dim oCmpSrv As SAPbobsCOM.CompanyService

Set oCmpSrv = oCompany.GetCompanyService

'Returns an instance of GeneralService for the specified user-defined object (UDO)

Set oGeneralService = oCmpSrv.GetGeneralService("@BNITMDV")

Set oGeneralData = oGeneralService.GetDataInterface(gsGeneralData)

'set Code by reading value from current cell

oGeneralData.SetProperty "Code", "000001BA"

'set Name by reading value from the next cell - Offset(0,1)

oGeneralData.SetProperty "Name", "Test"

'Set UDF1 by reading value from the third cell

oGeneralData.SetProperty "U_ITMCode", "12290"

'Set UDF2 by reading value from the fourth cell

oGeneralData.SetProperty "U_CommCode", "85419000"

oGeneralService.Add oGeneralData 'Adds a row to the UDO table

Kind regards,

Marcel Kieboom