Hello Liviu
Thank you for your reply. Your solution was very helpful, simple and it works!
Following your solution I cannot insert a new document at Saldoc for company 2, but only for company 1
All settings are the same in both companies.
I got an error message "must give the document number" Original: "Πρέπει να δοθεί ο αριθμός του παραστατικού"
Code is very simple:
function testdoc () {
var myObj = X.CreateObj('SALDOC');
try {
myObj.DBINSERT;
var TblFin = myObj.FindTable('FINDOC');
TblFin.Edit;
TblFin.Company=2;
TblFin.Series = 7021;
TblFin.Trdr= 6132;
var TblLns = myObj.FindTable('ITELINES');
TblLns.Append;
TblLns.Company=2;
TblLns.MTRL = 14337;
TblLns.QTY1 = 1;
TblLns.PRICE = 50;
TblLns.Post;
var id = myObj.DBPOST;
if (id > 0)
return 'New id is:' + id;
}
catch (e) {
if (myObj != null)
return "General Error: " +e.message+" nObject Error: "+myObj.GETLASTERROR;
else
return "General Error: " +e.message;
}
finally {
}
}
Changing above statement for Company=2 to Company=1 it works.
Any idea?
Kind regards
Eddie Armaos