-1004 Data Source - Value Not Found

Marcel Kieboom

Hi there,

I was wondering if anyone could help me with the following problem.

Within the coresuite optimizer I listen to a Desinger LayoutDef Event.

When the event occurs, I want to submit a trackingnumber to a delivery document.

Here is my code:


SAPbobsCOM.Company oCompany = SwissAddonFramework.B1Connector.GetB1Connector().Company;

SAPbobsCOM.Documents oDelivery = (SAPbobsCOM.Documents) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes);

DocEntry = Int32.Parse(pVal.ReportEvent.GeneralData.SubmittedParams.GetParameterValue("DocEntry"));

ObjType = Int32.Parse(pVal.ReportEvent.GeneralData.SubmittedParams.GetParameterValue("ObjType"));


oDelivery.TrackingNumber = "My Tracking Number";

Error = oDelivery.Update();


However in some cases, the Error variable will be filled with: -1004 which means: Data Source - Value Not Found.

This is actually the same when I want to update an Business Partner and fill a user defined field:

Does anyone know what the problem is?


SAPbobsCOM.Company oCompany = SwissAddonFramework.B1Connector.GetB1Connector().Company;

SAPbobsCOM.BusinessPartners oBP = (SAPbobsCOM.BusinessPartners) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners);


oBP.UserFields.Fields.Item("U_UDF").Value = "MYVALUE";

result = oBP.Update();


Our SAP Version: 8.81 PL 07

Coresuite version: 3.30


Kind regards,


Paolo Manfrin

Hi Marcel,

as far as I know this seems to be due to the fact that DocEntry is not the right one.

Did you try to keep tract of such DocEntry before opening the report?

I would suggest to do


DocEntry = Int32.Parse(pVal.ReportEvent.GeneralData.SubmittedParams.GetParameterValue("DocEntry"));

SwissAddonFramework.Messaging.Debug.WriteMessage("Document Docentry: " + DocEntry.ToString(), SwissAddonFramework.Messaging.Debug.DebugLevel.Always);


and when you detect which DocEntry is used try to replicate using such DocEntry.

Another issue I can see in your code is that you do not release the SAP object.

It is good practice to always finish your code with:


oBP = null;



This is required due to the fact that SAP is not releasing properly all the objects in memory and when you have heavy usage the memory might be leaking generating such kind of errors.

I experienced this when updating huge amount of data.





Please sign in to leave a comment.

Didn't find what you were looking for?

New post