on 05-03-2013 9:19 PM
Hi,
I´m using DI API 8.81 to créate new sale order, all work fine but I have a problema with series field, the value that I´m traying to
assign is 6, but the API is assigning -1, in database.
Somebody have idea why the series field can´t assign it?
Thanks.
int lRetCode;
int lErrCode = 0;
string sErrMsg = "";
// Init the Order object
MainModule.oOrder = (SAPbobsCOM.Documents)MainModule.oCompany.GetBusinessObject SAPbobsCOM.BoObjectTypes.oOrders);
MainModule.oOrder.CardCode = "14154";
MainModule.oOrder.HandWritten = SAPbobsCOM.BoYesNoEnum.tYES;
MainModule.oOrder.DocNum = System.Convert.ToInt32("500902");
MainModule.oOrder.DocDate = DatePosting.Value;
MainModule.oOrder.DocDueDate = DateDelivery.Value;
MainModule.oOrder.Series = System.Convert.ToInt32("6"); //<-<-<-<-<-<-< Series
MainModule.oOrder.Lines.ItemCode = "BAR 214";
MainModule.oOrder.Lines.Quantity = System.Convert.ToDouble(1);
MainModule.oOrder.Lines.TaxCode = "A4";
MainModule.oOrder.Lines.SerialNum = "6";
MainModule.oOrder.Lines.WarehouseCode = "03";
MainModule.oOrder.Lines.Add();
lRetCode = MainModule.oOrder.Add(); // Try to add the orer to the database
if (lRetCode != 0)
{
int temp_int = lErrCode;
string temp_string = sErrMsg;
MainModule.oCompany.GetLastError(out lErrCode, out temp_string);
MessageBox.Show(lErrCode + " " + sErrMsg); // Display error message
}
else
{
MessageBox.Show("Order Added to DataBase");
}
Hi Alain.
Remove this line from your code
MainModule.oOrder.HandWritten = SAPbobsCOM.BoYesNoEnum.tYES;
The handwritten property is for manual numbering series, thus you get -1 series.
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.