on 2024 Apr 03 1:35 AM
Hello,
I am trying to cancel Asset Capitalization document through DI-API (VB.net)
Below are my code.
Dim oActivity As SAPbobsCOM.AssetDocumentService
oActivity = oCompany.GetBusinessObject(SAPbobsCOM.ServiceTypes.AssetCapitalizationService)
'Dim oParam As SAPbobsCOM.AssetDocumentParams
Dim oParam = oActivity.GetDataInterface(SAPbobsCOM.AssetDocumentServiceDataInterfaces.adsAssetDocumentParams)
oParam.Code = docno
oParam.CancellationOption = SAPbobsCOM.ClosingOptionEnum.coByOriginalDocumentDat
oActivity.Cancel(oParam)
I get the error at line Dim oParam = oActivity.GetDataInterface(SAPbobsCOM.AssetDocumentServiceDataInterfaces.adsAssetDocumentParams)
Error saying Object reference not set to an instance of an object.
I think i am not calling the function correctly.
Please help me identify the issue.
Thanks in Advance.
Ibrahim
Request clarification before answering.
Hi ibrey,
Try something as below:
Dim oService As SAPbobsCOM.CompanyService = oCompany.GetCompanyService()
Dim AssetService As SAPbobsCOM.AssetDocumentService = oService.GetBusinessService(SAPbobsCOM.ServiceTypes.AssetCapitalizationService)
Dim AssetDocument As SAPbobsCOM.AssetDocument = AssetService.GetDataInterface(SAPbobsCOM.AssetDocumentServiceDataInterfaces.adsAssetDocument)
Dim AssetDocumentParams As SAPbobsCOM.AssetDocumentParams = AssetService.GetDataInterface(SAPbobsCOM.AssetDocumentServiceDataInterfaces.adsAssetDocumentParams)
AssetDocumentParams.Code = 25
AssetDocumentParams.CancellationOption = SAPbobsCOM.ClosingOptionEnum.coBySpecifiedDate
AssetDocumentParams.CancellationDate = "2024-03-01"
AssetService.Cancel(AssetDocumentParams)
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ibrey,
The code has been updated. Kindly check it.
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
User | Count |
---|---|
90 | |
8 | |
7 | |
5 | |
5 | |
4 | |
4 | |
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.