Skip to Content
Former Member
Jan 04, 2006 at 10:15 PM

Error -5002:Date not within the forecast period when adding Sales Forecast



I am trying to add Sales Forecast through the DI APIs but I got the error code: -5002 and the error message is "Date not within the forecast period [OFCT

.UserSign][line: 1]". I set myposting period to 2006 as current too so I am very perplexed with the error thrown. My C# Code is below:

SAPbobsCOM.SalesForecast vFCT = (SAPbobsCOM.SalesForecast) company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesForecast);

vFCT.ForecastCode = "F01";

vFCT.ForecastName = "Forecast for First Quarter 2006";

vFCT.ForecastStartDate = new DateTime(2006,1,1,0,0,0,0);

vFCT.ForecastEndDate = new DateTime(2006, 3, 12,0,0,0,0);

vFCT.Lines.ItemNo = "A00001";

vFCT.Lines.Quantity = 200;



vFCT.Lines.ItemNo = "A00002";

vFCT.Lines.Quantity = 500;

int retVal = vFCT.Add();

int errCode;

string errMsg;

if (0 != retVal){

company.GetLastError(out errCode, out errMsg);

Console.WriteLine(string.Format("Error code: {0}; Error Message: ",errCode, errMsg));


else {

Console.WriteLine("Successfully add sales forecast");


I would appreciate if anyone can help point me out how i can solve this problem.